GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: add exact option to CachedInputFileSystem#purge by alexander-akait · Pull Request #591 · webpack/enhanced-resolve

Conversation

@alexander-akait

@alexander-akait alexander-akait commented May 22, 2026

Copy link
Copy Markdown
Member

Pass { exact: true } as the second argument to purge to remove only
cache entries whose key matches the input exactly, instead of the
default prefix-match behavior. Useful when callers know a specific
file changed and want to avoid evicting unrelated descendants under
the same path prefix.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@alexander-akait
feat: add exact option to CachedInputFileSystem#purge
76166af
Pass { exact: true } as the second argument to purge to remove only
cache entries whose key matches the input exactly, instead of the
default prefix-match behavior. Useful when callers know a specific
file changed and want to avoid evicting unrelated descendants under
the same path prefix.
Copilot AI review requested due to automatic review settings May 22, 2026 08:08
@changeset-bot

changeset-bot Bot commented May 22, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c8ca735

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
enhanced-resolve Minor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Copilot started reviewing on behalf of alexander-akait May 22, 2026 08:08
View session
@alexander-akait
fix: route exact-mode purge directly to readdir backend
932f90b
When exact: true is set, the caller is naming the exact directory whose
readdir cache should be evicted, so going through purgeParent (which
strips to dirname before purging) targets the wrong key. Call the
readdir backend's purge directly in exact mode instead.
@codecov

codecov Bot commented May 22, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.53%. Comparing base (658315c) to head (c8ca735).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #591      +/-   ##
==========================================
+ Coverage   96.49%   96.53%   +0.03%     
==========================================
  Files          50       50              
  Lines        2999     3032      +33     
  Branches      952      969      +17     
==========================================
+ Hits         2894     2927      +33     
  Misses         89       89              
  Partials       16       16              
Flag Coverage Δ
integration 96.53% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Copilot AI reviewed May 22, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown

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.

Pull request overview

Adds an opt-in exact mode to CachedInputFileSystem#purge so callers can evict only the specific cache key(s) provided, rather than the legacy prefix-based eviction behavior (and for readdir, the legacy parent-based eviction behavior).

Changes:

  • Extend CachedInputFileSystem#purge (and underlying cache backends) to accept an optional { exact?: boolean } argument.
  • Implement exact-match eviction in CacheBackend.purge when options.exact === true, including iterable inputs.
  • Add targeted tests covering exact vs prefix purge behavior across stat/readdir and Buffer inputs; add a changeset entry documenting the new option.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
lib/CachedInputFileSystem.js Adds options parameter to purge and implements exact-match eviction logic; adjusts readdir purging behavior for exact mode.
types.d.ts Updates TypeScript declaration for CachedInputFileSystem#purge to include the optional { exact?: boolean } options parameter.
test/CachedInputFileSystem.test.js Adds tests validating exact-only eviction vs legacy prefix/parent eviction behavior.
.changeset/feat-purge-exact-matching.md Documents the new purge option and bumps the package minor version via changesets.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread lib/CachedInputFileSystem.js Outdated
} else if (
return;
}
const exact = options !== undefined && options.exact === true;
Comment thread lib/CachedInputFileSystem.js Outdated
purge(what, options) {
this._statBackend.purge(what, options);
this._lstatBackend.purge(what, options);
if (options && options.exact) {
@codspeed

codspeed Bot commented May 22, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 138 untouched benchmarks


Comparing claude/purge-exact-matching-C9Wpq (c8ca735) with main (658315c)

Open in CodSpeed
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait
fix: handle null options consistently in purge
2d7568f
- CacheBackend.purge: null options now treated as no-options instead of
  crashing on options.exact dereference.
- CachedInputFileSystem.purge: switch the readdir branch to the same
  strict === true check used by CacheBackend so exact-mode is enabled
  consistently across all backends.
- Add a regression test for purge(what, null).
@alexander-akait
alexander-akait requested a review from Copilot May 22, 2026 08:24
Copilot started reviewing on behalf of alexander-akait May 22, 2026 08:24
View session
Copilot AI reviewed May 22, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown

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.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread lib/CachedInputFileSystem.js
Comment on lines 372 to +382
@@ -377,7 +378,39 @@ class CacheBackend {
}
this._enterIdleMode();
}
} else if (
return;
}
@alexander-akait
fix: don't treat falsy what (0, '') as 'purge everything'
14132dd
The legacy guard if (!what) confused valid cache keys — 0 (a file
descriptor, included in the signature) and '' — with the no-argument
'purge all' form. Tighten to an explicit null/undefined check in both
CacheBackend.purge and CacheBackend.purgeParent.
@alexander-akait
alexander-akait requested a review from Copilot May 22, 2026 08:36
Copilot started reviewing on behalf of alexander-akait May 22, 2026 08:36
View session
Copilot AI reviewed May 22, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown

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.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread lib/CachedInputFileSystem.js
Comment on lines +372 to +385
purge(what, options) {
if (what === undefined || what === null) {
if (this._mode !== STORAGE_MODE_IDLE) {
this._data.clear();
for (const level of this._levels) {
level.clear();
}
this._enterIdleMode();
}
} else if (
return;
}
const exact =
options !== undefined && options !== null && options.exact === true;
if (exact) {
@alexander-akait
perf: short-circuit purge('') back to O(1) clear-all
c8ca735
Previously purge('') hit the !what fast-path and was an O(1) Map#clear.
After tightening the !what guard to undefined/null only, '' fell into
the prefix branch and became an O(n) scan even though it still matches
every key. Restore the fast path for the empty-string prefix.
@alexander-akait
alexander-akait requested a review from Copilot May 22, 2026 09:20
Copilot started reviewing on behalf of alexander-akait May 22, 2026 09:21
View session
Copilot AI reviewed May 22, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown

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.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@alexander-akait
alexander-akait merged commit a0f6257 into main May 22, 2026
35 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait
alexander-akait deleted the claude/purge-exact-matching-C9Wpq branch May 22, 2026 09:35
@github-actions github-actions Bot mentioned this pull request May 22, 2026
chore(release): new release #592
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@alexander-akait
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.