Skip to content

Commit

Permalink
fix(mod): parse semvers in redirected urls to check updates
Browse files Browse the repository at this point in the history
  • Loading branch information
hasundue committed Oct 22, 2023
1 parent abd521f commit a3771dd
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/dependency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,15 @@ async function _resolve(
LatestSemverCache.set(props.name, null);
return;
}
const specifierWithLatestSemVer = response.url;
if (specifierWithLatestSemVer === url.href) {
// The dependency is up to date
const latestSemVer = parseSemVer(response.url);
if (
!latestSemVer || // The host redirected to a url without semver
latestSemVer === props.version // The dependency is already up to date
) {
LatestSemverCache.set(props.name, null);
return;
}
return LatestSemverCache.set(
props.name,
parseSemVer(specifierWithLatestSemVer) as SemVerString,
);
return LatestSemverCache.set(props.name, latestSemVer);
}
case "node:":
case "file:":
Expand Down

0 comments on commit a3771dd

Please sign in to comment.