@pnpm/npm-resolver
Advanced tools
Comparing version 7.3.1 to 7.3.2
@@ -0,4 +1,3 @@ | ||
import { FetchFromRegistry } from 'fetch-from-npm-registry'; | ||
import { PackageMeta } from './pickPackage'; | ||
export default function fromRegistry(fetch: (url: string, opts: { | ||
auth?: object; | ||
}) => Promise<{}>, pkgName: string, registry: string, auth?: object): Promise<PackageMeta>; | ||
export default function fromRegistry(fetch: FetchFromRegistry, pkgName: string, registry: string, authHeaderValue?: string): Promise<PackageMeta>; |
@@ -20,5 +20,5 @@ "use strict"; | ||
} | ||
async function fromRegistry(fetch, pkgName, registry, auth) { | ||
async function fromRegistry(fetch, pkgName, registry, authHeaderValue) { | ||
const uri = toUri(pkgName, registry); | ||
const response = await fetch(uri, { auth }); | ||
const response = await fetch(uri, { authHeaderValue }); | ||
if (response.status > 400) { | ||
@@ -25,0 +25,0 @@ throw new RegistryResponseError({ |
@@ -60,4 +60,6 @@ "use strict"; | ||
}); | ||
const getCreds = getCredentialsByURI.bind(null, opts.rawConfig); | ||
const getAuthHeaderValueByURI = mem((registry) => getCreds(registry).authHeaderValue); | ||
return resolveNpm.bind(null, { | ||
getCredentialsByURI: mem((registry) => getCredentialsByURI(registry, opts.rawConfig)), | ||
getAuthHeaderValueByURI, | ||
pickPackage: pickPackage_1.default.bind(null, { | ||
@@ -92,7 +94,7 @@ fetch, | ||
return null; | ||
const auth = ctx.getCredentialsByURI(opts.registry); | ||
const authHeaderValue = ctx.getAuthHeaderValueByURI(opts.registry); | ||
let pickResult; | ||
try { | ||
pickResult = await ctx.pickPackage(spec, { | ||
auth, | ||
authHeaderValue, | ||
dryRun: opts.dryRun === true, | ||
@@ -99,0 +101,0 @@ preferredVersionSelectors: (_a = opts.preferredVersions) === null || _a === void 0 ? void 0 : _a[spec.name], |
@@ -26,3 +26,3 @@ import { VersionSelectors } from '@pnpm/resolver-base'; | ||
export declare type PickPackageOptions = { | ||
auth: object; | ||
authHeaderValue?: string; | ||
preferredVersionSelectors: VersionSelectors | undefined; | ||
@@ -33,3 +33,3 @@ registry: string; | ||
declare const _default: (ctx: { | ||
fetch: (pkgName: string, registry: string, auth?: object | undefined) => Promise<PackageMeta>; | ||
fetch: (pkgName: string, registry: string, authHeaderValue?: string | undefined) => Promise<PackageMeta>; | ||
metaFileName: string; | ||
@@ -36,0 +36,0 @@ metaCache: PackageMetaCache; |
@@ -64,3 +64,3 @@ "use strict"; | ||
try { | ||
const meta = await ctx.fetch(spec.name, opts.registry, opts.auth); | ||
const meta = await ctx.fetch(spec.name, opts.registry, opts.authHeaderValue); | ||
meta.cachedAt = Date.now(); | ||
@@ -67,0 +67,0 @@ // only save meta to cache, when it is fresh |
{ | ||
"name": "@pnpm/npm-resolver", | ||
"version": "7.3.1", | ||
"version": "7.3.2", | ||
"description": "Resolver for npm-hosted packages", | ||
@@ -38,5 +38,5 @@ "main": "lib/index.js", | ||
"@pnpm/types": "5.0.0", | ||
"credentials-by-uri": "1.0.0", | ||
"credentials-by-uri": "2.0.0", | ||
"encode-registry": "2.0.2", | ||
"fetch-from-npm-registry": "3.0.3", | ||
"fetch-from-npm-registry": "4.0.0", | ||
"load-json-file": "6.2.0", | ||
@@ -43,0 +43,0 @@ "mem": "6.0.1", |
28302
601
+ Addedcredentials-by-uri@2.0.0(transitive)
+ Addedfetch-from-npm-registry@4.0.0(transitive)
- Removedcredentials-by-uri@1.0.0(transitive)
- Removedfetch-from-npm-registry@3.0.3(transitive)
Updatedcredentials-by-uri@2.0.0