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

lite-matter

v0.1.1

Published

Ultra lightweight, zero-bloat frontmatter extractor.

Downloads

372

Readme

lite-matter

The Minimalist, Zero-Bloat YAML Frontmatter Extractor for Modern JavaScript.

lite-matter is a high-performance, single-pass frontmatter extraction engine. It provides the same metadata isolation interface as legacy libraries like gray-matter without the inclusion of heavy, non-standard dependencies or legacy string-handling wrappers.

Technical Specifications

  • Runtime: Node.js (ESM), Browser (Modern), Deno, Cloudflare Workers.
  • Language: Core logic written in modern TypeScript.
  • Dependency: Powered by the modern yaml parser for spec-compliant parsing.
  • Distribution: Pure ES Module (ESM).

The Problem: The Legacy Complexity Gap

Legacy libraries like gray-matter were built for an older era of the JavaScript ecosystem. They often include complex, non-standard frontmatter support (e.g., CoffeeScript, TOML, and CSV delimiters) and heavy string-processing logic that increases CPU and bundle overhead in modern static site generators and CMS engines.

lite-matter is a modern, laser-focused alternative. It is built strictly for the standard triple-dash YAML frontmatter format (the industry-standard across Markdown, GitHub, and major CMS architectures).

Technical Limitations & Design Scope

To maintain its minimalism, lite-matter purposely restricts its feature set:

  1. Format Restriction: Strictly supports YAML triple-dash (---) frontmatter. It does not support TOML (+++), CoffeeScript, or other legacy metadata formats found in gray-matter.
  2. No Delimiter Customization: Delimiters are hardcoded to the industry-standard --- to optimize regex isolation performance.
  3. Strict ESM: Built specifically for modern ESM toolchains.
  4. No In-memory Cache: For consistency, lite-matter performs a fresh parse on every invocation. If high-frequency parsing of the same file is required, results should be cached at the application layer.
  • Optimal Performance: Uses a pinpoint regex scan to isolate the YAML block, passing it directly to the performance-optimized yaml library.
  • Reduced Footprint: Does not bundle unnecessary non-standard parsers for legacy formats.
  • Secure & Robust: Provides safe, fault-tolerant YAML parsing with clean error handling and graceful fallbacks.
  • Modern Support: Written in TypeScript and exported as native ESM for a superior developer experience in modern toolchains.
  • Exact Drop-In Compatibility: Supports the identical matter(content) API expected by millions of developers.

Installation

npm install lite-matter

Quick Start

import matter from 'lite-matter';

const markdown = `---
title: Understanding lite-matter
date: 2026-04-04
status: draft
---
# Content Start
This is the body of the markdown file.`;

const { data, content } = matter(markdown);

console.log(data);
// Output: { title: "Understanding lite-matter", date: "2026-04-04", status: "draft" }

console.log(content.trim());
// Output: "# Content Start\nThis is the body of the markdown file."

Comparisons

| Feature | gray-matter | lite-matter | | :--- | :--- | :--- | | Logic | Multi-parser | Pinpoint YAML | | Parsing | Bulky strings | Single-pass scan | | Standard | Triple-dash (+++, TOML, etc.) | Standard Triple-dash YAML | | Weight (approx)| ~100KB+ | <1KB logic |

API Reference

matter(str)

Arguments:

  • str (string): The raw source string incorporating the frontmatter block.

Returns:

  • data (object): A parsed JavaScript object from the YAML block.
  • content (string): The remaining source string (stripped of frontmatter).

License

MIT - Developed under the docmd ecosystem by Ghazi.