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

@particle-academy/last-word

v0.2.0

Published

Zero-dependency, isomorphic docx writer/reader for agentic word-processing documents — JSON model + markdown bridges. Sister to holy-sheet (xlsx) and dark-slide (pptx). The Node/TypeScript mirror of the PHP particle-academy/last-word.

Downloads

505

Readme

@particle-academy/last-word

Fancy UI suite

Zero-dependency, isomorphic (browser + Node) .docx writer + reader for agentic word-processing documents — a JSON document model with markdown bridges. The Node/TypeScript mirror of the PHP particle-academy/last-word. Sister to holy-sheet (xlsx) and dark-slide (pptx).

The point is the Editor round-trip: a WYSIWYG editor (react-fancy Editor) speaks markdown; Word speaks .docx. LastWord bridges the two through one JSON model — fromMarkdown → toBytes to export a real Word file, read → toMarkdown to import one — with no converter sandwich (mammoth/turndown/docx) in between.

import { Agent } from "@particle-academy/last-word";

// Markdown in…
const doc = Agent.fromMarkdown(`# Q3 Report

Revenue was **up 12%** — see the [dashboard](https://example.com).

- Wins
  - Enterprise renewals
- Risks
`);

// …Word file out.
const bytes: Uint8Array = Agent.toBytes(doc); // universal
await Agent.write(doc, "report.docx"); // Node only

// And back: .docx → model → markdown for the editor.
const imported = Agent.read(bytes);
const markdown = Agent.toMarkdown(imported);

The document model

A Doc is { title?, blocks }. Blocks are JSON-friendly discriminated unions — exactly what an agent emits:

| Block | Shape | | --- | --- | | heading | { type: "heading", level: 1-6, runs } | | paragraph | { type: "paragraph", runs, align? } | | list | { type: "list", ordered?, items: [{ runs, children? }] } (nesting ≥ 3 deep) | | table | { type: "table", rows: [{ header?, cells: [{ blocks }] }] } | | code | { type: "code", language?, text } | | quote | { type: "quote", blocks } | | image | { type: "image", src: "data:image/png;base64,…", widthPx?, heightPx?, alt? } | | pageBreak | { type: "pageBreak" } | | hr | { type: "hr" } |

A Run is an inline span: { text, bold?, italic?, underline?, strike?, code?, link?, color?, highlight? } (colors are #RRGGBB).

API

Agent (static) mirrors the PHP surface:

  • validate(doc) → structured errors {path, message}[] (empty = valid)
  • validateAndRepair(doc){ok, schema, errors} (coerces strings to runs, clamps heading levels, drops unknown block types with the error retained)
  • toBytes(doc)Uint8Array (universal, deterministic output)
  • write(doc, path){path, bytes, blocks} (Node only)
  • read(bytes) / fromBytes(bytes)Doc (universal; tolerates Word-authored files — outlineLvl headings, named highlights, unknown constructs degrade to paragraphs, never throw)
  • toMarkdown(doc) / fromMarkdown(md) → the Editor bridge (GFM: headings, **/*/~~, inline code, links, nested lists, tables, fenced code, blockquotes, images, ---)
  • describe(doc) → plain-text summary (title, block counts, word count)
  • jsonSchema() → JSON Schema for LLM tool-use
  • version() → package version

Markdown is lossy only where GFM has no syntax: underline / color / highlight decorations, paragraph alignment, image pixel sizes, and page breaks are dropped on toMarkdown; everything else round-trips.

Images are embedded from data URLs (PNG/JPEG); when widthPx/heightPx are omitted the intrinsic size is sniffed from the bytes (PNG IHDR / JPEG SOF) and capped at 6.5in width keeping aspect.

Cross-language parity

As of 0.2.0 the metadata slots match the PHP mirror exactly: the title is carried in docProps/core.xml (dc:title) and the code block language in a lastword:code:{lang} content-control tag (quotes use lastword:quote), so the same file opens in either engine — title and code language round-trip Node ↔ PHP in both directions. Files written by PHP 0.1.x (Title-styled paragraph, LastWordCode_{lang} bookmark) still read fine; the sibling repo's canonical fixture is frozen into each test suite as a cross-read vector.


⭐ Star Fancy UI

If this package is useful to you, a quick ⭐ on the repo really helps us build a better kit. Thank you!