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

@wingleeio/pretext-core

v0.1.4

Published

C++ JSI text engine for React Native — @chenglou/pretext's line breaker and pretext-native's font-table metrics, ported to native and exposed as synchronous JSI calls, plus the PretextBlockView single-view text block.

Downloads

838

Readme

@wingleeio/pretext-core

The pretext text engine as a C++ JSI module for React Native. It ports @chenglou/pretext (the line breaker and layout kernel) and @wingleeio/pretext-native (font-table advance metrics) to native C++, exposed as synchronous JSI calls via Nitro Modules. One codebase drives iOS and Android.

Why: on Hermes the JS engine spent ~2 ms per text node segmenting and measuring advances. In C++ that drops to tens of microseconds — measuring a whole 8,000 -block account becomes cheaper than hydrating a height cache. This is what lets mugen delete its persistent height/paint caches, the boot warmer, and the wormhole scroll on device. See mugen/NATIVE-TEXT.md.

Single import, two backends

import … from '@wingleeio/pretext-core' exposes the exact @chenglou/pretext (+ /rich-inline) function surface plus pretext-native's font registration API. It dispatches to:

  • native — the PretextCore Nitro HybridObject (C++ kernel), when installed;
  • JS fallback@chenglou/pretext + @wingleeio/pretext-native, byte-for -byte identical, on web and in tests.

So mugen's measure code keeps its call sites; only the import changes.

Conformance is the contract

The C++ kernel must produce byte-identical output to the TS engine running on pretext-native's polyfills (exactly what ships on Hermes today). pnpm test builds a host CLI (tools/fixture-runner) and drives both engines over the same ops — the full 18-language corpus, rich-inline, and every layout API — comparing each number with Object.is and each string with ===. This runs in CI (pretext-core-conformance). See PORTING.md for the porting rules that make this hold (UTF-16 everywhere, doubles not floats, -ffp-contract =off, the neutral engine profile, a hermetic segmenter instead of ICU).

Layout

  • cpp/pretext/** — the platform-independent kernel (segmenter, sfnt parser, analysis, line-break, layout, rich-inline, bidi) + generated Unicode tables.
  • cpp/{PretextCoreModule,PreparedTextObject,PreparedRichInlineObject}.cpp — Nitro HybridObject implementations wrapping the kernel.
  • src/ — the JS wrapper (index.ts) + native locator (native.ts).
  • nitrogen/generated/ — Nitro codegen output (regenerate with npx nitrogen).
  • scripts/gen-unicode-tables.mjs, scripts/gen-bidi-data.mjs — table generators (run on Node so the Unicode data matches the TS \p{…} regexes).

Build

  • JS: pnpm build (tsdown → dist/).
  • Host kernel + conformance CLI: pnpm build:host (CMake; needs cmake).
  • iOS/Android: consumed as a Nitro module — pod install / gradle sync in the host app picks up PretextCore.podspec / android/build.gradle.