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

@sofa-buffers/generator

v0.20.0

Published

SofaBuffers code generator (sofabgen) — generate typed serialization code from a message definition. The prebuilt Go binary is delivered as a per-platform optional dependency.

Downloads

502

Readme

@sofa-buffers/generator

sofabgen — the SofaBuffers code generator. It compiles a message definition (YAML/JSON) into typed encode/decode wrappers for your target language. Install it as a project-local dev dependency — no global install and no Go toolchain required.

Package name vs. command: the package is @sofa-buffers/generator, but the CLI command it installs is sofabgen — the same split as @angular/cling or typescripttsc. Install the package; run sofabgen.

Install

npm install --save-dev @sofa-buffers/generator

Usage

Generate code from a message definition:

npx sofabgen --lang typescript --in messages/example.yaml --out src/generated/

Or wire it into package.json scripts so codegen is reproducible per project:

{
  "scripts": {
    "gen": "sofabgen --lang typescript --in messages/ --out src/generated/"
  },
  "devDependencies": {
    "@sofa-buffers/generator": "^0.19.7"
  }
}

Key flags:

  • --lang <target> — one of c, cpp, csharp, docs, go, java, python, rust, typescript, zig.
  • --in <path> — a message-definition file, or a directory of them.
  • --out <dir> — where the generated code is written.
  • --version prints the version; --help lists every flag.

Runtime dependency: @sofa-buffers/corelib

sofabgen is a build-time tool — it emits typed code but never touches wire bytes itself. The generated code calls into a small per-language runtime library ("corelib") that owns the wire format. So, alongside the generator as a dev dependency, your project needs the corelib for your target language as a runtime dependency.

For the TypeScript / JavaScript target that is @sofa-buffers/corelib — the generated code imports from it:

npm install @sofa-buffers/corelib
{
  "dependencies": {
    "@sofa-buffers/corelib": "^0.8.1"
  },
  "devDependencies": {
    "@sofa-buffers/generator": "^0.19.7"
  }
}

Generating in project mode emits a ready-to-build package that already lists @sofa-buffers/corelib for you. For any other target language, install that language's corelib in its own ecosystem (Cargo, Go modules, NuGet, Maven, …).

How the binary is delivered

sofabgen is a single static Go binary. This package is a tiny launcher; the binary ships in a per-platform optional dependency (@sofa-buffers/generator-<os>-<arch>, the esbuild / swc model). On install, npm reads each optional dependency's os/cpu and installs only the one that matches your host; the launcher then execs it.

No download, no postinstall, no extra runtime dependency for the generator itself — it works offline, in CI, and with --ignore-scripts; the binary is integrity-hashed in your lockfile and reproducible with npm ci, and it is cached by corporate npm proxies (Artifactory / Verdaccio) rather than re-hitting GitHub.

--omit=optional caveat: installing with --no-optional / --omit=optional skips the binary, and the launcher then prints a clear error. This is the one tradeoff of the optional-dependency model.

Links

  • Source & documentation: https://github.com/sofa-buffers/generator
  • Runtime library (TypeScript): https://www.npmjs.com/package/@sofa-buffers/corelib

MIT licensed.