403Webshell
Server IP : 46.62.235.243  /  Your IP : 216.73.216.163
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux Linkabili3Dicembre 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/share/node_modules/libnpmversion/node_modules/npm-install-checks/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/node_modules/libnpmversion/node_modules/npm-install-checks/lib/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,
}

Youez - 2016 - github.com/yon3zu
LinuXploit