Documentation
¶
Overview ¶
Package depsource builds an sbom.Inventory from a project's dependency files. Lockfiles the resolver supports become a dependency graph (pkg/dependencies/resolve/lockfile), with dev members left out; manifests no lockfile covers are parsed flat (pkg/dependencies), as a list of declared packages with no edges. It is the dependency counterpart of scansource, and the only SBOM code that depends on the dependency parsers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Graph ¶
Graph projects a resolved graph into an inventory: one declared component per member of each root that is not dev, and one DependencyRoot per root. A node shared by several roots is one component carrying one evidence per root, "declared" where that root's manifest declares it and "transitive" where its lockfile pulls it in. Dev members never appear, and neither does an edge that touches one, so a root's edges only ever join components that are in the inventory. An unknown root is kept, with no members and no edges, so the output says the lockfile was there and could not be read.
func Inventory ¶
Inventory reads the dependency files of the project at root. Each supported lockfile is resolved into a graph and the graphs are merged; every root covers its manifest and its lockfile, so neither is parsed flat again. An unknown root covers them too: it says the lockfile was there and could not be read, and a flat parse would bring back the range entries and dev dependencies the graph exists to replace. Every other selected manifest is parsed flat.
failed is keyed by path and holds the lockfiles that could not be read and the manifests that could not be parsed. It is nil when nothing failed. Unknown roots are not failures: they are reported on the root itself.
func Manifests ¶
func Manifests(parsed *parsers.LocalDependencies, root string) sbom.Inventory
Manifests builds declared components from flat-parsed manifests, with no round trip to any service: each PURL is split into its base and version (the manifest's requirement when the PURL carries none), tagged declared, and given the manifest as evidence, relative to root in slash form so it matches a root's manifest path. Exact duplicates fold into one component with one evidence per manifest; distinct versions of a package are kept, including a declared range (package.json "^1.5.5") alongside its resolved pin (package-lock.json "1.14.3").
Types ¶
This section is empty.