![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /proc/self/root/usr/local/lib/node_modules/npm/node_modules/bin-links/lib/ |
Upload File : |
const { dirname, relative, join, resolve, basename } = require('path') const linkGently = require('./link-gently.js') const manTarget = require('./man-target.js') const linkMans = ({path, pkg, top, force}) => { const target = manTarget({path, top}) if (!target || !pkg.man || !Array.isArray(pkg.man) || !pkg.man.length) return Promise.resolve([]) // break any links to c:\\blah or /foo/blah or ../blah // and filter out duplicates const set = [...new Set(pkg.man.map(man => man ? join('/', man).replace(/\\|:/g, '/').substr(1) : null) .filter(man => typeof man === 'string'))] return Promise.all(set.map(man => { const parseMan = man.match(/(.*\.([0-9]+)(\.gz)?)$/) if (!parseMan) { return Promise.reject(Object.assign(new Error('invalid man entry name\n' + 'Man files must end with a number, ' + 'and optionally a .gz suffix if they are compressed.' ), { code: 'EBADMAN', path, pkgid: pkg._id, man, })) } const stem = parseMan[1] const sxn = parseMan[2] const base = basename(stem) const absFrom = resolve(path, man) /* istanbul ignore if - that unpossible */ if (absFrom.indexOf(path) !== 0) { return Promise.reject(Object.assign(new Error('invalid man entry'), { code: 'EBADMAN', path, pkgid: pkg._id, man, })) } const to = resolve(target, 'man' + sxn, base) const from = relative(dirname(to), absFrom) return linkGently({from, to, path, absFrom, force}) })) } module.exports = linkMans