Repository navigation
refactor(exports): add internal ExportsInfo reset APIs for incremental rebuilds - #21553
Conversation
|
0d37ee6 to
446d6a6
Compare
|
This PR is packaged and the instant preview is available (a8279a4). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@a8279a4
yarn add -D webpack@https://pkg.pr.new/webpack@a8279a4
pnpm add -D webpack@https://pkg.pr.new/webpack@a8279a4 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #21553 +/- ##
=======================================
Coverage 93.79% 93.80%
=======================================
Files 622 622
Lines 74463 74500 +37
Branches 21609 21616 +7
=======================================
+ Hits 69846 69885 +39
+ Misses 4617 4615 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will degrade performance by 9.03%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Memory | benchmark "devtool-eval", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
499.8 KB | 874 KB | -42.82% |
| ❌ | Memory | benchmark "asset-modules-inline", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
276.7 KB | 395.3 KB | -30.01% |
| ⚡ | Memory | benchmark "asset-modules-resource", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
1,242.2 KB | 660.4 KB | +88.09% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing refactor/exports-info-reset-apis (888d134) with main (26441ce)
620a2c3 to
e654b51
Compare
|
@bjohansebas can you take a look at cursor comment |
…l rebuilds Reset provide-side and use-side export info to the undetermined state so FlagDependencyExports/FlagDependencyUsage can recompute them against a persisted module graph. No behavior change.
…exports Mirror setHasUseInfo: _resetUseInfo recurses into an owned nested exportsInfo and _resetUsedExports follows the redirect target, so no stale usage survives a use-only reset.
…ale inlined flag Reset an owned nested exportsInfo in place instead of discarding it (its use state must survive a provide-only reset), and clear the _hasInlinedExports fast-path flag when use info is reset.
e654b51 to
ed564b6
Compare
…s info After a provide reset the nested exports are back to undefined, and FlagDependencyExports only upgrades provided from false/null, so the module-level re-init must reach nested exports (mirrors setHasUseInfo).
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fdc68f4. Configure here.
The redirect points into another module's exports info; the global incremental reset loop already resets it via its own module, so following it wiped foreign state (and double-reset shared targets).
Assert use-state resets through the public getUsed/getUsedName API instead of private fields, and cast the setTarget/canInlineProvide fixtures.

Summary
Adds internal
ExportsInfo/ExportInfoAPIs that reset provide-side and use-side export info to the undetermined state, soFlagDependencyExportsPlugin/FlagDependencyUsagePlugincan recompute them against a persisted module graph. No behavior change; second PR of the incremental-rebuilds series (stacked on #21552, extracted fromperf/incremental-rebuild).What kind of change does this PR introduce?
refactor
Did you add tests for your changes?
Yes,
test/ExportsInfo.unittest.jscovers the four new methods.Does 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?
n/a
Use of AI
AI (Claude Code) was used to extract this change from my working branch, adapt it onto current
main, and draft the unit tests; I reviewed and validated everything locally.Note
Low Risk
Internal APIs with unit tests only and no production callers yet; limited blast radius until incremental rebuild integration lands.
Overview
Adds internal
ExportsInfo/ExportInforeset helpers so export provide and use metadata can be cleared beforeFlagDependencyExportsPluginandFlagDependencyUsagePluginrun again on a persisted module graph during incremental rebuilds.Provide side:
_resetProvidedExports/_resetProvideInforeturnprovided, targets, inline/pure-provide bits, and redirect state to undetermined values; owned nestedexportsInfois reset in place so use data is preserved.setHasProvideInfonow recurses into owned nested info so plugins can re-merge after a reset.Use side:
_resetUsedExports/_resetUseInfoclear usage, mangling, inlined names, and_hasInlinedExports, without touching provide info or another module’s redirect target.New unit tests in
test/ExportsInfo.unittest.jscover these behaviors. No wiring in this PR—call sites come in a later incremental-rebuild change.Reviewed by Cursor Bugbot for commit 888d134. Bugbot is set up for automated code reviews on this repo. Configure here.