@pnpm/npm-resolver
Advanced tools
Comparing version 2.1.5 to 2.1.6
@@ -69,3 +69,3 @@ "use strict"; | ||
const spec = wantedDependency.pref | ||
? parsePref_1.default(wantedDependency.pref, wantedDependency.alias, opts.defaultTag || 'latest') | ||
? parsePref_1.default(wantedDependency.pref, wantedDependency.alias, opts.defaultTag || 'latest', opts.registry) | ||
: defaultTagForAlias(wantedDependency.alias, opts.defaultTag || 'latest'); | ||
@@ -101,2 +101,3 @@ if (!spec) | ||
latest: meta['dist-tags'].latest, | ||
normalizedPref: spec.normalizedPref, | ||
package: pickedPackage, | ||
@@ -103,0 +104,0 @@ resolution, |
@@ -5,3 +5,4 @@ export interface RegistryPackageSpec { | ||
fetchSpec: string; | ||
normalizedPref?: string; | ||
} | ||
export default function parsePref(pref: string, alias: string | undefined, defaultTag: string): RegistryPackageSpec | null; | ||
export default function parsePref(pref: string, alias: string | undefined, defaultTag: string, registry: string): RegistryPackageSpec | null; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const parse_npm_tarball_url_1 = require("parse-npm-tarball-url"); | ||
const getVersionSelectorType = require("version-selector-type"); | ||
function parsePref(pref, alias, defaultTag) { | ||
function parsePref(pref, alias, defaultTag, registry) { | ||
let name = alias; | ||
@@ -18,12 +19,22 @@ if (pref.startsWith('npm:')) { | ||
} | ||
if (!name) { | ||
return null; | ||
if (name) { | ||
const selector = getVersionSelectorType(pref); | ||
if (selector) { | ||
return { | ||
fetchSpec: selector.normalized, | ||
name, | ||
type: selector.type, | ||
}; | ||
} | ||
} | ||
const selector = getVersionSelectorType(pref); | ||
if (selector) { | ||
return { | ||
fetchSpec: selector.normalized, | ||
name, | ||
type: selector.type, | ||
}; | ||
if (pref.startsWith(registry)) { | ||
const parsed = parse_npm_tarball_url_1.default(pref); | ||
if (parsed) { | ||
return { | ||
fetchSpec: parsed.pkg.version, | ||
name: parsed.pkg.name, | ||
normalizedPref: pref, | ||
type: 'version', | ||
}; | ||
} | ||
} | ||
@@ -30,0 +41,0 @@ return null; |
{ | ||
"name": "@pnpm/npm-resolver", | ||
"version": "2.1.5", | ||
"version": "2.1.6", | ||
"description": "Resolver for npm-hosted packages", | ||
@@ -52,2 +52,3 @@ "main": "lib/index.js", | ||
"p-limit": "^2.0.0", | ||
"parse-npm-tarball-url": "^1.0.3", | ||
"semver": "^5.4.1", | ||
@@ -54,0 +55,0 @@ "ssri": "^6.0.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
35156
469
19
+ Addedparse-npm-tarball-url@^1.0.3
+ Added@types/node@9.6.61(transitive)
+ Addedparse-npm-tarball-url@1.0.3(transitive)
+ Addedsemver-regex@1.0.0(transitive)