Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const dependencyLockfile = lockfile.packages?.[relDepPath]
if (dependencyLockfile) {
if (dependencyLockfile.peerDependencies && dependencyLockfile.dependencies) {
// This is done to guarantee that the dependency will be relinked with the
// up-to-date peer dependencies
// Covered by test: "peer dependency is grouped with dependency when peer is resolved not from a top dependency"
R.keys(dependencyLockfile.peerDependencies).forEach((peer) => {
delete dependencyLockfile.dependencies![peer]
})
}
const depPath = dp.resolve(registries, relDepPath)
return {
currentResolution: pkgSnapshotToResolution(relDepPath, dependencyLockfile, registries),
dependencyLockfile,
depPath,
optionalDependencyNames: R.keys(dependencyLockfile.optionalDependencies),
pkgId: packageIdFromSnapshot(relDepPath, dependencyLockfile, registries),
relDepPath,
resolvedDependencies: {
...dependencyLockfile.dependencies,
...dependencyLockfile.optionalDependencies,
},
}
} else {
return {
pkgId: dp.tryGetPackageId(registries, relDepPath) || relDepPath, // Does it make sense to set pkgId when we're not sure?
relDepPath,
}
}