Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Karrys <luke@lukekarrys.com>2022-08-25 22:19:06 +0300
committerLuke Karrys <luke@lukekarrys.com>2022-08-26 01:02:40 +0300
commit26d2e551b250972caa550d56127810648a1663a1 (patch)
tree6baa3851620821242c846902fd38dc418ad0ab41
parenta79ee00b530b765ed219e81de77c37057c373adf (diff)
deps: @npmcli/query@1.2.0
-rw-r--r--node_modules/@npmcli/query/lib/index.js32
-rw-r--r--node_modules/@npmcli/query/package.json2
-rw-r--r--package-lock.json8
-rw-r--r--workspaces/arborist/package.json2
4 files changed, 37 insertions, 7 deletions
diff --git a/node_modules/@npmcli/query/lib/index.js b/node_modules/@npmcli/query/lib/index.js
index 36a8c700c..44f539ee0 100644
--- a/node_modules/@npmcli/query/lib/index.js
+++ b/node_modules/@npmcli/query/lib/index.js
@@ -118,10 +118,40 @@ const fixupNestedPseudo = astNode => {
transformAst(newRootNode)
}
+// :semver(<version|range>, [selector], [function])
const fixupSemverSpecs = astNode => {
- const children = astNode.nodes[0].nodes
+ // the first child node contains the version or range, most likely as a tag and a series of
+ // classes. we combine them into a single string here. this is the only required input.
+ const children = astNode.nodes.shift().nodes
const value = children.reduce((res, i) => `${res}${String(i)}`, '')
+ // next, if we have 2 nodes left then the user called us with a total of 3. that means the
+ // last one tells us what specific semver function the user is requesting, so we pull that out
+ let semverFunc
+ if (astNode.nodes.length === 2) {
+ const funcNode = astNode.nodes.pop().nodes[0]
+ if (funcNode.type === 'tag') {
+ semverFunc = funcNode.value
+ }
+ }
+
+ // now if there's a node left, that node is our selector. since that is the last remaining
+ // child node, we call fixupAttr on ourselves so that the attribute selectors get parsed
+ if (astNode.nodes.length === 1) {
+ fixupAttr(astNode)
+ } else {
+ // we weren't provided a selector, so we default to `[version]`. note, there's no default
+ // operator here. that's because we don't know yet if the user has provided us a version
+ // or range to assert against
+ astNode.attributeMatcher = {
+ insensitive: false,
+ attribute: 'version',
+ qualifiedAttribute: 'version',
+ }
+ astNode.lookupProperties = []
+ }
+
+ astNode.semverFunc = semverFunc
astNode.semverValue = value
astNode.nodes.length = 0
}
diff --git a/node_modules/@npmcli/query/package.json b/node_modules/@npmcli/query/package.json
index 0c9247e0b..610d0b718 100644
--- a/node_modules/@npmcli/query/package.json
+++ b/node_modules/@npmcli/query/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/query",
- "version": "1.1.1",
+ "version": "1.2.0",
"description": "npm query parser and tools",
"main": "lib/index.js",
"scripts": {
diff --git a/package-lock.json b/package-lock.json
index cb98120ca..73e6f86df 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1057,9 +1057,9 @@
}
},
"node_modules/@npmcli/query": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/@npmcli/query/-/query-1.1.1.tgz",
- "integrity": "sha512-UF3I0fD94wzQ84vojMO2jDB8ibjRSTqhi8oz2mzVKiJ9gZHbeGlu9kzPvgHuGDK0Hf2cARhWtTfCDHNEwlL9hg==",
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@npmcli/query/-/query-1.2.0.tgz",
+ "integrity": "sha512-uWglsUM3PjBLgTSmZ3/vygeGdvWEIZ3wTUnzGFbprC/RtvQSaT+GAXu1DXmSFj2bD3oOZdcRm1xdzsV2z1YWdw==",
"dependencies": {
"npm-package-arg": "^9.1.0",
"postcss-selector-parser": "^6.0.10",
@@ -10499,7 +10499,7 @@
"@npmcli/name-from-folder": "^1.0.1",
"@npmcli/node-gyp": "^2.0.0",
"@npmcli/package-json": "^2.0.0",
- "@npmcli/query": "^1.1.1",
+ "@npmcli/query": "^1.2.0",
"@npmcli/run-script": "^4.1.3",
"bin-links": "^3.0.0",
"cacache": "^16.1.3",
diff --git a/workspaces/arborist/package.json b/workspaces/arborist/package.json
index a7a6b6e9b..77a7c71b9 100644
--- a/workspaces/arborist/package.json
+++ b/workspaces/arborist/package.json
@@ -11,7 +11,7 @@
"@npmcli/name-from-folder": "^1.0.1",
"@npmcli/node-gyp": "^2.0.0",
"@npmcli/package-json": "^2.0.0",
- "@npmcli/query": "^1.1.1",
+ "@npmcli/query": "^1.2.0",
"@npmcli/run-script": "^4.1.3",
"bin-links": "^3.0.0",
"cacache": "^16.1.3",