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

mini-yaml-rs

v0.2.6

Published

A minimalist, zero-copy parser for a strict subset of the YAML specification.

Downloads

861

Readme

mini-yaml-rs

A minimalist, zero-copy YAML parser for Rust. Supports sequences, mappings, and custom tags.

Features

  • Zero-copy parsing (returns references to input)
  • Sequences and mappings (flow and block styles)
  • Custom tag support: !tagname becomes __type: "tagname"
  • Works in both Rust backend (Tauri) and WebAssembly

Installation

Rust (Cargo)

[dependencies]
mini-yaml-rs = "0.2"

JavaScript/TypeScript (npm)

npm install mini-yaml-rs

Building

# Build Rust library (for Tauri/backend)
make build-rust

# Build WASM for bundlers (Vite, webpack)
make build

# Build WASM for direct browser use
make build-web

# Build WASM for Node.js
make build-node

Usage

Rust

use mini_yaml_rs::parse;

let yaml = parse(r#"
+setup[Settings](db://settings):
    title: Settings
    authors[]:
      - !mod +@[Me](shawnx){}
      - !mod +@[Boby at Unix Group](boby:unix.org)

    signature:
        pubkey: |
            MCowBQYDK2VwAyEAGb9F2CMlxqLDB3rrzBVwC7aB...

    created: 2024-06-01T12:00:00Z
    modified: 2024-06-01T12:00:00Z
"#).unwrap();

// Returns Yaml<'_> enum - use to_json() for serde_json::Value
let json = yaml.to_json();
println!("{}", json);

Output:

{
  "+setup[Settings](db://settings)": {
    "title": "Settings",
    "authors": [
      {
        "__type": "mod",
        "+@[Me](shawnx)"
      },
      {
        "__type": "mod",
        "+@[Boby at Unix Group](boby:unix.org)"
      }
    ],
    "signature": {
      "pubkey": "MCowBQYDK2VwAyEAGb9F2CMlxqLDB3rrzBVwC7aB..."
    },
    "created": "2024-06-01T12:00:00Z",
    "modified": "2024-06-01T12:00:00Z"
  }
}

Magix Format

The to_mx() method transforms keys in +name[label](value) format:

use mini_yaml_rs::parse;

let yaml = parse(r#"
+setup[Settings](db://settings):
    title: Settings
    enabled: true
"#).unwrap();

let mx = yaml.to_mx();
println!("{}", mx);

Output:

{
  "+setup": {
    "__name": "Settings",
    "__value": "db://settings",
    "title": "Settings",
    "enabled": true
  }
}

The key +setup[Settings](db://settings) becomes +setup with:

  • __name = bracket content (Settings)
  • __value = paren content (db://settings, optional)

Tag Support

Tags are converted to __type fields:

!person {name: John}    # → {__type: "person", name: "John"}
!custom_tag [1, 2, 3]   # → {__type: "custom_tag", __value: [1, 2, 3]}

Type Inference

Unquoted scalar values are automatically converted to native types:

42            # → 42 (as integer)
-123          # → -123 (as integer)
3.14          # → 3.14 (as float)
1.0e10        # → 1.0e10 (as float)
true          # → true (as boolean)
false         # → false (as boolean)
yes/no        # → true/false (as boolean)
on/off        # → true/false (as boolean)

# Keep these as strings by quoting:
"42"          # → "42" (string, quotes stripped)
'true'        # → "true" (string, quotes stripped)

JavaScript/TypeScript (WASM)

All functions return plain JavaScript objects (not Map objects), making them easy to use with standard JS object syntax.

import init, { parseYaml, parseYamlToMx, printYaml } from 'mini-yaml-rs';

// Initialize WASM module
await init();

// Parse YAML → JavaScript object (no JSON.parse needed)
const obj = parseYaml(`
name: hello
value: 42
items:
  - one
  - two
`);
console.log(obj.name);   // "hello"
console.log(obj.value);  // 42
console.log(obj.items);  // ["one", "two"]

// Convert JavaScript object → YAML string
const yaml = printYaml({
  title: "My Config",
  enabled: true,
  settings: {
    theme: "dark",
    fontSize: 14
  }
});
console.log(yaml);
// title: My Config
// enabled: true
// settings:
//   theme: dark
//   fontSize: 14

// Parse with mx transformation
const mx = parseYamlToMx(`
+setup[Settings](db://settings):
  title: Settings
`);
console.log(mx["+setup"].__name);   // "Settings"
console.log(mx["+setup"].__value);  // "db://settings"

License

Apache-2.0. See LICENSE.

Acknowledgments

Based on minimal-yaml by Nathan Whitaker.