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/transform

v0.1.1

Published

Greffon's pure per-module build transform: import tracing, expression-position detection, tree splicing.

Readme

@greffon/transform

The build transform of Greffon, expression trees for TypeScript, as a pure per-module function. It parses a module with oxc-parser, finds query lambdas at traced call sites and in expr() wrappers, validates them against the expression subset, and reifies each into __expr({...}) — the tree inlined as a plain object, the original lambda kept as compiled.

This package is for embedding the transform in another build tool. Writing an app, use a host instead: @greffon/vite for Vite, Rollup, and Rolldown, or @greffon/ts-transformer for tsc-only builds. Both are thin hosts over this package; sharing it is what keeps the two paths agreeing on what is legal.

Install

npm install @greffon/transform

Usage

import { transformModule } from "@greffon/transform";

const result = await transformModule(code, "src/queries.ts");
// null when the module needs no change, else { code, map, diagnostics, count }

API

  • transformModule(code, id, options?, host?): the async text transform. A TransformHost (resolve + load) lets the bundler resolve contexts imported from other modules on demand.
  • transformModuleSync(code, id, options?, host?): the same for hosts that cannot await. A SyncTransformHost only resolves; pre-scan every module with scanModuleContexts to fill the registry first.
  • planModuleSync(code, id, options?, host?): the same detection as a ReifyPlan — a list of { start, end, replacement } edits in source coordinates, for hosts that edit an AST rather than text.
  • scanModuleContexts(code, id, options?): names bound to createContext() at a module's top level, no transform.
  • createRegistry(): the ContextRegistry a whole build shares so cross-module contexts resolve.
  • HOST_IMPORT: the import reified modules need — __expr from @greffon/core, aliased locally.
  • TransformOptions: packages (default ["@greffon/query"]), globals, emitSource (default true), registry.

The @greffon/transform/emit entry exports emitNode (render a tree as a JS object-literal expression) and offsetToLineCol on their own, without loading oxc-parser, which is a native binding.

Docs

License

MIT