Skip to content

Commit 7497274

Browse files
committed
deps: @npmcli/[email protected]
1 parent c383564 commit 7497274

File tree

4 files changed

+37
-7
lines changed

4 files changed

+37
-7
lines changed

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

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,40 @@ const fixupNestedPseudo = astNode => {
118118
transformAst(newRootNode)
119119
}
120120

121+
// :semver(<version|range>, [selector], [function])
121122
const fixupSemverSpecs = astNode => {
122-
const children = astNode.nodes[0].nodes
123+
// the first child node contains the version or range, most likely as a tag and a series of
124+
// classes. we combine them into a single string here. this is the only required input.
125+
const children = astNode.nodes.shift().nodes
123126
const value = children.reduce((res, i) => `${res}${String(i)}`, '')
124127

128+
// next, if we have 2 nodes left then the user called us with a total of 3. that means the
129+
// last one tells us what specific semver function the user is requesting, so we pull that out
130+
let semverFunc
131+
if (astNode.nodes.length === 2) {
132+
const funcNode = astNode.nodes.pop().nodes[0]
133+
if (funcNode.type === 'tag') {
134+
semverFunc = funcNode.value
135+
}
136+
}
137+
138+
// now if there's a node left, that node is our selector. since that is the last remaining
139+
// child node, we call fixupAttr on ourselves so that the attribute selectors get parsed
140+
if (astNode.nodes.length === 1) {
141+
fixupAttr(astNode)
142+
} else {
143+
// we weren't provided a selector, so we default to `[version]`. note, there's no default
144+
// operator here. that's because we don't know yet if the user has provided us a version
145+
// or range to assert against
146+
astNode.attributeMatcher = {
147+
insensitive: false,
148+
attribute: 'version',
149+
qualifiedAttribute: 'version',
150+
}
151+
astNode.lookupProperties = []
152+
}
153+
154+
astNode.semverFunc = semverFunc
125155
astNode.semverValue = value
126156
astNode.nodes.length = 0
127157
}

node_modules/@npmcli/query/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@npmcli/query",
3-
"version": "1.1.1",
3+
"version": "1.2.0",
44
"description": "npm query parser and tools",
55
"main": "lib/index.js",
66
"scripts": {

package-lock.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,9 +1044,9 @@
10441044
}
10451045
},
10461046
"node_modules/@npmcli/query": {
1047-
"version": "1.1.1",
1048-
"resolved": "https://registry.npmjs.org/@npmcli/query/-/query-1.1.1.tgz",
1049-
"integrity": "sha512-UF3I0fD94wzQ84vojMO2jDB8ibjRSTqhi8oz2mzVKiJ9gZHbeGlu9kzPvgHuGDK0Hf2cARhWtTfCDHNEwlL9hg==",
1047+
"version": "1.2.0",
1048+
"resolved": "https://registry.npmjs.org/@npmcli/query/-/query-1.2.0.tgz",
1049+
"integrity": "sha512-uWglsUM3PjBLgTSmZ3/vygeGdvWEIZ3wTUnzGFbprC/RtvQSaT+GAXu1DXmSFj2bD3oOZdcRm1xdzsV2z1YWdw==",
10501050
"dependencies": {
10511051
"npm-package-arg": "^9.1.0",
10521052
"postcss-selector-parser": "^6.0.10",
@@ -10064,7 +10064,7 @@
1006410064
"@npmcli/name-from-folder": "^1.0.1",
1006510065
"@npmcli/node-gyp": "^2.0.0",
1006610066
"@npmcli/package-json": "^2.0.0",
10067-
"@npmcli/query": "^1.1.1",
10067+
"@npmcli/query": "^1.2.0",
1006810068
"@npmcli/run-script": "^4.1.3",
1006910069
"bin-links": "^3.0.0",
1007010070
"cacache": "^16.0.6",

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": "^1.0.1",
1212
"@npmcli/node-gyp": "^2.0.0",
1313
"@npmcli/package-json": "^2.0.0",
14-
"@npmcli/query": "^1.1.1",
14+
"@npmcli/query": "^1.2.0",
1515
"@npmcli/run-script": "^4.1.3",
1616
"bin-links": "^3.0.0",
1717
"cacache": "^16.0.6",

0 commit comments

Comments
 (0)