mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-26 19:12:12 -04:00
fix: remove spread-operator usage to support Node 4
This commit is contained in:
@@ -17,23 +17,23 @@ export function lookupResolution(shrinkwrap: Shrinkwrap, dependency: string): Re
|
||||
if (item) {
|
||||
item = item as any as TarballResolution // tslint:disable-line
|
||||
if (item.tarball != null) {
|
||||
return {...item, type: 'tarball'} as Resolution
|
||||
return Object.assign({}, item, {type: 'tarball'}) as Resolution
|
||||
}
|
||||
item = item as any as GitRepositoryResolution // tslint:disable-line
|
||||
if (item.repo != null && item.commitId != null) {
|
||||
return {...item, type: 'git-repo'} as Resolution
|
||||
return Object.assign({}, item, {type: 'git-repo'}) as Resolution
|
||||
}
|
||||
item = item as any as DirectoryResolution // tslint:disable-line
|
||||
if (item.root != null) {
|
||||
return {...item, type: 'directory'} as Resolution
|
||||
return Object.assign({}, item, {type: 'directory'}) as Resolution
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
export function putResolution(shrinkwrap: Shrinkwrap, dependency: string, resolution: Resolution) {
|
||||
let {type, ...item} = resolution
|
||||
shrinkwrap[dependency] = item as Resolution
|
||||
shrinkwrap[dependency] = Object.assign({}, resolution)
|
||||
delete shrinkwrap[dependency].type
|
||||
}
|
||||
|
||||
export async function read (pkgPath: string): Promise<Shrinkwrap | null> {
|
||||
|
||||
@@ -104,7 +104,7 @@ function execGit (args: string[], opts?: Object) {
|
||||
|
||||
export function fetchFromTarball (dir: string, dist: PackageDist, opts: FetchOptions) {
|
||||
if (dist.tarball.startsWith('file:')) {
|
||||
dist = {...dist, tarball: dist.tarball.slice(5)}
|
||||
dist = Object.assign({}, dist, {tarball: dist.tarball.slice(5)})
|
||||
return fetchFromLocalTarball(dir, dist)
|
||||
} else {
|
||||
return fetchFromRemoteTarball(dir, dist, opts)
|
||||
|
||||
Reference in New Issue
Block a user