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

@unitsml/unitsml

v0.6.7

Published

JavaScript release of unitsml-ruby, published as @unitsml/unitsml on npm. Opal-compiled; ships self-contained + external flavors. Built from source at unitsml-ruby.

Downloads

67

Readme

@unitsml/unitsml

JavaScript release of unitsml-ruby, Opal-compiled and published as @unitsml/unitsml on npm.

Status: scaffolding. The build pipeline produces both flavors (self-contained + external Opal runtime), and the structure is verified. The runtime story for Unitsml.parse() itself is not complete — unitsml-ruby subclasses ::Unitsdb::Database at runtime, so the unitsdb gem's model classes need to be available (either Opal-compiled alongside, or via a JS façade providing Ruby-compatible classes). See Runtime status below.

Install

npm install @unitsml/unitsml

Usage (target API)

const Unitsml = require("@unitsml/unitsml");

const formula = Unitsml.parse("mm");
const mathml = formula.to_mathml();
const latex = formula.to_latex();

Flavors

The package ships two entry points:

| Entry | File | Use case | |---|---|---| | unitsml (default) | dist/unitsml.js | Self-contained — Opal runtime embedded. One file, CDN-friendly, browser <script>-friendly. Larger (~1.5MB). | | unitsml-no-opal | dist/unitsml-no-opal.js | External — references @lutaml/opal-runtime global. Smaller (~790KB). For bundler users (webpack, vite, rollup) who share runtime across multiple Opal-compiled packages. |

Modern bundlers (webpack 5+, Vite, Rollup) and Node's ESM resolver pick unitsml-no-opal.js. The browser field / script-tag path picks unitsml.js.

Shared runtime

When bundling with @plurimath/plurimath or other Opal-compiled unitsml packages, declare @lutaml/opal-runtime as a peer dep to share the single Opal instance:

"peerDependencies": {
  "@lutaml/opal-runtime": "^1.0.0"
}

If @plurimath/plurimath has already shipped with @lutaml/opal-runtime declared, just npm install @unitsml/unitsml and the runtime dedups.

If it's absent (e.g., browser CDN with only one of the two packages loaded), @unitsml/unitsml falls back to its embedded runtime automatically.

Runtime status

The Opal compile of unitsml-ruby succeeds end-to-end. Running it requires resolving these runtime dependencies, currently stubbed at compile-time only:

  • unitsdb-ruby — unitsml subclasses ::Unitsdb::Database, ::Unitsdb::Unit, etc. Either Opal-compile unitsdb-ruby alongside, or shim with @unitsml/unitsdb (which provides JSON data, not Ruby classes — would require a Ruby-compatible class adapter).
  • mml-ruby — uses Mml::V4::* classes for MathML. Either Opal-compile mml-ruby (which transitively pulls moxml), or shim.
  • ox, nokogiri, htmlentities, plurimath — server-only gems. ox/nokogiri can be shims if unitsml's XML adapter is configured for the pure-Ruby oga adapter (moxml's default under Opal). htmlentities is a small pure-Ruby gem, candidates for direct Opal-compile. plurimath is optional.

The cleanest path forward is to Opal-compile unitsdb-ruby + mml-ruby as siblings, each published to npm with the same @lutaml/opal-runtime peer. The build pipeline here then Opal-compiles unitsml with all three as prerequired, producing a runnable bundle.

Source

Built from unitsml-ruby by its release workflow. The Ruby gem remains the single source of truth for both behavior and data.