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

music-jsx-compiler

v0.1.3

Published

JSX-like component framework for building MusicXML

Downloads

781

Readme

music-jsx-compiler

Write chord charts in JSX. Get MusicXML out.

A tiny component framework for building MusicXML from familiar-looking JSX — loops, sections, and chord bars instead of hundreds of lines of XML. Built for humans and the LLMs that help them write music.

npm install music-jsx-compiler

Why this exists

MusicXML is precise, but verbose. An eight-bar verse with four chords per bar can balloon into hundreds of lines — painful to write by hand and expensive to generate with AI.

With music-jsx-compiler, you describe structure once and let the compiler expand it:

<Song tempo={120} key="C" time="4/4">
  <Loop times={8}>
    <ChordBar chords={["Am", "F", "C", "G"]} />
  </Loop>
  <Bridge>
    <Comment text="only guitar for the 2 next bars!" />
    <ChordBar chords={["Dm", "G", "Em", "Am"]} />
  </Bridge>
</Song>

That becomes 9 measures (8 looped bars + 1 bridge) of valid MusicXML 4.0 with harmony symbols, rehearsal marks, and directions — roughly 10× fewer tokens than writing the XML yourself.


Quick start

1. Install

npm install music-jsx-compiler

2. Configure TypeScript (so .tsx files use this JSX runtime)

{
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "music-jsx-compiler"
  }
}

3. Write a song

import { Song, Loop, ChordBar, Words, compileToMusicXml } from "music-jsx-compiler";

const song = (
  <Song tempo={120} key="C" time="4/4" title="My Song">
    <Loop times={4}>
      <Words text="Guitar should start playing here" />
      <ChordBar chords={["C", "G", "Am", "F"]} />
    </Loop>
  </Song>
);

const musicXml = compileToMusicXml(song);
// → valid MusicXML string, ready to save or import into notation software

Components

| Component | What it does | |-----------|--------------| | Song | Root element — set tempo, key, time, and optional title | | Loop | Repeat its children times | | ChordBar | One measure of chords — array length must match the beat count (e.g. 4 chords in 4/4) | | Bridge | Section wrapper (adds a rehearsal mark; defaults to "Bridge") | | Section | Named section wrapper with a custom name | | Words | Lyric or direction text above the next bar | | Comment | Rehearsal or performance note attached to the next bar |


Chord symbols

Common notation just works:

C · Am · F#m · Bb · G/B · Dm7 · Cmaj7 · Gsus4 · Bdim · Caug · and more


Try the example

Clone the repo and run:

npm install
npm run compile   # writes music-sheets/output.musicxml

API

| Export | Description | |--------|-------------| | compileToMusicXml(tree) | Compile a JSX song tree to a MusicXML string | | Song, Loop, Bridge, Section, ChordBar, Words, Comment | JSX components | | parseChord(symbol) | Parse a chord string into structured parts | | flattenSong(tree) | Expand loops/sections into a flat measure list |


Requirements

  • Node.js 18+
  • TypeScript recommended (for .tsx and jsxImportSource)

License

MIT