mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-24 08:35:19 -04:00
5
.changeset/legal-drinks-smile.md
Normal file
5
.changeset/legal-drinks-smile.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@pnpm/lockfile.utils": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Don't parse the dependency path twice.
|
||||||
@@ -2,7 +2,6 @@ import url from 'url'
|
|||||||
import { type PackageSnapshot, type TarballResolution } from '@pnpm/lockfile.types'
|
import { type PackageSnapshot, type TarballResolution } from '@pnpm/lockfile.types'
|
||||||
import { type Resolution } from '@pnpm/resolver-base'
|
import { type Resolution } from '@pnpm/resolver-base'
|
||||||
import { type Registries } from '@pnpm/types'
|
import { type Registries } from '@pnpm/types'
|
||||||
import * as dp from '@pnpm/dependency-path'
|
|
||||||
import getNpmTarballUrl from 'get-npm-tarball-url'
|
import getNpmTarballUrl from 'get-npm-tarball-url'
|
||||||
import { isGitHostedPkgUrl } from '@pnpm/pick-fetcher'
|
import { isGitHostedPkgUrl } from '@pnpm/pick-fetcher'
|
||||||
import { nameVerFromPkgSnapshot } from './nameVerFromPkgSnapshot'
|
import { nameVerFromPkgSnapshot } from './nameVerFromPkgSnapshot'
|
||||||
@@ -19,7 +18,7 @@ export function pkgSnapshotToResolution (
|
|||||||
) {
|
) {
|
||||||
return pkgSnapshot.resolution as Resolution
|
return pkgSnapshot.resolution as Resolution
|
||||||
}
|
}
|
||||||
const { name } = nameVerFromPkgSnapshot(depPath, pkgSnapshot)
|
const { name, version } = nameVerFromPkgSnapshot(depPath, pkgSnapshot)
|
||||||
let registry: string = ''
|
let registry: string = ''
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
if (name.startsWith('@')) {
|
if (name.startsWith('@')) {
|
||||||
@@ -43,7 +42,6 @@ export function pkgSnapshotToResolution (
|
|||||||
} as Resolution
|
} as Resolution
|
||||||
|
|
||||||
function getTarball (registry: string) {
|
function getTarball (registry: string) {
|
||||||
const { name, version } = dp.parse(depPath)
|
|
||||||
if (!name || !version) {
|
if (!name || !version) {
|
||||||
throw new Error(`Couldn't get tarball URL from dependency path ${depPath}`)
|
throw new Error(`Couldn't get tarball URL from dependency path ${depPath}`)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user