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

recipe-tmlanguage

v0.3.5

Published

TextMate grammar for the recipe (.recipe) pharmacological notation language.

Downloads

1,328

Readme

recipe-tmlanguage

NPM JSR

TextMate grammar for the recipe pharmacological notation language, generated from the same JavaScript vocabulary modules that drive tree-sitter-recipe's parser.

Ships as recipe.tmLanguage.json (the package's main export) — load it in Shiki, a VS Code language extension, Monaco (via monaco-textmate), or any other vscode-textmate host.

Why generate, not author

The parser's vocabulary (FREQUENCY, TIMING, ROUTE, …, UNITS, plus the Dutch patient-prose frequency vocab in grammar/dutch) lives in plain readonly string[] modules under tree-sitter-recipe/grammar/. Authoring a parallel TextMate grammar by hand would mean copying those lists into regex alternations and re-copying them every time the parser is touched. Drift guaranteed.

Instead, src/grammar.ts imports those exact modules through tree-sitter-recipe's package exports map, escapes metachars, sorts alternatives longest-first (TextMate is first-match, not longest-match like tree-sitter), and emits a ready-to-ship JSON grammar. One source of truth, no sync burden.

Scope map

Captures from tree-sitter-recipe/queries/highlights.scm are mapped to standard TextMate scopes (keyword.control.…, support.function.…, invalid.illegal.…, …) with a trailing .recipe namespace. Every mainstream theme already paints these — no custom theme needs to be shipped with the grammar.

| highlights.scm capture | TextMate scope | | ------------------------ | ------------------------------------------------------ | | @keyword.directive | keyword.control.directive.{rx,dispense,signa}.recipe | | @keyword.repeat | keyword.other.frequency.recipe | | @keyword (timing) | keyword.other.timing.recipe | | @function.macro | support.function.route.recipe | | @attribute | entity.other.attribute-name.recipe | | @keyword.error | invalid.illegal.warning.recipe | | @type (form) | storage.type.form.recipe | | @keyword.operator | keyword.operator.{compounding,fill,dtd}.recipe | | @keyword.conditional | keyword.control.conditional.recipe | | @number | constant.numeric.recipe | | @type.builtin (unit) | support.type.unit.recipe | | @variable (ingredient) | variable.other.ingredient.recipe | | @string (signa) | string.unquoted.signa.recipe | | @comment | comment.{line.number-sign,block}.recipe | | @comment.documentation | comment.{line,block}.documentation.recipe | | @punctuation.delimiter | punctuation.separator.recipe |

Layout

recipe-tmlanguage/
├── bin/
│   └── recipe-tmlang.ts    # DreamCLI entry — `recipe-tmlang generate|verify`
├── src/
│   ├── grammar.ts          # pure: vocab → TextMate grammar object
│   └── verifier.ts         # pure: tokenize fixtures, check scope assertions
├── recipe.tmLanguage.json  # generated grammar (the main export)
└── recipe.tmLanguage.ts    # typed re-export of the JSON

Install

bun add recipe-tmlanguage        # or: npm install recipe-tmlanguage

The grammar is pre-generated in the package — no build step for consumers.

Develop

tree-sitter-recipe is a regular npm dependency now, so a plain install is all the setup there is:

bun install
bun run generate     # rebuild recipe.tmLanguage.json
bun run verify       # check scopes against the upstream fixtures

CLI

Powered by DreamCLI — no hand-rolled argparse.

npx recipe-tmlanguage --help   # or: bunx recipe-tmlanguage --help

generate

npx recipe-tmlanguage generate                    # → recipe.tmLanguage.json
npx recipe-tmlanguage generate --out foo.json     # custom path
npx recipe-tmlanguage generate --indent 2 --quiet # 2-space indent, silent
npx recipe-tmlanguage generate --json             # machine-readable on stdout

verify

Tokenizes every fixture in tree-sitter-recipe/test/highlight/ with vscode-textmate + vscode-oniguruma (the same engine Shiki wraps) and asserts the scope at each caret marker matches the tree-sitter capture. Fixtures and the Oniguruma WASM are located via package exports — no relative paths to maintain.

npx recipe-tmlanguage verify
npx recipe-tmlanguage verify --json           # { pass, total, failures[] }
npx recipe-tmlanguage verify --max-failures 0 # print every failure

Current status: 149 / 149 fixture assertions pass.

Use with Shiki

Don't register the raw JSON yourself — its grammar name is Recipe, which won't match a lang: "recipe" lookup. Reach for recipe-shiki instead: it wraps this grammar in a LanguageRegistration with the canonical lang recipe (and alias rx).

For any other vscode-textmate host, load recipe.tmLanguage.json directly — grammar name Recipe, scope source.recipe. The scopes are standard TextMate, so any theme paints recipe blocks immediately.

License

MIT © Kaj Kowalski