Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const warn = await installChecks.checkPlatform({
_id: pkgId,
cpu: pkg.cpu,
os: pkg.os,
}) ||
await installChecks.checkEngine({
_id: pkgId,
engines: pkg.engines,
}, {
nodeVersion: options.nodeVersion,
pnpmVersion: options.pnpmVersion,
})
if (!warn) return true
installCheckLogger.warn(warn)
if (options.optional) {
skippedOptionalDependencyLogger.debug({
details: warn.toString(),
package: {
id: pkgId,
name: pkg.name,
version: pkg.version,
},
parents: nodeIdToParents(options.nodeId, options.resolvedPackagesByPackageId),
prefix: options.prefix,
reason: warn.code === 'ENOTSUP' ? 'unsupported_engine' : 'unsupported_platform',
})
return false
}
cpu?: string[],
os?: string[],
},
options: {
engineStrict?: boolean,
nodeVersion?: string,
optional: boolean,
pnpmVersion: string,
lockfileDir: string,
},
): boolean | null {
const warn = checkPackage(pkgId, pkg, options)
if (!warn) return true
installCheckLogger.warn({
message: warn.message,
prefix: options.lockfileDir,
})
if (options.optional) {
skippedOptionalDependencyLogger.debug({
details: warn.toString(),
package: {
id: pkgId,
name: pkg.name,
version: pkg.version,
},
prefix: options.lockfileDir,
reason: warn.code === 'ERR_PNPM_UNSUPPORTED_ENGINE' ? 'unsupported_engine' : 'unsupported_platform',
})