Skip to content

Commit d221f72

Browse files
nlffritzy
authored andcommitted
feat(arborist): add :overridden pseudo selector
1 parent cd2b1e6 commit d221f72

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

workspaces/arborist/lib/query-selector-all.js

+4
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ class Results {
262262
!internalSelector.has(node))
263263
}
264264

265+
overriddenPseudo () {
266+
return this.initialItems.filter(node => node.overridden)
267+
}
268+
265269
pathPseudo () {
266270
return this.initialItems.filter(node => {
267271
if (!this.currentAstNode.pathValue) {

workspaces/arborist/test/query-selector-all.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ t.test('query-selector-all', async t => {
2828
│ └── [email protected] (production dep of bar)
2929
├─┬ [email protected] (dev dep of query-selector-all-tests)
3030
│ ├─┬ [email protected] (production dep of foo, deduped)
31-
│ │ └── [email protected] (peer dep of bar)
31+
│ │ └── [email protected] (overridden peer dep of bar)
3232
│ └── [email protected] (production dep of foo)
3333
├── [email protected] (dev dep of query-selector-all-tests)
3434
└─┬ [email protected] (dev dep of query-selector-all-tests)
@@ -98,7 +98,7 @@ t.test('query-selector-all', async t => {
9898
name: 'bar',
9999
version: '1.4.0',
100100
peerDependencies: {
101-
dasher: '2.0.0',
101+
dasher: '2.1.0',
102102
},
103103
}),
104104
},
@@ -203,6 +203,9 @@ t.test('query-selector-all', async t => {
203203
bar: '^2.0.0',
204204
ipsum: 'npm:[email protected]',
205205
},
206+
overrides: {
207+
dasher: '2.0.0',
208+
},
206209
devDependencies: {
207210
foo: '^2.0.0',
208211
moo: '^3.0.0',
@@ -368,6 +371,7 @@ t.test('query-selector-all', async t => {
368371
]],
369372
[':missing', ['missing-dep@^1.0.0']],
370373
[':private', ['[email protected]']],
374+
[':overridden', ['[email protected]']],
371375

372376
// :not pseudo
373377
[':not(#foo)', [

0 commit comments

Comments
 (0)