Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
let installable!: boolean
if (!parentIsInstallable) {
installable = false
if (!ctx.pickedPackages[relDepPath]) {
opts.skipped.add(relDepPath)
}
} else {
const pkg = {
...nameVerFromPkgSnapshot(relDepPath, pkgSnapshot),
cpu: pkgSnapshot.cpu,
engines: pkgSnapshot.engines,
os: pkgSnapshot.os,
}
// TODO: relDepPath is not the package ID. Should be fixed
installable = opts.includeIncompatiblePackages || packageIsInstallable(pkgSnapshot.id || relDepPath, pkg, {
engineStrict: opts.engineStrict,
lockfileDir: opts.lockfileDir,
nodeVersion: opts.currentEngine.nodeVersion,
optional: pkgSnapshot.optional === true,
pnpmVersion: opts.currentEngine.pnpmVersion,
}) !== false
if (!installable) {
if (!ctx.pickedPackages[relDepPath]) {
opts.skipped.add(relDepPath)
}
} else {
opts.skipped.delete(relDepPath)
ctx.pickedPackages[relDepPath] = pkgSnapshot
}
}
const nextRelDepPaths = R.toPairs(
deprecationLogger.debug({
deprecated: pkg.deprecated,
depth: options.currentDepth,
pkgId: pkgResponse.body.id,
pkgName: pkg.name,
pkgVersion: pkg.version,
prefix: ctx.prefix,
})
}
// using colon as it will never be used inside a package ID
const nodeId = createNodeId(options.parentNodeId, pkgResponse.body.id)
const currentIsInstallable = (
ctx.force ||
packageIsInstallable(pkgResponse.body.id, pkg, {
engineStrict: ctx.engineStrict,
lockfileDir: ctx.lockfileDir,
nodeVersion: ctx.nodeVersion,
optional: wantedDependency.optional,
pnpmVersion: ctx.pnpmVersion,
})
)
if (currentIsInstallable !== true || !parentIsInstallable) {
ctx.skipped.add(pkgResponse.body.id)
}
const installable = parentIsInstallable && currentIsInstallable !== false
const isNew = !ctx.resolvedPackagesByPackageId[pkgResponse.body.id]
if (isNew) {
progressLogger.debug({
packageId: pkgResponse.body.id,
export function packageIsInstallable (
pkgPath: string,
pkg: {
engines?: WantedEngine,
cpu?: string[],
os?: string[],
},
opts: {
engineStrict?: boolean,
},
) {
const err = checkPackage(pkgPath, pkg, {
pnpmVersion: packageManager.stableVersion,
})
if (err === null) return
if (
(err instanceof UnsupportedEngineError && err.wanted.pnpm) ||
opts.engineStrict
) throw err
logger.warn({
message: `Unsupported ${
err instanceof UnsupportedEngineError ? 'engine' : 'platform'
}: wanted: ${JSON.stringify(err.wanted)} (current: ${JSON.stringify(err.current)})`,
prefix: pkgPath,
})
}