Skip to content

Commit 7214149

Browse files
committed
deps: update [email protected]
1 parent c4bed31 commit 7214149

File tree

18 files changed

+716
-38
lines changed

18 files changed

+716
-38
lines changed

node_modules/.gitignore

+8-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
/@npmcli/metavuln-calculator/node_modules/@npmcli/*
4040
!/@npmcli/metavuln-calculator/node_modules/@npmcli/fs
4141
!/@npmcli/metavuln-calculator/node_modules/cacache
42+
!/@npmcli/metavuln-calculator/node_modules/json-parse-even-better-errors
4243
!/@npmcli/metavuln-calculator/node_modules/unique-filename
4344
!/@npmcli/metavuln-calculator/node_modules/unique-slug
4445
!/@npmcli/name-from-folder
@@ -50,7 +51,6 @@
5051
/@npmcli/package-json/node_modules/@npmcli/*
5152
!/@npmcli/package-json/node_modules/@npmcli/git
5253
!/@npmcli/package-json/node_modules/isexe
53-
!/@npmcli/package-json/node_modules/json-parse-even-better-errors
5454
!/@npmcli/package-json/node_modules/normalize-package-data
5555
!/@npmcli/package-json/node_modules/npm-install-checks
5656
!/@npmcli/package-json/node_modules/npm-normalize-package-bin
@@ -246,9 +246,13 @@
246246
!/pacote/node_modules/@npmcli/run-script
247247
!/pacote/node_modules/cacache
248248
!/pacote/node_modules/hosted-git-info
249+
!/pacote/node_modules/json-parse-even-better-errors
249250
!/pacote/node_modules/unique-filename
250251
!/pacote/node_modules/unique-slug
251252
!/parse-conflict-json
253+
!/parse-conflict-json/node_modules/
254+
/parse-conflict-json/node_modules/*
255+
!/parse-conflict-json/node_modules/json-parse-even-better-errors
252256
!/path-key
253257
!/path-scurry
254258
!/postcss-selector-parser
@@ -266,6 +270,9 @@
266270
!/qrcode-terminal
267271
!/read-cmd-shim
268272
!/read-package-json-fast
273+
!/read-package-json-fast/node_modules/
274+
/read-package-json-fast/node_modules/*
275+
!/read-package-json-fast/node_modules/json-parse-even-better-errors
269276
!/read
270277
!/retry
271278
!/rimraf

node_modules/@npmcli/package-json/node_modules/json-parse-even-better-errors/package.json node_modules/@npmcli/metavuln-calculator/node_modules/json-parse-even-better-errors/package.json

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "json-parse-even-better-errors",
3-
"version": "4.0.0",
3+
"version": "3.0.2",
44
"description": "JSON.parse with context information on error",
55
"main": "lib/index.js",
66
"files": [
@@ -10,12 +10,11 @@
1010
"scripts": {
1111
"test": "tap",
1212
"snap": "tap",
13-
"lint": "npm run eslint",
13+
"lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
1414
"postlint": "template-oss-check",
1515
"template-oss-apply": "template-oss-apply --force",
16-
"lintfix": "npm run eslint -- --fix",
17-
"posttest": "npm run lint",
18-
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
16+
"lintfix": "npm run lint -- --fix",
17+
"posttest": "npm run lint"
1918
},
2019
"repository": {
2120
"type": "git",
@@ -28,8 +27,8 @@
2827
"author": "GitHub Inc.",
2928
"license": "MIT",
3029
"devDependencies": {
31-
"@npmcli/eslint-config": "^5.0.0",
32-
"@npmcli/template-oss": "4.23.3",
30+
"@npmcli/eslint-config": "^4.0.0",
31+
"@npmcli/template-oss": "4.22.0",
3332
"tap": "^16.3.0"
3433
},
3534
"tap": {
@@ -40,11 +39,11 @@
4039
]
4140
},
4241
"engines": {
43-
"node": "^18.17.0 || >=20.5.0"
42+
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
4443
},
4544
"templateOSS": {
4645
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
47-
"version": "4.23.3",
46+
"version": "4.22.0",
4847
"publish": true
4948
}
5049
}

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

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "json-parse-even-better-errors",
3-
"version": "3.0.2",
3+
"version": "4.0.0",
44
"description": "JSON.parse with context information on error",
55
"main": "lib/index.js",
66
"files": [
@@ -10,11 +10,12 @@
1010
"scripts": {
1111
"test": "tap",
1212
"snap": "tap",
13-
"lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
13+
"lint": "npm run eslint",
1414
"postlint": "template-oss-check",
1515
"template-oss-apply": "template-oss-apply --force",
16-
"lintfix": "npm run lint -- --fix",
17-
"posttest": "npm run lint"
16+
"lintfix": "npm run eslint -- --fix",
17+
"posttest": "npm run lint",
18+
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
1819
},
1920
"repository": {
2021
"type": "git",
@@ -27,8 +28,8 @@
2728
"author": "GitHub Inc.",
2829
"license": "MIT",
2930
"devDependencies": {
30-
"@npmcli/eslint-config": "^4.0.0",
31-
"@npmcli/template-oss": "4.22.0",
31+
"@npmcli/eslint-config": "^5.0.0",
32+
"@npmcli/template-oss": "4.23.3",
3233
"tap": "^16.3.0"
3334
},
3435
"tap": {
@@ -39,11 +40,11 @@
3940
]
4041
},
4142
"engines": {
42-
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
43+
"node": "^18.17.0 || >=20.5.0"
4344
},
4445
"templateOSS": {
4546
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
46-
"version": "4.22.0",
47+
"version": "4.23.3",
4748
"publish": true
4849
}
4950
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Copyright 2017 Kat Marchán
2+
Copyright npm, Inc.
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a
5+
copy of this software and associated documentation files (the "Software"),
6+
to deal in the Software without restriction, including without limitation
7+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
and/or sell copies of the Software, and to permit persons to whom the
9+
Software is furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in
12+
all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20+
DEALINGS IN THE SOFTWARE.
21+
22+
---
23+
24+
This library is a fork of 'better-json-errors' by Kat Marchán, extended and
25+
distributed under the terms of the MIT license above.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
'use strict'
2+
3+
const INDENT = Symbol.for('indent')
4+
const NEWLINE = Symbol.for('newline')
5+
6+
const DEFAULT_NEWLINE = '\n'
7+
const DEFAULT_INDENT = ' '
8+
const BOM = /^\uFEFF/
9+
10+
// only respect indentation if we got a line break, otherwise squash it
11+
// things other than objects and arrays aren't indented, so ignore those
12+
// Important: in both of these regexps, the $1 capture group is the newline
13+
// or undefined, and the $2 capture group is the indent, or undefined.
14+
const FORMAT = /^\s*[{[]((?:\r?\n)+)([\s\t]*)/
15+
const EMPTY = /^(?:\{\}|\[\])((?:\r?\n)+)?$/
16+
17+
// Node 20 puts single quotes around the token and a comma after it
18+
const UNEXPECTED_TOKEN = /^Unexpected token '?(.)'?(,)? /i
19+
20+
const hexify = (char) => {
21+
const h = char.charCodeAt(0).toString(16).toUpperCase()
22+
return `0x${h.length % 2 ? '0' : ''}${h}`
23+
}
24+
25+
// Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
26+
// because the buffer-to-string conversion in `fs.readFileSync()`
27+
// translates it to FEFF, the UTF-16 BOM.
28+
const stripBOM = (txt) => String(txt).replace(BOM, '')
29+
30+
const makeParsedError = (msg, parsing, position = 0) => ({
31+
message: `${msg} while parsing ${parsing}`,
32+
position,
33+
})
34+
35+
const parseError = (e, txt, context = 20) => {
36+
let msg = e.message
37+
38+
if (!txt) {
39+
return makeParsedError(msg, 'empty string')
40+
}
41+
42+
const badTokenMatch = msg.match(UNEXPECTED_TOKEN)
43+
const badIndexMatch = msg.match(/ position\s+(\d+)/i)
44+
45+
if (badTokenMatch) {
46+
msg = msg.replace(
47+
UNEXPECTED_TOKEN,
48+
`Unexpected token ${JSON.stringify(badTokenMatch[1])} (${hexify(badTokenMatch[1])})$2 `
49+
)
50+
}
51+
52+
let errIdx
53+
if (badIndexMatch) {
54+
errIdx = +badIndexMatch[1]
55+
} else /* istanbul ignore next - doesnt happen in Node 22 */ if (
56+
msg.match(/^Unexpected end of JSON.*/i)
57+
) {
58+
errIdx = txt.length - 1
59+
}
60+
61+
if (errIdx == null) {
62+
return makeParsedError(msg, `'${txt.slice(0, context * 2)}'`)
63+
}
64+
65+
const start = errIdx <= context ? 0 : errIdx - context
66+
const end = errIdx + context >= txt.length ? txt.length : errIdx + context
67+
const slice = `${start ? '...' : ''}${txt.slice(start, end)}${end === txt.length ? '' : '...'}`
68+
69+
return makeParsedError(
70+
msg,
71+
`${txt === slice ? '' : 'near '}${JSON.stringify(slice)}`,
72+
errIdx
73+
)
74+
}
75+
76+
class JSONParseError extends SyntaxError {
77+
constructor (er, txt, context, caller) {
78+
const metadata = parseError(er, txt, context)
79+
super(metadata.message)
80+
Object.assign(this, metadata)
81+
this.code = 'EJSONPARSE'
82+
this.systemError = er
83+
Error.captureStackTrace(this, caller || this.constructor)
84+
}
85+
86+
get name () {
87+
return this.constructor.name
88+
}
89+
90+
set name (n) {}
91+
92+
get [Symbol.toStringTag] () {
93+
return this.constructor.name
94+
}
95+
}
96+
97+
const parseJson = (txt, reviver) => {
98+
const result = JSON.parse(txt, reviver)
99+
if (result && typeof result === 'object') {
100+
// get the indentation so that we can save it back nicely
101+
// if the file starts with {" then we have an indent of '', ie, none
102+
// otherwise, pick the indentation of the next line after the first \n If the
103+
// pattern doesn't match, then it means no indentation. JSON.stringify ignores
104+
// symbols, so this is reasonably safe. if the string is '{}' or '[]', then
105+
// use the default 2-space indent.
106+
const match = txt.match(EMPTY) || txt.match(FORMAT) || [null, '', '']
107+
result[NEWLINE] = match[1] ?? DEFAULT_NEWLINE
108+
result[INDENT] = match[2] ?? DEFAULT_INDENT
109+
}
110+
return result
111+
}
112+
113+
const parseJsonError = (raw, reviver, context) => {
114+
const txt = stripBOM(raw)
115+
try {
116+
return parseJson(txt, reviver)
117+
} catch (e) {
118+
if (typeof raw !== 'string' && !Buffer.isBuffer(raw)) {
119+
const msg = Array.isArray(raw) && raw.length === 0 ? 'an empty array' : String(raw)
120+
throw Object.assign(
121+
new TypeError(`Cannot parse ${msg}`),
122+
{ code: 'EJSONPARSE', systemError: e }
123+
)
124+
}
125+
throw new JSONParseError(e, txt, context, parseJsonError)
126+
}
127+
}
128+
129+
module.exports = parseJsonError
130+
parseJsonError.JSONParseError = JSONParseError
131+
parseJsonError.noExceptions = (raw, reviver) => {
132+
try {
133+
return parseJson(stripBOM(raw), reviver)
134+
} catch {
135+
// no exceptions
136+
}
137+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"name": "json-parse-even-better-errors",
3+
"version": "3.0.2",
4+
"description": "JSON.parse with context information on error",
5+
"main": "lib/index.js",
6+
"files": [
7+
"bin/",
8+
"lib/"
9+
],
10+
"scripts": {
11+
"test": "tap",
12+
"snap": "tap",
13+
"lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
14+
"postlint": "template-oss-check",
15+
"template-oss-apply": "template-oss-apply --force",
16+
"lintfix": "npm run lint -- --fix",
17+
"posttest": "npm run lint"
18+
},
19+
"repository": {
20+
"type": "git",
21+
"url": "git+https://github.com/npm/json-parse-even-better-errors.git"
22+
},
23+
"keywords": [
24+
"JSON",
25+
"parser"
26+
],
27+
"author": "GitHub Inc.",
28+
"license": "MIT",
29+
"devDependencies": {
30+
"@npmcli/eslint-config": "^4.0.0",
31+
"@npmcli/template-oss": "4.22.0",
32+
"tap": "^16.3.0"
33+
},
34+
"tap": {
35+
"check-coverage": true,
36+
"nyc-arg": [
37+
"--exclude",
38+
"tap-snapshots/**"
39+
]
40+
},
41+
"engines": {
42+
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
43+
},
44+
"templateOSS": {
45+
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
46+
"version": "4.22.0",
47+
"publish": true
48+
}
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Copyright 2017 Kat Marchán
2+
Copyright npm, Inc.
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a
5+
copy of this software and associated documentation files (the "Software"),
6+
to deal in the Software without restriction, including without limitation
7+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
and/or sell copies of the Software, and to permit persons to whom the
9+
Software is furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in
12+
all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20+
DEALINGS IN THE SOFTWARE.
21+
22+
---
23+
24+
This library is a fork of 'better-json-errors' by Kat Marchán, extended and
25+
distributed under the terms of the MIT license above.

0 commit comments

Comments
 (0)