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

girbind

v0.1.3

Published

Convert GObject Introspection (GIR) files into Node.js addons

Readme

girbind

Convert GObject Introspection (GIR) files into Node.js addons.

girbind reads a .gir file and emits a statically-typed Node.js binding: a C++ N-API addon, TypeScript declarations (.d.ts), and an ESM entry point that loads the compiled addon. GObject classes become real JS classes (with inheritance and instanceof), methods and properties are exposed, and GErrors are thrown.

Installation

npm install girbind

Building an addon also needs a C++ toolchain (CMake + a C++23 compiler), the target library's development files (its pkg-config module and headers), and the GIR file (usually shipped by the library's -devel/-dev package under /usr/share/gir-1.0/). cmake-js and node-addon-api are pulled in as needed.

Usage

girbind supports two workflows.

1. Consumer: generate bindings in your own project

Use this when you just want to call a library from your app. girbind tracks the libraries you add in a girbindDependencies field in your package.json, and build compiles them all into native/.

npx girbind add flatpak        # generate sources into girbind/flatpak/ and record the dep
npx girbind build              # compile every dependency into native/
npx girbind remove flatpak     # (or `rm`) delete sources and drop the dep

Then import the built binding:

import flatpak from './native/flatpak.js';

const [installation] = flatpak.getSystemInstallations(null);
for (const remote of installation.listRemotes(null)) {
	console.log(remote.getName(), remote.getUrl()); // remote instanceof flatpak.Remote
}

girbind add accepts any built-in package (run npx girbind add --help to list them). For a library girbind doesn't ship a config for, add an entry to girbindDependencies by hand — either a built-in name or an inline config:

{
	"girbindDependencies": [
		"flatpak",
		{
			"name": "gtk",
			"gir": "/usr/share/gir-1.0/Gtk-4.0.gir",
			"include": ["gtk/gtk.h"],
			"pkgConfig": ["gtk4"],
		},
	],
}

npx girbind build then generates any missing sources and builds everything.

2. Author: publish a bindings package

Use this when you maintain a standalone bindings package to publish to npm. generate writes the sources plus a per-directory CMakeLists.txt, and compile builds the addon.

npx girbind generate /usr/share/gir-1.0/Flatpak-1.0.gir \
	-o src -i flatpak/flatpak.h -p flatpak
npx girbind compile -o src --build-dir build

| Option | Meaning | | ---------------------------- | ----------------------------------------------------------------- | | -o, --outdir <dir> | where to write the generated .cc/.js/.d.ts/CMakeLists.txt | | -m, --module-name <name> | addon name (defaults to the GIR namespace, lowercased) | | -i, --include <header…> | extra C++ #includes for the target library | | -p, --pkg-config <module…> | pkg-config modules to link | | --build-dir <dir> | where compile places the built .node |

Run npx girbind --help (or <command> --help) for the full set of options.

Programmatic API

The GIR parser and generators are also exposed as a library:

import { parseGirFile, cxx, ts, js } from 'girbind';

const ns = parseGirFile('/usr/share/gir-1.0/Flatpak-1.0.gir');
const source = cxx.generate(ns, { moduleName: 'flatpak', includes: ['flatpak/flatpak.h'] });
const types = ts.generate(ns);
const entry = js.generate(ns, './flatpak.node');

Or generate all three files for a resolved dependency in one call with generatePackage(dep, dir).