Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat(query): support :overridden pseudo selector
  • Loading branch information
nlf authored and fritzy committed Aug 17, 2022
1 parent d221f72 commit 0d4ed0f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/content/using-npm/dependency-selectors.md
Expand Up @@ -54,7 +54,7 @@ The [`npm query`](/commands/npm-query) commmand exposes a new dependency selecto
- [`:private`](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#private) when a dependency is private
- `:link` when a dependency is linked (for instance, workspaces or packages manually [`linked`](https://docs.npmjs.com/cli/v8/commands/npm-link)
- `:deduped` when a dependency has been deduped (note that this does *not* always mean the dependency has been hoisted to the root of node_modules)
- `:override` when a dependency is an override (not implemented yet)
- `:overridden` when a dependency has been overridden
- `:extraneous` when a dependency exists but is not defined as a dependency of any node
- `:invalid` when a dependency version is out of its ancestors specified range
- `:missing` when a dependency is not found on disk
Expand Down
1 change: 1 addition & 0 deletions lib/commands/query.js
Expand Up @@ -20,6 +20,7 @@ class QuerySelectorItem {
this.dev = node.target.dev
this.inBundle = node.target.inBundle
this.deduped = this.from.length > 1
this.overridden = node.overridden
for (const edge of node.target.edgesIn) {
this.from.push(edge.from.location)
}
Expand Down
33 changes: 22 additions & 11 deletions tap-snapshots/test/lib/commands/query.js.test.cjs
Expand Up @@ -22,7 +22,8 @@ exports[`test/lib/commands/query.js TAP global > should return global package 1`
"to": [],
"dev": false,
"inBundle": false,
"deduped": false
"deduped": false,
"overridden": false
}
]
`
Expand Down Expand Up @@ -51,7 +52,8 @@ exports[`test/lib/commands/query.js TAP include-workspace-root > should return w
],
"dev": false,
"inBundle": false,
"deduped": false
"deduped": false,
"overridden": false
},
{
"name": "c",
Expand All @@ -66,7 +68,8 @@ exports[`test/lib/commands/query.js TAP include-workspace-root > should return w
"to": [],
"dev": false,
"inBundle": false,
"deduped": false
"deduped": false,
"overridden": false
}
]
`
Expand All @@ -86,7 +89,8 @@ exports[`test/lib/commands/query.js TAP linked node > should return linked node
"to": [],
"dev": false,
"inBundle": false,
"deduped": false
"deduped": false,
"overridden": false
}
]
`
Expand All @@ -111,7 +115,8 @@ exports[`test/lib/commands/query.js TAP recursive tree > should return everythin
],
"dev": false,
"inBundle": false,
"deduped": false
"deduped": false,
"overridden": false
},
{
"pkgid": "a@",
Expand All @@ -125,7 +130,8 @@ exports[`test/lib/commands/query.js TAP recursive tree > should return everythin
"to": [],
"dev": false,
"inBundle": false,
"deduped": false
"deduped": false,
"overridden": false
},
{
"pkgid": "b@",
Expand All @@ -139,7 +145,8 @@ exports[`test/lib/commands/query.js TAP recursive tree > should return everythin
"to": [],
"dev": false,
"inBundle": false,
"deduped": false
"deduped": false,
"overridden": false
}
]
`
Expand Down Expand Up @@ -167,7 +174,8 @@ exports[`test/lib/commands/query.js TAP simple query > should return root object
],
"dev": false,
"inBundle": false,
"deduped": false
"deduped": false,
"overridden": false
},
{
"pkgid": "a@",
Expand All @@ -181,7 +189,8 @@ exports[`test/lib/commands/query.js TAP simple query > should return root object
"to": [],
"dev": false,
"inBundle": false,
"deduped": false
"deduped": false,
"overridden": false
},
{
"pkgid": "b@",
Expand All @@ -195,7 +204,8 @@ exports[`test/lib/commands/query.js TAP simple query > should return root object
"to": [],
"dev": false,
"inBundle": false,
"deduped": false
"deduped": false,
"overridden": false
}
]
`
Expand All @@ -215,7 +225,8 @@ exports[`test/lib/commands/query.js TAP workspace query > should return workspac
"to": [],
"dev": false,
"inBundle": false,
"deduped": false
"deduped": false,
"overridden": false
}
]
`

0 comments on commit 0d4ed0f

Please sign in to comment.