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

@betteroffice/docx

v0.1.0

Published

Word-faithful DOCX editor and viewer core — full OOXML fidelity, real-time human + AI agent collaboration. Framework-agnostic (Rust/Wasm).

Readme

@betteroffice/docx

Framework-free core for the BetterOffice DOCX editor — the Rust engine (OOXML parse/serialize, CRDT editing core, text shaping, pagination) compiled to WebAssembly, plus the display-list, canvas-render, geometry, and accessibility helpers the adapters build on. Layout never touches the DOM: the engine measures every line and pages are replayed onto canvas.

Early (0.0.x). The core surfaces — opening/saving documents, the editor components, collaboration — are settling and unlikely to change shape. Smaller APIs may still move between releases; breaking changes are always listed in the changelog.

bun add @betteroffice/docx

Most apps want the turnkey React component in @betteroffice/docx-react. Reach for this package directly for headless parsing/serialization or when building a custom adapter.

Parse and save

A full round trip: open a .docx, inspect the typed model, write bytes back.

import { readFile, writeFile } from 'node:fs/promises';
import { parseDocx, repackDocx } from '@betteroffice/docx/docx';

const document = await parseDocx(await readFile('contract.docx'));
// document.package: body, styles, numbering, theme, media, headers/footers

const bytes = await repackDocx(document);
await writeFile('contract-out.docx', Buffer.from(bytes));

repackDocx round-trips against the original buffer so untouched parts are preserved; use createDocx for documents built from scratch.

The engine ships as four wasm assets (container, parser, layout, editing core) in dist/generated/. Browsers fetch them lazily behind the async entry points (parseDocx, save, the layout engine, createYrsSession); Node and Bun read them from disk synchronously on first use. No manual init call is required.

Collaboration

Connect the editor's Yrs replica to any reliable binary transport:

import { CollaborationProvider } from '@betteroffice/docx/collaboration';

const provider = new CollaborationProvider(replica, createTransport(), {
  user: { name: "Ada" }, // identity for this peer's remote caret
});
provider.connect();

replica can be a direct YrsSession, the worker-aware adapter returned by createWorkerCollaborationReplica, or the value published by the React editor's collaboration.onReplica callback. The provider speaks Yjs sync-v1; room routing, authentication, awareness, and reconnection policy remain transport concerns. Pass a persisted Yrs update as collaboration.initialUpdate when a React editor joins an existing room so it hydrates the shared history instead of independently importing the same DOCX.

Development

The generated .wasm binaries are intentionally not committed. From the repository root, install wasm-pack 0.15.0 and binaryen, then run bun run build:docx-wasm. Package builds, demo startup, and CI run this step automatically.

Docs: https://betteroffice.dev · Apache-2.0.