fix(core): refresh stale @latest npm package cache on load#35777
Open
yudgnahk wants to merge 8 commits into
Open
fix(core): refresh stale @latest npm package cache on load#35777yudgnahk wants to merge 8 commits into
yudgnahk wants to merge 8 commits into
Conversation
Plugins configured with @latest were pinned to whatever version was installed first because Npm.add short-circuited on node_modules without checking the registry. Compare installed semver against dist-tags.latest for mutable registry specs and reify when newer; pinned and file/git specs are unchanged. Offline registry failures keep the cached install. Fixes anomalyco#25293
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
yudgnahk
marked this pull request as ready for review
July 7, 2026 18:59
This was referenced Jul 9, 2026
Contributor
Author
|
@rekram1-node could you please help me review this PR? Thank you! |
6 tasks
Contributor
Contributor
Author
|
Hi @tobwen, I will take a look at your PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue for this PR
Closes #25293
Type of change
What does this PR do?
Npm.addshort-circuited whennode_modules/{name}existed, so plugins configured as@latestnever picked up newer registry releases.For mutable registry specs (
@latest, ranges, bare names), compare the installed version againstdist-tags.latestbefore returning the cache. If the registry is newer, removepackage-lock.jsonand reify. Pinned versions and file/git specs skip the registry check. Registry failures/timeouts keep the cached install.Also adds
AddOptions.refreshso explicit install paths can force a cache bypass.How did you verify your code works?
Seeded
ms@2.0.0in an isolated cache (XDG_CACHE_HOME), then confirmedNpm.add("ms@latest")andresolvePluginTargetupdated to registry2.1.3.Screenshots / recordings
N/A (core only)
Checklist