@pnpm/package-is-installable
Advanced tools
Comparing version 6.0.2 to 6.0.3
@@ -11,3 +11,4 @@ import PnpmError from '@pnpm/error'; | ||
os: string | string[]; | ||
libc: string | string[]; | ||
} | ||
export declare type WantedPlatform = Partial<Platform>; |
@@ -8,2 +8,4 @@ "use strict"; | ||
const error_1 = __importDefault(require("@pnpm/error")); | ||
const detect_libc_1 = require("detect-libc"); | ||
const currentLibc = (0, detect_libc_1.familySync)() ?? 'unknown'; | ||
class UnsupportedPlatformError extends error_1.default { | ||
@@ -18,6 +20,6 @@ constructor(packageId, wanted, current) { | ||
function checkPlatform(packageId, wantedPlatform) { | ||
const platform = process.platform; | ||
const arch = process.arch; | ||
const { platform, arch } = process; | ||
let osOk = true; | ||
let cpuOk = true; | ||
let libcOk = true; | ||
if (wantedPlatform.os) { | ||
@@ -29,5 +31,8 @@ osOk = checkList(platform, wantedPlatform.os); | ||
} | ||
if (!osOk || !cpuOk) { | ||
return new UnsupportedPlatformError(packageId, wantedPlatform, { os: platform, cpu: arch }); | ||
if (wantedPlatform.libc && currentLibc !== 'unknown') { | ||
libcOk = checkList(currentLibc, wantedPlatform.libc); | ||
} | ||
if (!osOk || !cpuOk || !libcOk) { | ||
return new UnsupportedPlatformError(packageId, wantedPlatform, { os: platform, cpu: arch, libc: currentLibc }); | ||
} | ||
return null; | ||
@@ -34,0 +39,0 @@ } |
@@ -12,2 +12,3 @@ import { UnsupportedEngineError, WantedEngine } from './checkEngine'; | ||
os?: string[]; | ||
libc?: string[]; | ||
}, options: { | ||
@@ -24,2 +25,3 @@ engineStrict?: boolean; | ||
os?: string[]; | ||
libc?: string[]; | ||
}, options: { | ||
@@ -26,0 +28,0 @@ nodeVersion?: string; |
@@ -63,2 +63,3 @@ "use strict"; | ||
os: manifest.os ?? ['any'], | ||
libc: manifest.libc ?? ['any'], | ||
}) ?? ((manifest.engines == null) | ||
@@ -65,0 +66,0 @@ ? null |
{ | ||
"name": "@pnpm/package-is-installable", | ||
"version": "6.0.2", | ||
"version": "6.0.3", | ||
"description": "Checks if a package is installable on the current system", | ||
@@ -27,2 +27,3 @@ "main": "lib/index.js", | ||
"@pnpm/types": "8.0.1", | ||
"detect-libc": "^2.0.1", | ||
"execa": "npm:safe-execa@^0.1.1", | ||
@@ -34,3 +35,3 @@ "mem": "^8.0.0", | ||
"@pnpm/logger": "^4.0.0", | ||
"@pnpm/package-is-installable": "6.0.2", | ||
"@pnpm/package-is-installable": "6.0.3", | ||
"@types/semver": "^7.3.4" | ||
@@ -37,0 +38,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
18255
261
8
+ Addeddetect-libc@^2.0.1
+ Addeddetect-libc@2.0.3(transitive)