!C99Shell v.2.1 [PHP 7 Update] [1.12.2019]!

Software: Apache. PHP/5.3.29 

uname -a: Linux tardis23.nocplanet.net 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024
x86_64
 

 

Safe-mode: OFF (not secure)

/opt/alt/alt-nodejs18/root/usr/lib/node_modules/npm/node_modules.bundled/@npmcli/package-json/lib/   drwxr-xr-x
Free 979.42 GB of 1859.98 GB (52.66%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     update-dependencies.js (1.98 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
const depTypes = new Set([
  'dependencies',
  'optionalDependencies',
  'devDependencies',
  'peerDependencies',
])

// sort alphabetically all types of deps for a given package
const orderDeps = (content) => {
  for (const type of depTypes) {
    if (content && content[type]) {
      content[type] = Object.keys(content[type])
        .sort((a, b) => a.localeCompare(b, 'en'))
        .reduce((res, key) => {
          res[key] = content[type][key]
          return res
        }, {})
    }
  }
  return content
}

const updateDependencies = ({ content, originalContent }) => {
  const pkg = orderDeps({
    ...content,
  })

  // optionalDependencies don't need to be repeated in two places
  if (pkg.dependencies) {
    if (pkg.optionalDependencies) {
      for (const name of Object.keys(pkg.optionalDependencies)) {
        delete pkg.dependencies[name]
      }
    }
  }

  const result = { ...originalContent }

  // loop through all types of dependencies and update package json pkg
  for (const type of depTypes) {
    if (pkg[type]) {
      result[type] = pkg[type]
    }

    // prune empty type props from resulting object
    const emptyDepType =
      pkg[type]
      && typeof pkg === 'object'
      && Object.keys(pkg[type]).length === 0
    if (emptyDepType) {
      delete result[type]
    }
  }

  // if original package.json had dep in peerDeps AND deps, preserve that.
  const { dependencies: origProd, peerDependencies: origPeer } =
    originalContent || {}
  const { peerDependencies: newPeer } = result
  if (origProd && origPeer && newPeer) {
    // we have original prod/peer deps, and new peer deps
    // copy over any that were in both in the original
    for (const name of Object.keys(origPeer)) {
      if (origProd[name] !== undefined && newPeer[name] !== undefined) {
        result.dependencies = result.dependencies || {}
        result.dependencies[name] = newPeer[name]
      }
    }
  }

  return result
}

updateDependencies.knownKeys = depTypes

module.exports = updateDependencies

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v.2.1 [PHP 7 Update] [1.12.2019] maintained by KaizenLouie and updated by cermmik | C99Shell Github (MySQL update) | Generation time: 0.0494 ]--