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

@cooklang/cooklang

v0.17.2

Published

Official Cooklang parser - Rust-powered WASM implementation for high performance recipe parsing

Downloads

199

Readme

@cooklang/cooklang

Official Cooklang parser for JavaScript and TypeScript.

This is a high-performance WASM implementation powered by the Rust cooklang-rs parser. It provides fast, reliable recipe parsing with full support for the Cooklang specification.

Installation

npm install @cooklang/cooklang

Quick Start

import { Parser } from '@cooklang/cooklang';

const parser = new Parser();
const recipe = parser.parse(`
>> servings: 4

Add @salt and @pepper to taste.
Cook for ~{10%minutes}.
`);

console.log(recipe.sections[0].content);

Why WASM?

This package uses WebAssembly for several key benefits:

  • Performance: Native-speed parsing, significantly faster than pure JavaScript
  • Reliability: Shared implementation with the official Rust parser means consistent behavior across platforms
  • Maintainability: Changes to the Cooklang spec are implemented once in Rust and automatically available here

Migration from @cooklang/cooklang-ts

If you're migrating from the previous TypeScript-native @cooklang/cooklang-ts package (v1.x), please see the Migration Guide.

Key differences:

  • Different package name: @cooklang/cooklang-ts@cooklang/cooklang
  • API changes: The WASM implementation has a different API surface
  • Version numbering: This package tracks the Rust core version (currently 0.17.x)

API Reference

Parser

import { Parser } from '@cooklang/cooklang';

const parser = new Parser();
const recipe = parser.parse(recipeText);

Recipe Structure

The parsed recipe contains:

interface Recipe {
  sections: Section[];
  metadata: Record<string, string>;
  ingredients: Ingredient[];
  cookware: Cookware[];
  timers: Timer[];
}

Helper Functions

import {
  ingredient_should_be_listed,
  ingredient_display_name,
  cookware_should_be_listed,
  cookware_display_name,
  quantity_display,
  grouped_quantity_display,
  grouped_quantity_is_empty
} from '@cooklang/cooklang';

Value Extraction

Utility functions for working with quantities:

import { getNumericValue, extractNumericRange } from '@cooklang/cooklang';

const value = ingredient.quantity?.value;
const numeric = getNumericValue(value); // 2.5
const range = extractNumericRange(value); // { start: 2, end: 3 }

Version Synchronization

This package version tracks the Rust cooklang-rs version. For example:

We use 0.x versioning to match the Rust core library. The parser is production-ready and actively maintained. We'll bump to 1.0 when the Rust core reaches 1.0.

Browser Support

This package works in:

  • Node.js 16+
  • Modern browsers (Chrome, Firefox, Safari, Edge)
  • Bundlers (Webpack, Vite, Rollup, etc.)

Contributing

This package is part of the cooklang-rs monorepo. Contributions are welcome!

License

MIT - see LICENSE

Links