Skip to content

Commit

Permalink
Fixes yarnpkg#3490
Browse files Browse the repository at this point in the history
  • Loading branch information
Maël Nison committed Jun 26, 2017
1 parent d1dca28 commit a2ba7c7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/package-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ export default class PackageRequest {
resolveToExistingVersion(info: Manifest) {
// get final resolved version
const {range, name} = PackageRequest.normalizePattern(this.pattern);
const resolved: ?Manifest = this.resolver.getHighestRangeVersionMatch(name, range);
const solvedRange = semver.validRange(range) ? info.version : range;
const resolved: ?Manifest = this.resolver.getHighestRangeVersionMatch(name, solvedRange);
invariant(resolved, 'should have a resolved reference');

this.reportResolvedRangeMatch(info, resolved);
Expand All @@ -268,9 +269,10 @@ export default class PackageRequest {
// check if while we were resolving this dep we've already resolved one that satisfies
// the same range
const {range, name} = PackageRequest.normalizePattern(this.pattern);
const resolved: ?Manifest = frozen
? this.resolver.getExactVersionMatch(name, range)
: this.resolver.getHighestRangeVersionMatch(name, range);
const solvedRange = semver.validRange(range) ? info.version : range;
const resolved: ?Manifest = !info.fresh || frozen
? this.resolver.getExactVersionMatch(name, solvedRange)
: this.resolver.getHighestRangeVersionMatch(name, solvedRange);
if (resolved) {
this.resolver.reportPackageWithExistingVersion(this, info);
return;
Expand Down

0 comments on commit a2ba7c7

Please sign in to comment.