Debian Codegraph @

workspaces/arborist/test/fixtures/testing-transitive-conflicted-peer/README.md

raw
1 # @isaacs/testing-transitive-conflicted-peer
2
3 This demonstrates a case where a transitive dependency of a project
4 has a peer dependency which can only be placed in the root, but conflicts
5 with the root's direct dependency.
6
7 ```
8 root -> (a, b@2)
9 a -> (c), PEER(b@1||2)
10 c -> PEER(b@1)
11 ```
12
13 The algorithm places `a` and `b@2` in the root, as it must.
14
15 When seeking a placement for `c`, it hits a `CONFLICT` with the peerDeps
16 `c->(b@1)` and `root->(b@2)`. Since that is not the deepestNestingTarget
17 for `c`, it places it under `a` as the target.
18
19 (NB: this is somewhat inefficient in this particular sort of situation, as
20 it can lead to unnecessary duplication, and there is no practical benefit
21 in this case to nesting `c` under `a`. But as a general heuristic, it
22 prevents most conflicts, and the work to determine that nesting is
23 effectively the same outcome as deduplicating can be expensive.)
24
25 Then, resolving the `c->(b@1)` peer dep, it cannot place `b` under `a`,
26 because `a` has a peerDep on `b`. So, the deepest nesting target for `b`
27 is under `root`.
28
29 However, there it hits a conflict, and checks to see if the `c` node (the
30 nearest non-peer dependency leading to the conflicted node) is one of our
31 project's direct dependencies. Since it is not, this is a warning, rather
32 than an error.