NPM.SBOM (NPM v0.6.0)

Copy Markdown View Source

Software Bill of Materials (SBOM) generation.

Generates CycloneDX-compatible SBOM data from the lockfile, listing all dependencies with versions, licenses, and integrity hashes.

Summary

Functions

Returns the count of components in the SBOM.

Filters SBOM components by a predicate.

Generates a minimal SBOM from lockfile only (no filesystem access).

Generates an SBOM from the lockfile and node_modules.

Generates a Package URL (purl) for an npm package.

Functions

component_count(arg1)

@spec component_count(map()) :: non_neg_integer()

Returns the count of components in the SBOM.

filter(sbom, fun)

@spec filter(map(), (map() -> boolean())) :: map()

Filters SBOM components by a predicate.

from_lockfile(lockfile)

@spec from_lockfile(map()) :: map()

Generates a minimal SBOM from lockfile only (no filesystem access).

generate(lockfile, node_modules_dir \\ "node_modules")

@spec generate(map(), String.t()) :: map()

Generates an SBOM from the lockfile and node_modules.

purl(name, version)

@spec purl(String.t(), String.t()) :: String.t()

Generates a Package URL (purl) for an npm package.