HEX
Server: Apache/2.4.65 (Debian)
System: Linux kubikelcreative 5.10.0-35-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64
User: www-data (33)
PHP: 8.4.13
Disabled: NONE
Upload Files
File: //usr/share/nodejs/@npmcli/arborist/lib/from-path.js
// file dependencies need their dependencies resolved based on the
// location where the tarball was found, not the location where they
// end up getting installed.  directory (ie, symlink) deps also need
// to be resolved based on their targets, but that's what realpath is

const {dirname} = require('path')
const npa = require('npm-package-arg')

const fromPath = (node, spec) =>
  spec && spec.type === 'file' ? dirname(spec.fetchSpec)
  : node.realpath

module.exports = node => fromPath(node, node.resolved && npa(node.resolved))