Skip to content

Commit ba7a570

Browse files
committed
deps: @npmcli/[email protected]
1 parent 0cd2149 commit ba7a570

File tree

4 files changed

+51
-9
lines changed

4 files changed

+51
-9
lines changed

node_modules/@npmcli/query/lib/index.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,46 @@ const fixupOutdated = astNode => {
166166
}
167167
}
168168

169+
const fixupVuln = astNode => {
170+
const vulns = []
171+
if (astNode.nodes.length) {
172+
for (const selector of astNode.nodes) {
173+
const vuln = {}
174+
for (const node of selector.nodes) {
175+
if (node.type !== 'attribute') {
176+
throw Object.assign(
177+
new Error(':vuln pseudo-class only accepts attribute matchers or "cwe" tag'),
178+
{ code: 'EQUERYATTR' }
179+
)
180+
}
181+
if (!['severity', 'cwe'].includes(node._attribute)) {
182+
throw Object.assign(
183+
new Error(':vuln pseudo-class only matches "severity" and "cwe" attributes'),
184+
{ code: 'EQUERYATTR' }
185+
)
186+
}
187+
if (!node.operator) {
188+
node.operator = '='
189+
node.value = '*'
190+
}
191+
if (node.operator !== '=') {
192+
throw Object.assign(
193+
new Error(':vuln pseudo-class attribute selector only accepts "=" operator', node),
194+
{ code: 'EQUERYATTR' }
195+
)
196+
}
197+
if (!vuln[node._attribute]) {
198+
vuln[node._attribute] = []
199+
}
200+
vuln[node._attribute].push(node._value)
201+
}
202+
vulns.push(vuln)
203+
}
204+
astNode.vulns = vulns
205+
astNode.nodes.length = 0
206+
}
207+
}
208+
169209
// a few of the supported ast nodes need to be tweaked in order to properly be
170210
// interpreted as proper arborist query selectors, namely semver ranges from
171211
// both ids and :semver pseudo-class selectors need to be translated from what
@@ -192,6 +232,8 @@ const transformAst = selector => {
192232
return fixupTypes(nextAstNode)
193233
case ':outdated':
194234
return fixupOutdated(nextAstNode)
235+
case ':vuln':
236+
return fixupVuln(nextAstNode)
195237
}
196238
})
197239
}

node_modules/@npmcli/query/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "@npmcli/query",
3-
"version": "3.0.1",
3+
"version": "3.1.0",
44
"description": "npm query parser and tools",
55
"main": "lib/index.js",
66
"scripts": {
77
"test": "tap",
8-
"lint": "eslint \"**/*.js\"",
8+
"lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
99
"postlint": "template-oss-check",
1010
"template-oss-apply": "template-oss-apply --force",
1111
"lintfix": "npm run lint -- --fix",
@@ -39,12 +39,12 @@
3939
},
4040
"templateOSS": {
4141
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
42-
"version": "4.18.0",
42+
"version": "4.21.3",
4343
"publish": true
4444
},
4545
"devDependencies": {
4646
"@npmcli/eslint-config": "^4.0.0",
47-
"@npmcli/template-oss": "4.18.0",
47+
"@npmcli/template-oss": "4.21.3",
4848
"tap": "^16.2.0"
4949
},
5050
"dependencies": {

package-lock.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,9 +1893,9 @@
18931893
}
18941894
},
18951895
"node_modules/@npmcli/query": {
1896-
"version": "3.0.1",
1897-
"resolved": "https://registry.npmjs.org/@npmcli/query/-/query-3.0.1.tgz",
1898-
"integrity": "sha512-0jE8iHBogf/+bFDj+ju6/UMLbJ39c8h6nSe6qile+dB7PJ0iV3gNqcb2vtt6WWCBrxv9uAjzUT/8vroluulidA==",
1896+
"version": "3.1.0",
1897+
"resolved": "https://registry.npmjs.org/@npmcli/query/-/query-3.1.0.tgz",
1898+
"integrity": "sha512-C/iR0tk7KSKGldibYIB9x8GtO/0Bd0I2mhOaDb8ucQL/bQVTmGoeREaFj64Z5+iCBRf3dQfed0CjJL7I8iTkiQ==",
18991899
"dependencies": {
19001900
"postcss-selector-parser": "^6.0.10"
19011901
},
@@ -16035,7 +16035,7 @@
1603516035
"@npmcli/name-from-folder": "^2.0.0",
1603616036
"@npmcli/node-gyp": "^3.0.0",
1603716037
"@npmcli/package-json": "^5.0.0",
16038-
"@npmcli/query": "^3.0.1",
16038+
"@npmcli/query": "^3.1.0",
1603916039
"@npmcli/run-script": "^7.0.2",
1604016040
"bin-links": "^4.0.1",
1604116041
"cacache": "^18.0.0",

workspaces/arborist/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"@npmcli/name-from-folder": "^2.0.0",
1212
"@npmcli/node-gyp": "^3.0.0",
1313
"@npmcli/package-json": "^5.0.0",
14-
"@npmcli/query": "^3.0.1",
14+
"@npmcli/query": "^3.1.0",
1515
"@npmcli/run-script": "^7.0.2",
1616
"bin-links": "^4.0.1",
1717
"cacache": "^18.0.0",

0 commit comments

Comments
 (0)