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

audit-types

v0.7.0

Published

Type definitions for package manager json audit responses

Readme

audit-types

Dependency-free TypeScript declarations for package-manager audit JSON. This package describes wire formats; it does not parse or validate JSON at runtime.

| Command | Namespace | Output | | ------------------------------- | --------------------------- | ----------------------------------------------------------------------------- | | npm 6 audit --json | NPMAuditReportV1 | One quick-audit report | | npm 7+ audit --json | NPMAuditReportV2 | One processed report, auditReportVersion: 2 | | Yarn Classic audit --json | YarnAudit | Reporter NDJSON on stdout/stderr | | Yarn 2/3 npm audit --json | Yarn2And3AuditReport | One quick-audit report | | Yarn 4+ npm audit --json | YarnNpmAuditReport | Advisory-tree NDJSON or reporter diagnostics; a clean audit may emit no lines | | pnpm audit --json | PNPMAuditReport | Legacy quick-audit or modern bulk-derived report | | Bun audit --json | BunAuditReport | Raw registry bulk-advisory response | | npm audit signatures --json | NPMAuditSignaturesReport | Signature issues and optional attestation records | | pnpm audit signatures --json | PNPMAuditSignaturesReport | Signature issues and verification counts | | Registry bulk-advisory endpoint | NPMAuditBulkReport | Package names mapped to advisory arrays |

Usage

import type { NPMAuditReportV2 } from "audit-types";

const report = JSON.parse(stdout) as NPMAuditReportV2.AuditResponse;
if ("vulnerabilities" in report) {
  for (const advisory of Object.values(report.vulnerabilities)) {
    for (const via of advisory.via) {
      if (typeof via === "string") {
        console.log("Vulnerable dependency:", via);
      } else {
        console.log(via.title, via.cvss?.vectorString);
      }
    }
  }
}

via may mix advisory objects and package names. CWE/CVSS metadata is absent in older npm reports; a CVSS vector can also be null. fixAvailable can be true, false, or an upgrade object.

Parse Yarn NDJSON one nonempty line at a time:

import type { YarnNpmAuditReport } from "audit-types";

const lines: YarnNpmAuditReport.AuditResponse[] = stdout
  .split(/\r?\n/)
  .filter((line) => line.trim().length > 0)
  .map((line) => JSON.parse(line));

for (const line of lines) {
  if ("children" in line) {
    console.log(line.value, line.children.ID, line.children.URL);
  } else {
    console.log(line.type, line.data);
  }
}

Yarn 4 advisory IDs can be strings, including deprecation IDs, and URLs can be absent. YarnNpmAuditReport.AuditAdvisory describes just an advisory line. AuditResponse also includes diagnostic messages. Yarn Classic's auditSummary.data is the full metadata object, with counts under data.vulnerabilities.

PNPMAuditReport.Advisory exposes the common fields of old and new pnpm output. CurrentAdvisory/CurrentAudit describe pnpm 11/12, and LegacyAdvisory describes older quick-audit data. Modern pnpm does not provide the old CVE, CVSS, author, or timestamp fields. Its cwe is a string; patched_versions may be absent (pnpm 11) or null (pnpm 12), and patched_versions_unpublished can indicate that no fix has been published.

Bun prints the raw bulk response, including when reporting thresholds or ignored advisories affect its exit code. It does not emit npm's dependency-tree report. Successful clean bulk responses are {}. Errors may produce no JSON, so inspect the process result separately.

Signature audits have distinct schemas: npm's optional verified field is an array of attestation records enabled by --include-attestations; pnpm's required verified field is a number. Sigstore bundle bodies are represented as extensible JSON objects. Signature reports are not vulnerability reports.

Deno's audit implementation inspected for 2.9.8 emits formatted output rather than a CLI JSON report, so no Deno JSON namespace is provided. audit fix installation output is also outside these report types.

Compatibility notes for 0.7

  • Existing namespaces and named helper types remain available. Repeated legacy fields share definitions.
  • Legacy CWE values can be strings or arrays. Historical advisory URLs and dates are strings; author email/link fields and post-migration GitHub/CVSS fields may be absent.
  • Arbitrary package versions, registry messages, and map keys are represented as strings. CVE, CWE, GitHubAdvisoryId, ISO8601Date, and Semver remain available as opt-in helpers.
  • YarnNpmAuditReport.AuditResponse is now a union. Narrow with "children" in line before accessing advisory fields.
  • Some fields became optional or nullable to match real reports. Consumers must account for missing data.

Verification and sources

Run pnpm install --frozen-lockfile and pnpm test. Tests compile real upstream fixtures, verify compatibility with upstream pnpm/Yarn declarations, and check that malformed reports are rejected. CI runs without contacting audit registries.

The reviewed implementations and versions are recorded in SOURCES.md. Tests are development-only and are excluded from the published package.