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

bettera11y

v0.5.1

Published

Core realtime accessibility audit engine for BetterA11y integrations.

Readme

BetterA11y Core API

npm version

bettera11y is the standalone core runtime for BetterA11y.

Use it to run accessibility audits, apply rule presets, and return normalized diagnostics that can be consumed by separate tooling packages (ESLint, Vite, Next.js, browser extensions, and custom integrations).

Style auditing is included for inline HTML/JSX styles and raw CSS inputs, with contrast/readability checks and configurable thresholds.

Install

npm install bettera11y

Quick Start

import { audit, check, recommendedPreset } from "bettera11y";

const result = await audit(`<html><main><h1>Welcome</h1><img src="/hero.png" /></main></html>`, {
    rules: recommendedPreset,
    filepath: "pages/index.html"
});

const isClean = await check("# Heading", {
    rules: recommendedPreset,
    format: "markdown",
    source: { kind: "inline", label: "Quick note" }
});

const cssAudit = await audit(":root{--fg:#777;--bg:#888}.title{color:var(--fg);background:var(--bg)}", {
    format: "css",
    filepath: "styles.css",
    rules: recommendedPreset,
    ruleOptions: {
        "color-contrast": { minContrastNormal: 4.5, minContrastLarge: 3 }
    }
});

console.log(result.diagnostics);
console.log(isClean);
console.log(cssAudit.diagnostics);

Browser entry (bettera11y/browser)

For client-side bundles, import bettera11y/browser instead of bettera11y. It exposes the same audit APIs and presets without depending on JSDOM. Use createBrowserRuntimeAdapter() when you want to pass an explicit runtimeAdapter to audit() (the default in that entry already uses the browser DOMParser).

What You Get

  • Core runtime: run one-shot or incremental audits.
  • Rule presets: recommendedPreset, strictPreset, and wcagAaBaselinePreset.
  • Diagnostics utilities: stable IDs, source location helpers, and severity mapping.
  • Style auditing: contrast/readability checks for inline styles and CSS text/files.
  • Reporting helpers: pretty, JSON, and machine-oriented output formats.
  • Adapter primitives: utilities for building integrations in other packages.

Core API

  • audit(source, options?, signal?): one-shot async audit with cancellation support.
  • auditSync(source, options?): sync one-shot audit for sync-only rule sets.
  • check(source, options?, signal?): boolean helper for pass/fail checks.
  • checkSync(source, options?): sync boolean helper.
  • auditIncremental({ changes }, options?, signal?): batch-style incremental audit API for local-dev workflows.
  • startAuditSession(options?): explicit session lifecycle for file-watcher/dev-server usage.

Integration Flow

flowchart LR
  host[ExternalIntegrationHost] --> inputProvider[InputProviderContract]
  inputProvider --> normalizer[InputNormalizer]
  normalizer --> session[AuditSession]
  session --> rules[RuleRuntime]
  rules --> cache[IncrementalCache]
  rules --> diagnostics[DiagnosticEmitter]
  diagnostics --> mapping[MappingUtilities]
  mapping --> host

Rule Presets

  • recommendedPreset: low-noise default for most integrations.
  • strictPreset: full core ruleset for strict CI/dev policies.
  • wcagAaBaselinePreset: WCAG 2.1 AA normative baseline only.

WCAG Alignment Policy

  • Rules tagged with meta.wcagAlignment: "normative" map directly to WCAG 2.1 AA success criteria.
  • Rules tagged with meta.wcagAlignment: "heuristic" are static-analysis proxies or best-practice checks.
  • Heuristic rules are useful for developer feedback loops but are not strict pass/fail WCAG conformance claims.

Style Auditing Notes

  • CSS support in the current layer is static and input-bound (inline styles + raw CSS content).
  • Full browser-accurate cascade resolution across external stylesheets is intentionally out of scope for now.
  • When background styles cannot be resolved with confidence, diagnostics use conservative defaults and metadata hints.