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

sprinter-patchright-compat

v0.6.0

Published

Compatibility patch + viewport helper for Patchright CDP connections through Sprinter.

Readme

sprinter-patchright-compat

Compatibility patch for Patchright when connecting over CDP to a Sprinter browser session.

What It Fixes

Sprinter's CDP gateway emits internal traffic with rewritten or unrelated response IDs (for example 1900000016, or success/error frames for the gateway's own Browser.getVersion warmup). Patchright's CRSession._onMessage asserts on any unmatched id-bearing frame, which crashes the process during chromium.connectOverCDP(...) — typically only on the first run, since a second attempt finds the gateway in steady state.

This package rewrites patchright-core/lib/server/chromium/crConnection.js so the CDP client:

  • maps Sprinter's 1900000000 + id response IDs back to the pending Patchright callback,
  • silently drops every other id-bearing response (success or error) that Patchright never registered,
  • still raises real CDP errors that belong to outstanding Patchright calls.

The wider drop covers all error codes (the previous v0.1 patch only ignored -32001), which is what eliminates the "first run panics, second run works" pattern.

Usage

From a project that has patchright installed:

npx sprinter-patchright-compat

For local development from this checkout:

node bin/sprinter-patchright-compat.js --root /path/to/project

Wire it into a consuming project's package.json so reinstalls don't wipe the patch:

{
  "scripts": {
    "postinstall": "sprinter-patchright-compat"
  }
}

The patcher is idempotent and will upgrade installs that still carry the v0.1 patch.

Auto Viewport

After running npx sprinter-patchright-compat, every page created on a Patchright BrowserContext is automatically pinned to 1920x947 — Sprinter's expected viewport (1080p Xvfb minus chrome's tab + URL bars). Customer code is unchanged:

const { chromium } = require("patchright");

const browser = await chromium.connectOverCDP(sessionUrl);
const context = browser.contexts()[0] || await browser.newContext();
const page = await context.newPage();      // viewport already 1920x947
await page.goto("https://example.com/");

Opt out per-process: SPRINTER_DISABLE_VIEWPORT=1. If a single page needs a different viewport, just call page.setViewportSize(...) after newPage() — the customer's call wins.

For programmatic access (constant, or applying to a page you got via Target.attachedToTarget or another non-newPage path):

const { SPRINTER_VIEWPORT, applyViewport, autoApplyViewport } = require("sprinter-patchright-compat");

Smoke Test

const { chromium } = require("patchright");

(async () => {
  const browser = await chromium.connectOverCDP("ws://127.0.0.1:19012/devtools/browser");
  const context = browser.contexts()[0] || await browser.newContext();
  const page = await context.newPage();
  await page.goto("https://example.com/", { waitUntil: "domcontentloaded" });
  console.log(await page.viewportSize()); // { width: 1920, height: 947 }
  console.log(await page.title());
  await browser.close();
})();

Notes

Both patch sites are runtime modifications of Patchright's generated package files. Treat as narrow compatibility shims until upstream support lands. The patcher is idempotent and self-detects already-patched files.