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

napi-rs-cn-font-split

v1.0.1

Published

napi-rs binding for cn-font-split: subset/split CJK fonts into unicode-range woff2 chunks

Downloads

841

Readme

napi-rs-cn-font-split

CI

A napi-rs binding for cn-font-split — a font subsetter/splitter that breaks large CJK fonts into many small, unicode-range-keyed woff2 chunks so the browser only downloads the glyphs a page actually renders.

Why this exists

Upstream cn-font-split ships a JS-only npm package and downloads its native Rust binary from GitHub Releases at install/first-use time. That download isn't pinned to the package version, isn't integrity-checked, and isn't atomic — a partial download silently breaks dlopen later.

This package wraps the same upstream Rust library with napi-rs instead, so the native binary is distributed the standard npm way: prebuilt per-platform .node addons published as optionalDependencies, version-locked to the JS package, integrity-hashed in your lockfile, and installed offline-cacheably. HarfBuzz is built from source and linked statically, so each addon is self-contained (no system libharfbuzz required).

Install

npm install napi-rs-cn-font-split

Prebuilt binaries are published for: macOS (arm64, x64), Linux gnu (arm64, x64), Windows msvc (arm64, x64).

Usage

The binding mirrors the upstream protobuf contract: pass a protobuf-encoded InputTemplate, receive each streamed EventMessage back as a protobuf-encoded Buffer, in emission order.

import { fontSplit } from 'napi-rs-cn-font-split'

// `input` is a protobuf-encoded cn-font InputTemplate (field 1 = the ttf/woff2 bytes).
const events: Buffer[] = fontSplit(input)
// Decode each Buffer as an EventMessage. OUTPUT_DATA events carry { message: filename, data }
// for each woff2 chunk / css / reporter; the final event is END.

See __test__/index.spec.ts for a minimal hand-rolled encode/decode example.

Development

yarn install
yarn build        # builds the .node addon (compiles bundled HarfBuzz on first run)
yarn test         # ava
yarn lint         # oxlint

The upstream Rust crates are pinned to a specific git rev in Cargo.toml. HARFBUZZ_SYS_NO_PKG_CONFIG is set in .cargo/config.toml so local builds bundle HarfBuzz the same way CI does.

Releasing

CI publishes to npm when the latest commit message is a bare semver (e.g. 1.0.0):

yarn version          # bumps version, runs `napi version`
git commit -am "1.0.0"
git push

Requires an NPM_TOKEN repository secret.