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

@nowline/export-png

v0.2.5

Published

Nowline PNG exporter — rasterizes the renderer SVG via resvg-js (WASM)

Readme

@nowline/export-png

Rasterizes a Nowline-rendered SVG to PNG using @resvg/resvg-js (a Rust→WASM SVG rasterizer). Bundled into the nowline CLI.

License: Apache 2.0 Part of: lolay/nowline monorepo Spec: specs/handoffs/m2c.md § 3

Install

pnpm add @nowline/export-png @nowline/export-core @nowline/renderer

Usage

import { layoutRoadmap } from '@nowline/layout';
import { renderSvg } from '@nowline/renderer';
import { resolveFonts } from '@nowline/export-core';
import { exportPng } from '@nowline/export-png';

const svg = await renderSvg(layoutRoadmap(file, resolved, { theme }));
const fonts = (await resolveFonts({ headless: true })).pair();
const png = await exportPng({ ast, resolved, model, sourcePath, today }, svg, {
    scale: 2,
    fonts,
});

// `png` is a Uint8Array of PNG bytes.

Options

| Option | Default | Notes | |----------------|-------------|-------| | scale | 2 | Pixel-density multiplier. Scales the root <svg width/height> before rasterization. Common values: 1, 1.5, 2, 3. | | background | model | Override the background color (CSS color or transparent). | | fonts | resolveFonts() | Pre-resolved sans/mono pair. If omitted, the exporter calls @nowline/export-core's resolver itself. | | resvgOptions | (none) | Escape hatch for resvg-js options. Use sparingly. |

The scale factor is applied by rewriting the root SVG element's width/height attributes — resvg-js 2.6.x ignores fitTo when fontBuffers is set, so this is the workaround the package uses to keep custom-font rendering deterministic.

Determinism

  • WASM module: lazy-loaded on first call; cached process-globally. The _resetResvgModule() test seam clears the cache.
  • loadSystemFonts: false — only fonts passed via fontBuffers are visible to resvg, so identical input produces identical bytes regardless of host machine.
  • Font bytes come from @nowline/export-core's 5-step resolver. With --headless (or the equivalent option here), the bundled DejaVu pair is used and the output is byte-stable across macOS / Linux / Windows.
  • The PNG header bytes are \x89PNG\r\n\x1a\n followed by an IHDR chunk whose dimensions equal scale × <svg width> × scale × <svg height>.

Snapshot tests

Snapshots live in test/__snapshots__/. Regenerate with vitest -u. Hash tests in test/export-png.test.ts confirm byte-stability across re-renders.

License

Apache-2.0.