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

openvex-js

v0.0.1

Published

TypeScript implementation of the OpenVEX specification

Readme

openvex-js

TypeScript implementation of the OpenVEX specification (v0.2.0) for creating, validating, and working with VEX (Vulnerability Exploitability eXchange) documents.

VEX documents communicate whether a software product is affected by a known vulnerability. This library provides a type-safe API for creating and consuming OpenVEX documents.

Installation

pnpm add openvex-js @js-temporal/polyfill zod

Both @js-temporal/polyfill and zod are required peer dependencies.

Quick Start

Create a VEX document

import { Document } from "openvex-js";

const doc = Document.create({
  author: "Security Team",
  statements: [
    {
      vulnerability: "CVE-2024-1234",
      status: "fixed",
      products: ["pkg:npm/[email protected]"],
    },
  ],
});

// Get plain data object
const data = doc.toJSON();

// Get JSON string
const json = doc.serialize();

Parse and validate

import { Document } from "openvex-js";

// Parse from object
const doc = Document.parse(unknownInput);

// Parse from JSON string
const doc2 = Document.fromJSON('{"@context": "https://openvex.dev/ns/v0.2.0", ...}');

// Validate without throwing (returns issues array, empty = valid)
const issues = Document.validate(unknownInput);

Add statements to an existing document

const updated = doc.addStatement({
  vulnerability: "CVE-2024-5678",
  status: "not_affected",
  products: ["pkg:npm/[email protected]"],
  justification: "vulnerable_code_not_present",
});
// Returns a new immutable Document with incremented version

Merge documents

const merged = Document.merge([doc1, doc2], {
  author: "Security Team",
});

Query statements

const allStatements = doc.getStatements();
const fixed = doc.getStatementsByStatus("fixed");
const byCve = doc.getStatementsByVulnerability("CVE-2024-1234");
const byProduct = doc.getStatementsByProduct("pkg:npm/[email protected]");

Rich vulnerability input

const doc = Document.create({
  author: "Security Team",
  statements: [
    {
      vulnerability: {
        name: "CVE-2024-1234",
        description: "Buffer overflow in parser",
        aliases: ["GHSA-xxxx-yyyy"],
      },
      status: "affected",
      products: ["pkg:npm/[email protected]"],
      actionStatement: "Upgrade to version 2.0.0",
    },
  ],
});

API Overview

Classes

  • Document — Top-level VEX document. Use Document.create() to build, Document.parse() to validate unknown input.
  • Statement — Individual vulnerability statement with status-specific validation.
  • Component — Product/subcomponent from purl, CPE, or object input.
  • Vulnerability — Vulnerability with name, description, and aliases.

Serialization

  • toJSON() — Returns a plain data object (works with JSON.stringify)
  • serialize() — Returns a formatted JSON string (Document only)

Exported Types

  • OpenVexDocumentData, StatementData, ComponentData, VulnerabilityData, SubcomponentData — Plain data types inferred from Zod schemas
  • CreateDocumentOptions, CreateStatementOptions, CreateVulnerabilityOptions — Options for builder methods
  • StatementStatus, Justification, Hashes, HashAlgorithm, Identifiers — Schema enum/utility types

Zod Schemas

For advanced use cases, Zod schemas can be imported directly from the schemas module:

import { openVexDocumentSchema, statementSchema } from "openvex-js/schemas";

Development

Prerequisites

  • Node.js >= 23.6.0 (for development — enables TypeScript type stripping without flags)
  • pnpm

Setup

pnpm install
pnpm install-vexctl

Scripts

pnpm test              # Run all tests
pnpm test:watch    # Watch mode
pnpm test:coverage # With coverage
pnpm typecheck     # TypeScript type checking
pnpm biome         # Lint/format check
pnpm biome:fix     # Auto-fix lint/format issues
pnpm build         # Build ESM to dist/

Integration Tests

The test suite compares library output against the reference vexctl CLI. Run pnpm install-vexctl to download the binary (stored in .bin/, gitignored).

License

MIT