Uname : Linux premium36.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Soft : LiteSpeed
Ip : 198.54.115.237
Port : 443
~
/
opt
/
alt
/
alt-nodejs16
/
root
/
lib
/
node_modules
/
npm
/
node_modules
/
npm-install-checks
/
lib
[ HOME ]
Exec
Submit
File Name : index.js
const semver = require('semver') const checkEngine = (target, npmVer, nodeVer, force = false) => { const nodev = force ? null : nodeVer const eng = target.engines const opt = { includePrerelease: true } if (!eng) { return } const nodeFail = nodev && eng.node && !semver.satisfies(nodev, eng.node, opt) const npmFail = npmVer && eng.npm && !semver.satisfies(npmVer, eng.npm, opt) if (nodeFail || npmFail) { throw Object.assign(new Error('Unsupported engine'), { pkgid: target._id, current: { node: nodeVer, npm: npmVer }, required: eng, code: 'EBADENGINE', }) } } const checkPlatform = (target, force = false) => { if (force) { return } const platform = process.platform const arch = process.arch const osOk = target.os ? checkList(platform, target.os) : true const cpuOk = target.cpu ? checkList(arch, target.cpu) : true if (!osOk || !cpuOk) { throw Object.assign(new Error('Unsupported platform'), { pkgid: target._id, current: { os: platform, cpu: arch, }, required: { os: target.os, cpu: target.cpu, }, code: 'EBADPLATFORM', }) } } const checkList = (value, list) => { if (typeof list === 'string') { list = [list] } if (list.length === 1 && list[0] === 'any') { return true } // match none of the negated values, and at least one of the // non-negated values, if any are present. let negated = 0 let match = false for (const entry of list) { const negate = entry.charAt(0) === '!' const test = negate ? entry.slice(1) : entry if (negate) { negated++ if (value === test) { return false } } else { match = match || value === test } } return match || negated === list.length } module.exports = { checkEngine, checkPlatform, }
Back
Folder Name
Submit
File Name
File Content
Submit
Name
Type
Size
Permission
Last Modified
Actions
.
dir
-
0755
2024-03-03 10:54:13
..
dir
-
0755
2024-03-03 10:54:13
index.js
text/plain
1.83 KB
0644
2023-11-03 02:14:59