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

@axaraaudit/core

v0.6.0

Published

Core logic: DTCG token parsing, static AST analysis & design-drift detection

Readme

@axaraaudit/core

Core logic for A11yEngine: DTCG token parsing and static Design-Drift detection for .css / .tsx source. Zero runtime config — point it at a DTCG token file and your source files.

What it does

  1. Parses DTCG tokens (parseDtcg / parseDtcgString)

    • Flattens the group/token tree to dot-paths + CSS variable names.
    • Inherits $type from ancestor groups.
    • Resolves {group.token} aliases, with cycle & unknown-target detection.
    • Builds value→token indexes for colors (canonical sRGB) and dimensions (normalized to px).
  2. Analyzes source statically

    • CSS via PostCSS (analyzeCss): colors on every declaration, spacing on spacing-related properties only.
    • TSX/JSX via the TypeScript Compiler API (analyzeTsx): inline style={{…}} objects (colors + spacing, React-numeric → px) and color literals in any string/template (styled-components, theme constants).
  3. Emits a structured drift report — for each hard-coded value: exact-token (safe auto-fix → var(--token)), nearest-token (suggested), or no-token, with confidence, location, and a ready-to-apply replacement.

Usage

import { auditPaths, auditSources } from '@axaraaudit/core';

// From disk:
const report = auditPaths('design-tokens.dtcg.json', ['src/Button.tsx', 'src/app.css']);

// Or in-memory:
const report2 = auditSources(tokensJson, [{ path: 'Button.tsx', content }]);

console.log(report.summary); // { filesScanned, totalIssues, errors, warnings, autoFixable }

Scripts

pnpm --filter @axaraaudit/core test       # vitest
pnpm --filter @axaraaudit/core typecheck  # tsc --noEmit (strict)
pnpm --filter @axaraaudit/core build      # emit dist/

RGAA wrapper (axe-core)

Runs axe-core headlessly and re-keys its findings onto RGAA 4.1 criteria, then exports a DINUM/Ara-compatible declaration.

import { auditHtmlRgaa, toAraDeclaration } from '@axaraaudit/core';

const report = await auditHtmlRgaa('<img src="logo.png">');
// report.findings → [{ criterion: '1.1', themeLabel: 'Images', axeRuleId: 'image-alt', ... }]

const declaration = toAraDeclaration(report); // { referential: 'RGAA', criteria: [{ status: 'NC', ... }] }
  • mapAxeResults(axeResults) — pure mapper from raw AxeResults (e.g. produced by the Playwright runtime at step 4) to a RgaaReport. The axe→RGAA table lives in src/rgaa/mapping.ts; unmapped rules are surfaced, never dropped.
  • runAxeOnHtml / auditHtmlRgaa — execute axe-core inside JSDOM by injecting axe.source. Contrast (color-contrast) needs real rendering and is therefore disabled under JSDOM (accurate pass = Playwright, step 4); it is surfaced as cantTell otherwise.
  • toAraDeclaration — only emits the criteria detected as non-conforme (NC); the global conformance rate and C/NA criteria require a manual RGAA grid (stated in the declaration note).

See ../../examples/ for runnable demos: node examples/smoke.mjs (design drift) and node examples/rgaa-smoke.mjs (RGAA → Ara).