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

@typeflowjs/converters

v0.0.1

Published

Typeflow converters as a native Node.js addon, written in Rust

Readme

@typeflowjs/converters

Converts mapping files written in other JSON mapping languages into Typeflow's own .typeflow syntax, so an existing codebase can move onto Typeflow without hand-rewriting every mapping by hand. Implemented natively in Rust and exposed as a Node.js addon (.node, via napi-rs) behind a typed TypeScript wrapper; covered by cargo test unit tests on the Rust conversion logic itself (parser → emit → formatter, per source language, plus the parallel batch entry points).

API

import {
  convertJq,
  convertJqBatch,
  convertJsonata,
  convertJsonataBatch,
  formatTypeflow,
  typeFromSample,
} from '@typeflowjs/converters';

convertJq('{ id: .id, name: .user.name }');
// → { ok, typeflow, notes, errors }

// The batch entry points convert many sources in one native call, in
// parallel across CPU cores (Rust/rayon) — use these for multi-file work
// instead of looping over a single-source conversion function one file at
// a time.
convertJqBatch(['{ a: .x }', '{ b: .y }']);
// → ConvertResult[]

Build

Requires Bun and a Rust toolchain (edition 2021).

bun run build   # napi build --platform --release (host target only),
                # then Bun.build bundles index.ts → dist/ (ESM + CJS)
cargo test      # Rust unit tests: conversion logic, formatter, sample
                # types, batch entry points — no build step needed first

Published npm releases cover more than the host platform: .github/workflows/release.yml cross-builds a matrix of targets (win32-x64, darwin-x64, darwin-arm64, linux-x64-gnu today — see napi.triples.additional in package.json) via @napi-rs/cli, and ships each as its own optionalDependencies package (e.g. @typeflowjs/converters-win32-x64-msvc) so npm install only pulls the one matching the consumer's platform. index.ts's loader tries that platform package first, falling back to a local .node file for the bun run build dev loop above.

Layout

| Path | Role | | ------------------ | ------------------------------------------------------------ | | index.ts | Typed wrapper: loads the addon, adapts the TS option shape | | scripts/build.ts | Bun build script (cargo + Bun.build ESM/CJS) | | src/tf/ | Rust: Typeflow lexer, parser, AST, canonical formatter | | src/jq/ | Rust: parser, input-type inference, and emission for one supported source language | | src/jsonata/ | Rust: parser, input-type inference, and emission for another supported source language | | src/sample.rs | Rust: typeFromSample (JSON sample → inline type) | | src/util.rs | Rust: JS-compatible number formatting, JSON quoting |

Parity notes: number formatting reproduces ECMAScript String(number) (shortest round-trip plus ECMA-262 exponent layout), string quoting matches JSON.stringify, inline-width decisions in the formatter measure UTF-16 lengths like JS String.length, and object-key iteration preserves insertion order (serde_json preserve_order).