npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rollup-plugin-sbom

v3.0.1

Published

A rollup and vite plugin to generate SBOMs for your application

Readme

CI CodeQL npm npm peer dependency version (scoped) img npm type definitions OpenSSF Scorecard OpenSSF Best Practices NPM Downloads

rollup-plugin-sbom

Create SBOMs (Software Bill of Materials) in CycloneDX format for your Vite and Rollup projects, including only the software you're really shipping to production.

A “software bill of materials” (SBOM) has emerged as a key building block in software security and software supply chain risk management. A SBOM is a nested inventory, a list of ingredients that make up software components.

CISA (.gov) [full article]

Documentation


Requirements and Compatibility

| Plugin | Vite | Rollup | Node | CDX Spec | | ------ | ---------- | ------ | ---------- | -------- | | v1 | v4, v5 | v3, v4 | 18, 20 | 1.5 | | v2 | v4, v5, v6 | v3, v4 | 18, 20, 22 | 1.6 | | v3 | v5, v6, v7 | v4 | 20, 22, 24 | 1.6 |

We're always supporting LTS Node.js versions and versions which still have security support. Plugin support will be dropped once a Node.js version reaches its final EOL.

Installation

You can install the plugin via NPM with your favorite package manager:

npm install --save-dev rollup-plugin-sbom
pnpm install -D rollup-plugin-sbom
yarn add --dev rollup-plugin-sbom

Usage

Usage with Vite

import { defineConfig } from "vite";
import sbom from "rollup-plugin-sbom";

export default defineConfig({
  plugins: [sbom()],
});

// or

export default defineConfig({
  build: {
    rollupOptions: {
      plugins: [rollupPluginSbom],
    },
  },
});

Usage with Rollup

import sbom from "rollup-plugin-sbom";

export default {
  plugins: [sbom()],
};

Configuration Options

| Name | Default | Description | | ------------------- | ------------- | ------------------------------------------------------------------------------------------- | | specVersion | 1.6 | The CycloneDX specification version to use | | rootComponentType | application | The root component type, can be library or application | | outDir | cyclonedx | The output directory where the BOM file will be saved. | | outFilename | bom | The base filename for the SBOM files. | | outFormats | ['json'] | The formats to output. Can be any of json and xml (note: xml requires xmlbuilder2). | | saveTimestamp | true | Whether to save the timestamp in the BOM metadata. | | autodetect | true | Whether to get the root package registered automatically. | | generateSerial | false | Whether to generate a serial number for the BOM. | | includeWellKnown | true | Whether to generate a SBOM in the well-known directory. | | supplier | - | Provide organizational entity information | | beforeCollect | - | Enhance the BOM before before collecting dependencies | | afterCollect | - | Transform the BOM before after collecting dependencies |

Optional Peer Dependencies

Some features require optional peer dependencies — see package.json for version details.

  • Serialization to XML on Node.js requires any of:
    • xmlbuilder2

Debugging

This plugin added debug logs to gather information about how your SBOM is built so you can understand why which dependency was added to the graph. To enable debugging, you can set the logLevel option to "debug".

// rollup
export default {
  logLevel: "debug",
};

// vite
export default defineConfig({
  build: {
    rollupOptions: {
      logLevel: "debug",
    },
  },
});

General advice on when and how to read the debug information:

  • Find out which tools are registered (Registering tool <name>)
  • Find out which generated bundles are analyzed (Processing generated module <filename>)
  • Check analyzed third party modules and their tree (Processing <vendor-module> (imported by <filename> - depends on <transitive-deps>))
[plugin rollup-plugin-sbom] Autodetection enabled, trying to resolve root component
[plugin rollup-plugin-sbom] Saving timestamp to SBOM
[plugin rollup-plugin-sbom] Generating serial number for SBOM
[plugin rollup-plugin-sbom] Registering tool rollup-plugin-sbom
[plugin rollup-plugin-sbom] Registering tool vite
[plugin rollup-plugin-sbom] Registering tool rollup
[plugin rollup-plugin-sbom] Processing generated module "index.js"
[plugin rollup-plugin-sbom] Found 4 external modules within "index.js"
[plugin rollup-plugin-sbom] Found 3 unique external modules accross all bundles
[plugin rollup-plugin-sbom] Processing a (imported by /rollup-plugin-sbom/test/fixtures/resolution/node_modules/a/index.js - depends on c)
[plugin rollup-plugin-sbom] Attaching nested dependency "c" to parent component a
[plugin rollup-plugin-sbom] Processing c (imported by /rollup-plugin-sbom/test/fixtures/resolution/node_modules/a/node_modules/c/index.js - depends on none)
[plugin rollup-plugin-sbom] Processing side-effect (imported by /rollup-plugin-sbom/test/fixtures/resolution/node_modules/b/node_modules/side-effect/index.js - depends on none)
[plugin rollup-plugin-sbom] Processing b (imported by /rollup-plugin-sbom/test/fixtures/resolution/node_modules/b/index.js - depends on a, side-effect)
[plugin rollup-plugin-sbom] Attaching nested dependency "a" to parent component b
[plugin rollup-plugin-sbom] Processing a (imported by /rollup-plugin-sbom/test/fixtures/resolution/node_modules/b/node_modules/a/index.js - depends on none)
[plugin rollup-plugin-sbom] Attaching nested dependency "side-effect" to parent component b
[plugin rollup-plugin-sbom] Emitting SBOM asset to plugin-outdir/filename.json
[plugin rollup-plugin-sbom] Emitting SBOM asset to plugin-outdir/filename.xml
[plugin rollup-plugin-sbom] Emitting well-known file to .well-known/sbom

Sequence chart

sequenceDiagram
  participant Bundler
  box Hook Phases
    participant SB as Start Build
    participant MP as Module Parsed
    participant GB as Generate Bundle
    participant EF as Emit Files
  end
  box Plugin
    participant AN as Analyzer
    participant PR as Package Registry
  end
  activate Bundler
  activate SB
    Bundler->>SB: Register Root Component
    Bundler->>SB: Register Tools
  deactivate SB
  Bundler-->>MP: Invoke for each module
  activate MP
    MP-->>PR: Find and load package.json
  deactivate MP
  activate GB
    Bundler->>GB: Invoke with generated chunks
    AN->>AN: Build tree (recursive)
    GB->>AN: Analyze generated chunk
    AN->>GB: Send module tree
    GB->>PR: Request package.json for module
    PR->>GB: Return normalized package
    GB->>EF: Emit SBOM files
    GB->>EF: Emit Well Known
  deactivate GB
  EF->>Bundler: Finish build
  deactivate Bundler

Contributing

The main purpose of this repository is to continue evolving the plugin, making it faster and easier to use. We are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving the plugin.

Workflow

  1. Fork the repository to your personal account
  2. Ensure that all tests succeed (pnpm build-fixtures & pnpm test)
  3. Propose changes within a PR to the original repository and write down the information required by the pull request template
  4. Wait for an approval for running the required workflow checks and a code-review from one of the maintainers

Good First Issues

We have a list of good first issues that contain bugs that have a relatively limited scope. This is a great place to get started.

Contributors

Thanks goes to these wonderful people (emoji key):

License

The plugin is licensed under MIT License