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

@eraserlabs/diagrams

v0.2.0

Published

The impure conductor: owns Chromium, network, the font lifecycle, and the Eraser template library.

Readme

@eraserlabs/diagrams

Introduction

@eraserlabs/diagrams is the batteries-included entry point of the rendering pipeline: the one package that owns everything impure. It drives Chromium (via playwright-core), stages and injects fonts, fetches icons, and ships the stock Eraser component library, wiring @eraserlabs/resolve and @eraserlabs/render into a single call that turns diagram JSON into PNG, measured JSON, or standalone HTML.

The pure pieces live below it: contracts in @eraserlabs/protocol, validation and resolution in @eraserlabs/resolve, in-page measurement and layout in @eraserlabs/render and @eraserlabs/layout. Use those directly when you need the pipeline without a browser; use this package when you want a picture.

Usage

import { createRenderer } from '@eraserlabs/diagrams';

const renderer = await createRenderer({ chromiumPath: '/path/to/chromium' });

const result = await renderer.render({
  entities: [{ tag: 'Textbox', id: 't1', x: 40, y: 40, text: 'Hello' }],
  connections: [],
  outputs: { png: true, json: true },
});

if (result.ok) {
  await writeFile('diagram.png', result.png);
}

await renderer.close();

Chromium is caller-owned: pass a local chromiumPath, or a browser provider for caller-managed and remote browsers (chromium.connectOverCDP(...)). A provider owns its browser's flags — if you use url font faces served from localhost or a private network, launch with --disable-features=LocalNetworkAccessChecks,BlockInsecurePrivateNetworkRequests, since the origin-less render page otherwise has its font fetches silently blocked by Chromium's Local Network Access checks (the chromiumPath path applies these flags for you). Everything else defaults to stock: the Eraser component library, the vendored fonts (Shantell Sans, Inter, JetBrains Mono — all SIL OFL 1.1, under fonts/), and Eraser's hosted icon catalog (which needs network access; supply iconLoader for offline or custom icons).

PNG output has a white background by default. Pass transparent: true to createRenderer to preserve background transparency; authored fills remain visible and HTML output is unaffected.

renderer.validate runs the same validation as render without touching the browser. Rendering guides live in the repo root: GETTING_STARTED.md for authoring and CUSTOMIZATION.md for bringing your own component library, palette, and fonts.