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

jpfun

v0.2.0

Published

A functional numbered musical notation typesetting engine

Readme

jpFun

A functional numbered musical notation typesetting engine for TypeScript.

jpFun compiles a compact numbered-notation DSL into a reusable document layout that can be rendered as SVG or Canvas.

Features

  • Concise DSL with function-based extensibility
  • Numbered notes, rests, chords, lyrics, voices, grace notes, ties, and beams
  • Automatic spacing, line breaking, and pagination
  • Shared layout model for SVG and Canvas rendering
  • Structured diagnostics and source locations
  • Zero runtime dependencies
  • Works in both Node.js and modern browsers

Installation

npm install jpfun

jpFun is ESM-only and requires Node.js 18 or later:

import { compileScore } from "jpfun";

CommonJS require("jpfun") is not supported.

Quick Start

import { compileScore, renderLayoutToSvg } from "jpfun";

const source = `
  @1(C4)
  @tempo(96)

  1/ 2/ 3 4 | 5 -
`;

const result = compileScore(source);
const svg = renderLayoutToSvg(result.layout);

renderLayoutToSvg returns an SVG string that can be written to a file, sent in an HTTP response, or inserted into a browser page.

Canvas Rendering

import { compileScore, renderLayoutToCanvas } from "jpfun";

const result = compileScore("1 2 3 | 4");
const canvas = document.querySelector("canvas");
const context = canvas.getContext("2d");

if (context) {
  renderLayoutToCanvas(result.layout, context);
}

Compilation Pipeline

jpFun exposes the intermediate results of its compilation pipeline:

Source
  -> Parser     -> AST
  -> Lowering   -> timed events and relations
  -> Layout     -> document geometry
  -> Renderer   -> SVG or Canvas
const result = compileScore("1 2 3 | 4");

result.parser;
result.ast;
result.lowering;
result.layout;

This makes it possible to build editors, diagnostics, playback tools, and custom renderers on top of the same compilation result.

Syntax Example

@page(width=860px, left=38px, right=38px)
@1(C4)
@tempo(96)

N(Melody): 1/ 1/ 5/ 5/ 6/ 6/ 5 -
N: @div(C4 C4) G4/G4/ A4/ A/ G
L(Lyrics): do do so so la la so

See the language reference for the complete syntax.

Runtime Support

  • ESM only
  • Node.js 18 or later
  • Modern browsers and bundlers
  • No DOM dependency in the compiler
  • No runtime dependencies

Development

jpFun is maintained in a pnpm workspace. From the repository root:

pnpm install
pnpm run build:core
pnpm test

The repository also includes a browser-based Playground with diagnostics and SVG/Canvas previews:

pnpm run dev

Then open http://127.0.0.1:4173.

Documentation

License

Apache License 2.0