Skip to content

Commit 26d2e55

Browse files
committed
deps: @npmcli/[email protected]
1 parent a79ee00 commit 26d2e55

File tree

4 files changed

+37
-7
lines changed

4 files changed

+37
-7
lines changed

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

+31-1
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

+1-1
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

+4-4
Original file line numberDiff line numberDiff line change
@@ -1057,9 +1057,9 @@
10571057
}
10581058
},
10591059
"node_modules/@npmcli/query": {
1060-
"version": "1.1.1",
1061-
"resolved": "https://registry.npmjs.org/@npmcli/query/-/query-1.1.1.tgz",
1062-
"integrity": "sha512-UF3I0fD94wzQ84vojMO2jDB8ibjRSTqhi8oz2mzVKiJ9gZHbeGlu9kzPvgHuGDK0Hf2cARhWtTfCDHNEwlL9hg==",
1060+
"version": "1.2.0",
1061+
"resolved": "https://registry.npmjs.org/@npmcli/query/-/query-1.2.0.tgz",
1062+
"integrity": "sha512-uWglsUM3PjBLgTSmZ3/vygeGdvWEIZ3wTUnzGFbprC/RtvQSaT+GAXu1DXmSFj2bD3oOZdcRm1xdzsV2z1YWdw==",
10631063
"dependencies": {
10641064
"npm-package-arg": "^9.1.0",
10651065
"postcss-selector-parser": "^6.0.10",
@@ -10499,7 +10499,7 @@
1049910499
"@npmcli/name-from-folder": "^1.0.1",
1050010500
"@npmcli/node-gyp": "^2.0.0",
1050110501
"@npmcli/package-json": "^2.0.0",
10502-
"@npmcli/query": "^1.1.1",
10502+
"@npmcli/query": "^1.2.0",
1050310503
"@npmcli/run-script": "^4.1.3",
1050410504
"bin-links": "^3.0.0",
1050510505
"cacache": "^16.1.3",

workspaces/arborist/package.json

+1-1
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.1.3",

0 commit comments

Comments
 (0)