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

@doxi/docx

v0.11.0

Published

Doxiva DOCX (OOXML) exporter and importer — zero runtime deps.

Downloads

43

Readme

@doxi/docx

DOCX (OOXML) export and import for Doxiva. Zero runtime dependencies — hand-written ZIP reader/writer, hand-written OOXML builder, hand-rolled XML parser with a DOMParser fast path.

Status: v0.10.x preview. Round-trips Doxiva-authored DOCX losslessly within the supported schema subset; foreign docs (Word / LibreOffice / Google Docs export) come in best-effort with explicit warnings.

Install

pnpm add @doxi/docx @doxi/core

Export

import { exportDocx } from '@doxi/docx'

const bytes: Uint8Array = exportDocx(doc) // pure function. Deterministic output.
// Save to disk, send to server, trigger a browser download — your call.

Pure function: no DOM, no view state, no IO. Deterministic byte output, suitable for golden-file snapshots.

Import

import { importDocx } from '@doxi/docx'

const { doc, warnings } = await importDocx(bytes)
// warnings: ImportWarning[] — surface in your UI
view.dispatch(view.state.tr.replace(0, view.state.doc.content.size, doc))

Async because ZIP decompression goes through the platform DecompressionStream (Web Streams). Returns a Doxiva document tree plus structured warnings for anything the importer couldn't handle.

Supported schema subset

Paragraphs (alignment + line height), headings, lists (bullet + numbered, multiple instances), tables (incl. colspan/rowspan + header rows), text with bold/italic/underline/color/font-size/font-family marks, hyperlinks, horizontal rule, forced page break, blockquote.

Self-round-trip guarantee

@doxi/docx ships a property-test harness (fast-check) with 200 runs per arbitrary across 5 arbitraries (1000 runs total). Every generator round-trips through importDocx(exportDocx(doc)) and asserts deep equality against the input.

Honest deferrals

  • Imagesword/media/ binaries and image*.xml rels are read past silently; no image nodes materialize yet.
  • page_var field codes (PAGE, NUMPAGES) — exported as literal placeholder text; imported as literal text.
  • Multi-section documents — only the body's first <w:sectPr> is considered.
  • Headers / footers from header*.xml / footer*.xml parts are not yet wired into the imported pageMeta.
  • Track changes / comments / footnotes — ignored.
  • DEFLATE compression — exports are ~2-3× the size of typical .docx. Word reads them without complaint.

Security

importDocx rejects <w:hyperlink> targets matching javascript:, vbscript:, and non-image data: URLs. An 'unsafe-content' ImportWarning is emitted so the host UI can surface "1 unsafe link was removed". See docs/security-review.md.

License

MIT