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

@hwp-editor/core

v1.2.0

Published

Framework-free core for hwp-editor: engine interface, typed hwp edit ops, segments, spec types, editor state.

Readme

@hwp-editor/core

The framework-free core of hwp-editor: the HwpEngine contract every document operation flows through, the typed hwp edit op grammar, segment coordinate math, generated spec types, and the editor state store. It has zero runtime dependencies and deliberately contains no React, no Node-only APIs, and no HWP parsing of its own: platform functions (fetch, invoke) are injected rather than imported, so the same build runs in a browser, in Node, and in a Tauri webview. The UI lives in @hwp-editor/react and the binary-spawning adapter in @hwp-editor/server.

Install

pnpm add @hwp-editor/core

Most hosts do not install this directly: it arrives as a peer of @hwp-editor/react and @hwp-editor/server, deduped to a single copy. Add it explicitly only when your own source imports from it — createHttpEngine and the DocumentHandle type being the usual reasons — because a strict node_modules layout does not expose an automatically installed peer to the application.

Usage

import { createHttpEngine, opsToArgv, createStore } from "@hwp-editor/core";

const engine = createHttpEngine("/api/hwp-editor");
const { data } = await engine.read(document);

Pick a transport (createHttpEngine or createTauriEngine), or implement HwpEngine yourself. Host code changes only the factory call; nothing else in this package or in @hwp-editor/react knows which transport is in use.

Reference

| Export | Type | Notes | | ------ | ---- | ----- | | HwpEngine | interface | The six-method document contract: read, render, edit, compose, validate, capabilities. Everything else here exists to build arguments for it or to interpret its results. | | HwpEngineError, HwpErrorCode | class + union | The error every transport throws, carrying a stable code a host can branch on. isHwpEngineError narrows an unknown catch value; toHwpErrorCode maps a wire code. | | EditOp, opsToJson, opsToArgv, argvToOps, OP_FLAGS | union + functions | Type-safe mirror of every hwp edit op, pinned to the hwp-cli contract. opsToJson serializes an op list to the published edit-ops-v1 JSON the CLI engine passes to hwp edit --ops; opsToArgv/argvToOps are the separator-delimited argv form the tauri host still crosses with, so a queue survives a round trip. | | parseCatEnvelope, offsetToRef, segmentAtRef, segmentText | functions | Pure helpers over the hwp cat --with-segments --segments v2 envelope. They bridge rendered markdown offsets and the stable {section, para} source coordinates EditOp targets. | | DocumentSpecV2, TemplateSpecV1, TemplateDataV1 | types | Generated from the frozen JSON schemas in schemas/. These are the compose inputs; regenerate with pnpm gen:types after a schema change. | | createStore, reducer, initialState | functions + value | Framework-free reducer store holding the document, pending ops, undo snapshots and status. React hosts bind it with useSyncExternalStore; others wrap it in their own reactivity. | | createHttpEngine, createTauriEngine | factories | The two shipped transports. Both return an HwpEngine and both send the same JSON, so they are interchangeable. |

Develop

pnpm install
pnpm -r build
pnpm -r test
pnpm -r typecheck