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

@greffon/capture

v0.1.1

Published

Greffon's shared subset validator, free-variable analysis and tree serializer (the one shared brain).

Readme

@greffon/capture

The shared analysis core of Greffon, expression trees for TypeScript: the subset validator, the free-variable analysis, and the tree serializer, implemented once. The build transform, the runtime fallback, the TypeScript language-service plugin, and the ESLint rules all run this same code, so the editor, the build, and the lint agree on what is legal.

Apps get this package transitively through those hosts. Depend on it directly to build a capture host or adapter of your own, or to read the diagnostics catalog. Its only runtime dependency is @greffon/tree; it ships no parser — each host hands it an already-parsed ESTree arrow node.

Install

npm install @greffon/capture

Usage

import { adapterOxc, capture } from "@greffon/capture";

// `arrow` is the ESTree node your parser produced for `u => u.age > minAge`
// (oxc-parser and meriyah pair with adapterOxc; TSESTree with adapterTsestree):
const result = capture(arrow, adapterOxc);

result.params; // ["u"]
result.freeVars; // ["minAge"] — what the emitted scope() thunk must close over
result.body; // the serialized tree, or null when a diagnostic is an error
result.diagnostics; // [] here; `u => u.id == 1` would yield R1103, with a span

API

  • capture(arrow, adapter, options?): validate an arrow against the subset grammar, resolve parameter vs free-variable references, and serialize to a tree, in a single walk. Returns { params, body, freeVars, diagnostics } (CaptureResult); options.globals extends the safelist.
  • adapterOxc / adapterTsestree (with the AstAdapter and EsNode types): the parser seam. Capture reads standard ESTree properties; an adapter abstracts only what differs between parsers, chiefly source spans.
  • DIAGNOSTICS, makeDiagnostic, hasErrors, docsAnchor (types Diagnostic, DiagnosticSpec, Severity): the catalog behind every Rxxxx code — severity, message, and fix hint. The docs error reference is generated from it, and codes are append-only: never renumbered, never reused.
  • GLOBALS_SAFELIST: identifiers treated as globals (Math, Date, JSON, …) rather than free variables.
  • QUERY_METHODS: the query methods whose lambda arguments are traced; one list, so the build transform, the editor plugin, and the lint rules trace the same call sites.

Docs

License

MIT