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

@a11y-pulse/browser-adaptor

v0.5.0

Published

Shared browser adaptor primitives and DOM helpers for A11y Pulse accessibility audits.

Readme

@a11y-pulse/browser-adaptor

npm version CI License: MIT

Shared browser adaptor primitives and DOM helpers used by A11y Pulse accessibility audits. Audit packages drive a page through a BrowserAdaptor without depending on a specific automation library. This package also exports getSelector and truncateHtml for building result metadata.

Released under the MIT License.

Install

npm install @a11y-pulse/browser-adaptor

puppeteer and playwright-core are optional peer dependencies. Each is only required if you use the matching bundled adaptor (Puppeteer, Playwright).

Exports

| Entry | Contents | | --- | --- | | @a11y-pulse/browser-adaptor | BrowserAdaptor, ElementRef, Rect | | @a11y-pulse/browser-adaptor/puppeteer | PuppeteerAdaptor | | @a11y-pulse/browser-adaptor/playwright | PlaywrightAdaptor | | @a11y-pulse/browser-adaptor/dom | getSelector, truncateHtml |

Quickstart

import { PuppeteerAdaptor } from "@a11y-pulse/browser-adaptor/puppeteer";
import puppeteer from "puppeteer";

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto("https://example.com/");

const adaptor = new PuppeteerAdaptor(page);
await adaptor.ensureFocusReporting();
await adaptor.pressTab();

await browser.close();

BrowserAdaptor

Implement this interface against your automation library's page or session object:

interface BrowserAdaptor {
  evaluate<T>(fn: (...args: any[]) => T | Promise<T>, ...args: unknown[]): Promise<T>;
  evaluateHandle(fn: () => Element | null): Promise<ElementRef>;
  disposeRef(ref: ElementRef): Promise<void>;
  pressTab(): Promise<void>;
  pressEnter(): Promise<void>;
  screenshotClip(clip: Rect, scale?: number): Promise<Uint8Array>;
  readonly screenshotClipScale?: number;
  ensureFocusReporting(): Promise<void>; // must not throw
}

Consumers may ignore methods they do not need. ensureFocusReporting is best-effort and must not throw.

Puppeteer adaptor

PuppeteerAdaptor wraps a Puppeteer Page. Its CDP session is cached per page, so reusing a page across audit runs does not open extra sessions.

Clipped screenshots go over that CDP session with captureBeyondViewport off, so only what is inside the current viewport is captured. Chromium honours captureBeyondViewport by shrinking the emulated viewport to 1x1 and resizing it for the clip before restoring it, and the page sees each of those as a real resize: resize fires and media queries flip to their narrowest breakpoint, which can collapse a responsive layout and blur the focused element mid-capture. The tab-driven audits scroll each element into view before capturing. Pass captureBeyondViewport: true only for evidence of regions you cannot scroll to, where the page's state does not matter:

new PuppeteerAdaptor(page, { captureBeyondViewport: true });

Playwright adaptor

PlaywrightAdaptor wraps a Playwright Page, and works with either playwright or playwright-core.

import { PlaywrightAdaptor } from "@a11y-pulse/browser-adaptor/playwright";
import { chromium } from "playwright";

const browser = await chromium.launch();
const page = await browser.newPage({ deviceScaleFactor: 2 });
await page.goto("https://example.com/");

const adaptor = new PlaywrightAdaptor(page);
await adaptor.ensureFocusReporting();
await adaptor.pressTab();

await browser.close();

Two differences from the Puppeteer adaptor are worth knowing about.

evaluate needs unsafe-eval. Playwright's evaluate takes a single argument, so the adaptor packs the page function's source and its arguments into one tuple and rebuilds the function in the page with new Function. A page whose Content-Security-Policy omits unsafe-eval from script-src will reject that; the adaptor throws a message naming CSP as the cause rather than letting it read as a page failure. Puppeteer is unaffected, because CDP serialises the function itself.

Screenshot scale depends on the engine. On Chromium the adaptor screenshots over CDP, which honours screenshotClipScale per capture, so evidence images match Puppeteer's; it takes the same captureBeyondViewport option, off by default for the same reason. Firefox and WebKit expose no CDP, so the adaptor falls back to a full-page capture at the context's own deviceScaleFactor, which those engines take without resizing the viewport. There, create the context with a deviceScaleFactor matching screenshotClipScale (2 by default), or pass the scale you want:

new PlaywrightAdaptor(page, { screenshotClipScale: 1 });

DOM helpers

import { getSelector, truncateHtml } from "@a11y-pulse/browser-adaptor/dom";

getSelector builds a compact selector for an element (intended to run in page context). truncateHtml shortens an element's opening tag for display in results.

License

MIT. Use it however you like, including in commercial and competing products.

The audit packages in this repository are licensed separately, under the PolyForm Shield License 1.0.0.