You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This test project verifies that modules and also nested modules are resolved correctly. It also considers the following common cases:
4
+
- A package is installed in multiple different versions with the same name
5
+
- A side-effect free package is imported but not used (tree-shaking)
6
+
- A package with side-effects is imported as a transitive dependency (impure)
7
+
8
+
### Development
9
+
10
+
The modules from `fake-tree` are automatically moved to the `node_modules` on postinstall. If you're developing and changing the modules, you can sync them with `pnpm postinstall`.
11
+
12
+
```sh
13
+
pnpm postinstall
14
+
pnpm build
15
+
```
16
+
17
+
### Module-/Import Tree
18
+
19
+
App depends on:
20
+
- A@v1
21
+
- B@v1
22
+
23
+
A@v1 depends on:
24
+
- C@v1
25
+
- unused@v1 (not used).
26
+
27
+
B@v1 depends on:
28
+
- A@v2
29
+
- side-effect@v1 (no exports, not tree-shakeable)
30
+
31
+
```mermaid
32
+
flowchart LR
33
+
App
34
+
App -- Imports --> a1
35
+
App -- Imports --> b1
36
+
a1 -- Imports --> c1
37
+
a1 -- Imports --> unused
38
+
b1 -- Imports --> a2
39
+
b1 -- Imports --> side-effect
40
+
```
41
+
42
+
### Expected SBOM result
43
+
44
+
#### Components
45
+
46
+
```json
47
+
[
48
+
{
49
+
"type": "library",
50
+
"name": "a",
51
+
"version": "1.0.0",
52
+
"bom-ref": "pkg:npm/a@1.0.0",
53
+
"purl": "pkg:npm/a@1.0.0"
54
+
},
55
+
{
56
+
"type": "library",
57
+
"name": "c",
58
+
"version": "1.0.0",
59
+
"bom-ref": "pkg:npm/c@1.0.0",
60
+
"purl": "pkg:npm/c@1.0.0"
61
+
},
62
+
{
63
+
"type": "library",
64
+
"name": "side-effect",
65
+
"version": "1.0.0",
66
+
"bom-ref": "pkg:npm/side-effect@1.0.0",
67
+
"purl": "pkg:npm/side-effect@1.0.0"
68
+
},
69
+
{
70
+
"type": "library",
71
+
"name": "b",
72
+
"version": "1.0.0",
73
+
"bom-ref": "pkg:npm/b@1.0.0",
74
+
"purl": "pkg:npm/b@1.0.0"
75
+
},
76
+
{
77
+
"type": "library",
78
+
"name": "a",
79
+
"version": "2.0.0",
80
+
"bom-ref": "pkg:npm/a@2.0.0",
81
+
"purl": "pkg:npm/a@2.0.0"
82
+
}
83
+
]
84
+
```
85
+
86
+
#### Dependencies
87
+
88
+
Acceptance Criteria for the generated SBOM
89
+
-`a` must be included in both version `1` and `2`
90
+
-`b` must include a reference to the package `a` in version `2` (transitive dependency)
91
+
-`unused` must not be part of the depencies at it was removed during tree-shaking (no [side-effects](https://rollupjs.org/configuration-options/#no-side-effects))
92
+
-`side-effect` must be included as the side-effect is not marked as [pure](https://rollupjs.org/configuration-options/#pure)
0 commit comments