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

@chordsketch/wasm-export

v0.5.0

Published

ChordPro PDF / PNG export bindings (heavy WebAssembly bundle) — sister of @chordsketch/wasm

Readme

@chordsketch/wasm-export

ChordSketch WebAssembly bindings for PDF / PNG export — the heavy companion of @chordsketch/wasm.

This package adds render_pdf / renderIrealPng / renderIrealPdf on top of every export the lean package ships, so a single import of @chordsketch/wasm-export is sufficient for any app that needs to emit binary chart artefacts. The price is bundle weight: this package weighs ~25× more than @chordsketch/wasm because it bundles the resvg / tiny-skia / svg2pdf / fontdb / harfrust transitive dependency tree required to rasterise SVG and emit PDF.

| Package | Raw .wasm | gzipped | Surface | |---|---|---|---| | @chordsketch/wasm | 399 KB | 178 KB | parse + transpose + text / HTML / SVG | | @chordsketch/wasm-export | 9.7 MB | 6.7 MB | lean surface + PDF / PNG |

The intended usage pattern is to install @chordsketch/wasm as your default dependency and import('@chordsketch/wasm-export') dynamically only when the user actually triggers an export — the dynamic-import boundary lets bundlers (Vite, webpack, Rollup, esbuild) emit a separate chunk for the heavy bundle so the initial page load stays light.

Installation

npm

Replace VERSION with the current version from the badge above.

npm install '@chordsketch/wasm-export@VERSION'

Usage

The package ships two builds under one name and uses Node's conditional exports to pick the right one for the runtime:

| Runtime | Build | Init required? | |---|---|---| | Browser (Vite, webpack, native ESM) | wasm-pack --target web | Yes — await init() | | Node.js (≥ 20) | wasm-pack --target nodejs | No — auto-loaded synchronously |

Browser

import init, { render_pdf, render_pdf_with_options } from '@chordsketch/wasm-export';

await init();

const chordpro = `{title: Amazing Grace}
{key: G}

[G]Amazing [G7]grace, how [C]sweet the [G]sound`;

const pdfBytes = render_pdf(chordpro);                // Uint8Array
const transposed = render_pdf_with_options(chordpro, { transpose: 2 });

Node.js

import { render_pdf } from '@chordsketch/wasm-export';

const pdfBytes = render_pdf('{title: T}\n[C]Hello');  // Uint8Array

Lazy dynamic import (recommended in the browser)

async function downloadPdf(chordpro) {
  // Only the user clicking "export" pays the ~6 MB gzipped download.
  const { default: init, render_pdf } = await import('@chordsketch/wasm-export');
  await init();
  const bytes = render_pdf(chordpro);
  // ... wrap in Blob, anchor.click, etc.
}

API

This package re-exports the full surface of @chordsketch/wasm (parse + transpose + text / HTML / SVG / iReal-chord-typography) unchanged. Refer to the sister package's README for those signatures.

The export-specific additions:

| Function | Input | Output | |----------|-------|--------| | render_pdf(input) | ChordPro string | Uint8Array (PDF bytes) | | render_pdf_with_options(input, options) | ChordPro string + options | Uint8Array (PDF bytes) | | renderIrealPng(input) | irealb:// URL | Uint8Array — encoded PNG (300 DPI default, A4-equivalent canvas) | | renderIrealPdf(input) | irealb:// URL | Uint8Array — single-page A4 PDF (vector content) |

Options

interface RenderOptions {
  transpose?: number;  // Semitone offset (any integer in i8 range; renderer reduces mod 12), default 0
  config?: string;     // Preset name ("guitar", "ukulele") or inline RRJSON
}

Why split the package?

Resolving SVG (resvg) and emitting PDF (svg2pdf, plus the PDF text-shaping stack in chordsketch-render-pdf) inflates the wasm binary by an order of magnitude. Most consumers of @chordsketch/wasm only want the parser + the text / HTML / SVG renderers — they should not pay the rasterisation cost on every page load.

The split is implemented at the chordsketch-wasm Cargo feature level: @chordsketch/wasm builds with --no-default-features (parser + lean renderers only), and @chordsketch/wasm-export builds with the png-pdf Cargo feature on. See CLAUDE.md in the source repo for the per-crate dependency graph and #2466 for the size-budget discussion that motivated the split.

Building from source

# From the repository root
cd packages/npm-export && npm run build

License

MIT