PHP 8.3.31
Preview: consistent-resolve.js Size: 1.40 KB
/opt/alt/alt-nodejs16/root/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/consistent-resolve.js

// take a path and a resolved value, and turn it into a resolution from
// the given new path.  This is used with converting a package.json's
// relative file: path into one suitable for a lockfile, or between
// lockfiles, and for converting hosted git repos to a consistent url type.
const npa = require('npm-package-arg')
const relpath = require('./relpath.js')
const consistentResolve = (resolved, fromPath, toPath, relPaths = false) => {
  if (!resolved) {
    return null
  }

  try {
    const hostedOpt = { noCommittish: false }
    const {
      fetchSpec,
      saveSpec,
      type,
      hosted,
      rawSpec,
      raw,
    } = npa(resolved, fromPath)
    const isPath = type === 'file' || type === 'directory'
    return isPath && !relPaths ? `file:${fetchSpec.replace(/#/g, '%23')}`
      : isPath ? 'file:' + (toPath ? relpath(toPath, fetchSpec.replace(/#/g, '%23')) : fetchSpec.replace(/#/g, '%23'))
      : hosted ? `git+${
        hosted.auth ? hosted.https(hostedOpt) : hosted.sshurl(hostedOpt)
      }`
      : type === 'git' ? saveSpec
      // always return something.  'foo' is interpreted as 'foo@' otherwise.
      : rawSpec === '' && raw.slice(-1) !== '@' ? raw
      // just strip off the name, but otherwise return as-is
      : rawSpec
  } catch (_) {
    // whatever we passed in was not acceptable to npa.
    // leave it 100% untouched.
    return resolved
  }
}
module.exports = consistentResolve

Directory Contents

Dirs: 1 × Files: 38

Name Size Perms Modified Actions
arborist DIR
- drwxr-xr-x 2026-04-08 06:31:02
Edit Download
4.89 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
11.99 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
3.07 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
13.94 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
1.32 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
1.40 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
1.20 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
691 B lrw-r--r-- 2026-03-17 06:55:04
Edit Download
4.87 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
9.57 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
6.82 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
1.04 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
1.26 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
863 B lrw-r--r-- 2026-03-17 06:55:04
Edit Download
353 B lrw-r--r-- 2026-03-17 06:55:04
Edit Download
3.20 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
3.60 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
43.06 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
1.32 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
230 B lrw-r--r-- 2026-03-17 06:55:04
Edit Download
2.54 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
2.57 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
19.73 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
5.09 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
16.43 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
2.67 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
131 B lrw-r--r-- 2026-03-17 06:55:04
Edit Download
638 B lrw-r--r-- 2026-03-17 06:55:04
Edit Download
491 B lrw-r--r-- 2026-03-17 06:55:04
Edit Download
37.02 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
2.19 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
1.35 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
874 B lrw-r--r-- 2026-03-17 06:55:04
Edit Download
3.29 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
4.02 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
1.45 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
5.72 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download
10.05 KB lrw-r--r-- 2026-03-17 06:55:04
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).