
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@cyclonedx/cyclonedx-library
Advanced tools
Core functionality of CycloneDX for JavaScript (Node.js or WebBrowser).
Core functionality of CycloneDX for JavaScript (Node.js or WebBrowsers), written in TypeScript and compiled for the target.
[!NOTE]
This package is a software library not intended for standalone use.
For a list of tools and plugins for generating Software Bill of Materials (SBOM), check out the meta-package.
AttachmentEncodingComponentScopeComponentTypeExternalReferenceTypeHashAlgorithmVulnerability related:
AffectStatusAnalysisJustificationAnalysisResponseAnalysisStateRatingMethodSeverityAttachmentBomBomLink, BomLinkDocument, BomLinkElementBomRef, BomRefRepositoryComponent, ComponentRepository, ComponentEvidenceExternalReference, ExternalReferenceRepositoryHash, HashContent, HashDictionaryLicenseExpression, NamedLicense, SpdxLicense, LicenseRepositoryMetadataOrganizationalContact, OrganizationalContactRepositoryOrganizationalEntity, OrganizationalEntityRepositoryProperty, PropertyRepositorySWIDTool, ToolRepository, ToolsVulnerability related:
Advisory, AdvisoryRepositoryAffect, AffectRepository, AffectedSingleVersion, AffectedVersionRange, AffectedVersionRepositoryAnalysisCreditsRating, RatingRepositoryReference, ReferenceRepositorySourceVulnerability, VulnerabilityRepositoryBom.serialNumberTool or Component from PackageJson-like data structures1.71.61.51.41.31.2Bom data models to JSON stringBom data models to XML string:
This package and the build results are available for npm, pnpm and yarn:
npm i -S @cyclonedx/cyclonedx-library
pnpm add @cyclonedx/cyclonedx-library
yarn add @cyclonedx/cyclonedx-library
You can install the package from source, which will build automatically on installation:
npm i -S github:CycloneDX/cyclonedx-javascript-library
pnpm add github:CycloneDX/cyclonedx-javascript-library
yarn add @cyclonedx/cyclonedx-library@github:CycloneDX/cyclonedx-javascript-library # only with yarn-2
Some features require optional peer dependencies — see package.json for version details.
In addition, we have some suggestions for related 3rd-party standards:
packageurl-js
for crafting and parsing PackageURLs.spdx-expression-parse
for validating SPDX License Expressions.See extended examples.
const CDX = require('@cyclonedx/cyclonedx-library')
const bom = new CDX.Models.Bom()
bom.metadata.component = new CDX.Models.Component(
CDX.Enums.ComponentType.Application,
'MyProject'
)
const componentA = new CDX.Models.Component(
CDX.Enums.ComponentType.Library,
'myComponentA',
)
bom.components.add(componentA)
bom.metadata.component.dependencies.add(componentA.bomRef)
To ensure optimal tree‑shaking when bundling, import only the symbols you actually need from the library’s published entry points. You can find all available entry points in the exports field of the package’s package.json.
const { Bom, Component } = require('@cyclonedx/cyclonedx-library/Models')
const { ComponentType } = require('@cyclonedx/cyclonedx-library/Enums')
const bom = new Bom()
bom.metadata.component = new Component(
ComponentType.Application,
'MyProject'
)
const componentA = new Component(
ComponentType.Library,
'myComponentA',
)
bom.components.add(componentA)
bom.metadata.component.dependencies.add(componentA.bomRef)
<script src="path-to-this-package/dist.web/lib.js"></script>
<script type="application/javascript">
const CDX = CycloneDX_library
let bom = new CDX.Models.Bom()
bom.metadata.component = new CDX.Models.Component(
CDX.Enums.ComponentType.Application,
'MyProject'
)
const componentA = new CDX.Models.Component(
CDX.Enums.ComponentType.Library,
'myComponentA',
)
bom.components.add(componentA)
bom.metadata.component.dependencies.add(componentA.bomRef)
</script>
We ship annotated type definitions, so that your IDE and tools may pick up the documentation when you use this library downstream.
There are also pre-rendered documentations hosted on readthedocs.
Feel free to open issues, bug reports or pull requests.
See the CONTRIBUTING file for details.
Permission to modify and redistribute is granted under the terms of the Apache 2.0 license.
See the LICENSE file for the full license.
FAQs
Core functionality of CycloneDX for JavaScript (Node.js or WebBrowser).
The npm package @cyclonedx/cyclonedx-library receives a total of 294,425 weekly downloads. As such, @cyclonedx/cyclonedx-library popularity was classified as popular.
We found that @cyclonedx/cyclonedx-library demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.