Skip to content

Commit

Permalink
deps: bin-links@4.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Oct 12, 2023
1 parent fcc9e40 commit b405da1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 27 deletions.
43 changes: 22 additions & 21 deletions node_modules/bin-links/lib/link-mans.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,52 @@ 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 linkMans = async ({ path, pkg, top, force }) => {
const target = manTarget({ path, top })
if (!target || !pkg.man || !Array.isArray(pkg.man) || !pkg.man.length) {
return Promise.resolve([])
if (!target || !Array.isArray(pkg?.man) || !pkg.man.length) {
return []
}

// 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, '/').slice(1) : null)
.filter(man => typeof man === 'string'))]

return Promise.all(set.map(man => {
const parseMan = man.match(/(.*\.([0-9]+)(\.gz)?)$/)
const links = []
// `new Set` to filter out duplicates
for (let man of new Set(pkg.man)) {
if (!man || typeof man !== 'string') {
continue
}
// break any links to c:\\blah or /foo/blah or ../blah
man = join('/', man).replace(/\\|:/g, '/').slice(1)
const parseMan = man.match(/\.([0-9]+)(\.gz)?$/)
if (!parseMan) {
return Promise.reject(Object.assign(new Error('invalid man entry name\n' +
throw 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 section = parseMan[1]
const base = basename(man)
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'), {
throw Object.assign(new Error('invalid man entry'), {
code: 'EBADMAN',
path,
pkgid: pkg._id,
man,
}))
})
}

const to = resolve(target, 'man' + sxn, base)
const to = resolve(target, 'man' + section, base)
const from = relative(dirname(to), absFrom)

return linkGently({ from, to, path, absFrom, force })
}))
links.push(linkGently({ from, to, path, absFrom, force }))
}
return Promise.all(links)
}

module.exports = linkMans
6 changes: 3 additions & 3 deletions node_modules/bin-links/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bin-links",
"version": "4.0.2",
"version": "4.0.3",
"description": "JavaScript package binary linker",
"main": "./lib/index.js",
"scripts": {
Expand Down Expand Up @@ -30,7 +30,7 @@
},
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.15.1",
"@npmcli/template-oss": "4.19.0",
"require-inject": "^1.4.4",
"tap": "^16.0.1"
},
Expand All @@ -53,7 +53,7 @@
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"windowsCI": false,
"version": "4.15.1",
"version": "4.19.0",
"publish": true
}
}
6 changes: 3 additions & 3 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -4100,9 +4100,9 @@
}
},
"node_modules/bin-links": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/bin-links/-/bin-links-4.0.2.tgz",
"integrity": "sha512-jxJ0PbXR8eQyPlExCvCs3JFnikvs1Yp4gUJt6nmgathdOwvur+q22KWC3h20gvWl4T/14DXKj2IlkJwwZkZPOw==",
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/bin-links/-/bin-links-4.0.3.tgz",
"integrity": "sha512-obsRaULtJurnfox/MDwgq6Yo9kzbv1CPTk/1/s7Z/61Lezc8IKkFCOXNeVLXz0456WRzBQmSsDWlai2tIhBsfA==",
"dependencies": {
"cmd-shim": "^6.0.0",
"npm-normalize-package-bin": "^3.0.0",
Expand Down

0 comments on commit b405da1

Please sign in to comment.