Skip to content

Commit 9cd6603

Browse files
committed
deps: update [email protected]
1 parent b84d907 commit 9cd6603

File tree

11 files changed

+168
-239
lines changed

11 files changed

+168
-239
lines changed

node_modules/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@
269269
!/read-package-json-fast
270270
!/read-package-json-fast/node_modules/
271271
/read-package-json-fast/node_modules/*
272-
!/read-package-json-fast/node_modules/json-parse-even-better-errors
272+
!/read-package-json-fast/node_modules/npm-normalize-package-bin
273273
!/read
274274
!/retry
275275
!/rimraf

node_modules/read-package-json-fast/node_modules/json-parse-even-better-errors/LICENSE.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

node_modules/read-package-json-fast/node_modules/json-parse-even-better-errors/lib/index.js

Lines changed: 0 additions & 137 deletions
This file was deleted.

node_modules/read-package-json-fast/node_modules/json-parse-even-better-errors/package.json

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
The ISC License
2+
3+
Copyright (c) npm, Inc.
4+
5+
Permission to use, copy, modify, and/or distribute this software for any
6+
purpose with or without fee is hereby granted, provided that the above
7+
copyright notice and this permission notice appear in all copies.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// pass in a manifest with a 'bin' field here, and it'll turn it
2+
// into a properly santized bin object
3+
const { join, basename } = require('path')
4+
5+
const normalize = pkg =>
6+
!pkg.bin ? removeBin(pkg)
7+
: typeof pkg.bin === 'string' ? normalizeString(pkg)
8+
: Array.isArray(pkg.bin) ? normalizeArray(pkg)
9+
: typeof pkg.bin === 'object' ? normalizeObject(pkg)
10+
: removeBin(pkg)
11+
12+
const normalizeString = pkg => {
13+
if (!pkg.name) {
14+
return removeBin(pkg)
15+
}
16+
pkg.bin = { [pkg.name]: pkg.bin }
17+
return normalizeObject(pkg)
18+
}
19+
20+
const normalizeArray = pkg => {
21+
pkg.bin = pkg.bin.reduce((acc, k) => {
22+
acc[basename(k)] = k
23+
return acc
24+
}, {})
25+
return normalizeObject(pkg)
26+
}
27+
28+
const removeBin = pkg => {
29+
delete pkg.bin
30+
return pkg
31+
}
32+
33+
const normalizeObject = pkg => {
34+
const orig = pkg.bin
35+
const clean = {}
36+
let hasBins = false
37+
Object.keys(orig).forEach(binKey => {
38+
const base = join('/', basename(binKey.replace(/\\|:/g, '/'))).slice(1)
39+
40+
if (typeof orig[binKey] !== 'string' || !base) {
41+
return
42+
}
43+
44+
const binTarget = join('/', orig[binKey].replace(/\\/g, '/'))
45+
.replace(/\\/g, '/').slice(1)
46+
47+
if (!binTarget) {
48+
return
49+
}
50+
51+
clean[base] = binTarget
52+
hasBins = true
53+
})
54+
55+
if (hasBins) {
56+
pkg.bin = clean
57+
} else {
58+
delete pkg.bin
59+
}
60+
61+
return pkg
62+
}
63+
64+
module.exports = normalize
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "npm-normalize-package-bin",
3+
"version": "4.0.0",
4+
"description": "Turn any flavor of allowable package.json bin into a normalized object",
5+
"main": "lib/index.js",
6+
"repository": {
7+
"type": "git",
8+
"url": "git+https://github.com/npm/npm-normalize-package-bin.git"
9+
},
10+
"author": "GitHub Inc.",
11+
"license": "ISC",
12+
"scripts": {
13+
"test": "tap",
14+
"snap": "tap",
15+
"lint": "npm run eslint",
16+
"postlint": "template-oss-check",
17+
"template-oss-apply": "template-oss-apply --force",
18+
"lintfix": "npm run eslint -- --fix",
19+
"posttest": "npm run lint",
20+
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
21+
},
22+
"devDependencies": {
23+
"@npmcli/eslint-config": "^5.0.0",
24+
"@npmcli/template-oss": "4.23.3",
25+
"tap": "^16.3.0"
26+
},
27+
"files": [
28+
"bin/",
29+
"lib/"
30+
],
31+
"engines": {
32+
"node": "^18.17.0 || >=20.5.0"
33+
},
34+
"templateOSS": {
35+
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
36+
"version": "4.23.3",
37+
"publish": "true"
38+
},
39+
"tap": {
40+
"nyc-arg": [
41+
"--exclude",
42+
"tap-snapshots/**"
43+
]
44+
}
45+
}

0 commit comments

Comments
 (0)