Repository navigation
feat: add readdirPrefix option to CachedInputFileSystem#purge - #712
Conversation
With exact: true, readdirPrefix: true still drops the cached readdir results below the purged path, while file stats stay cached.
🦋 Changeset detectedLatest commit: 1d27bca 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 |
|
No actionable comments were generated in the recent review. WalkthroughThe purge options now include Merge Risk:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #712 +/- ##
=======================================
Coverage 98.99% 98.99%
=======================================
Files 52 52
Lines 10940 10944 +4
=======================================
+ Hits 10830 10834 +4
Misses 110 110
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 20.86%2 warnings, 1 note
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## enhanced-resolve@5.27.0 ### Minor Changes - Add a `readdirPrefix` option to `CachedInputFileSystem#purge` that, with `exact: true`, still removes the cached directory listings below `what`. (by [@alexander-akait](https://github.com/alexander-akait) in [#712](#712)) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary
Needed for webpack/webpack#23281.
webpack's watcher purges a changed context directory with
{ exact: true }, so the file stats below it stay cached (webpack/webpack#21020). But the cachedreaddirof its subdirectories stays too, so a file added inpages/sub/is never listed. A plain prefix purge fixes that but drops every stat below the directory again.readdirPrefix: truekeepsexactfor every cache butreaddir, which is purged by prefix. Thereaddircache holds one entry per directory, so the extra scan is small.What kind of change does this PR introduce?
feat
Did you add tests for your changes?
Yes:
test/CachedInputFileSystem.test.js("should prefix-purge readdir but keep stats with readdirPrefix: true"), failing without the change.Does this PR introduce a breaking change?
No. The option is new and off by default.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
JSDoc and
types/CachedInputFileSystem.d.tsupdated; changeset added.Use of AI
Claude Code designed the option, wrote the change, test and changeset, and checked it against webpack's watch test with this patch linked in.
Generated by Claude Code
Summary by CodeRabbit