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

@hwpdf/engine

v0.2.0

Published

HWP/HWPX parsing, layout and SVG rendering engine for hwpdf — patched rhwp (Rust→wasm) with Hancom-fidelity pagination fixes, bundled wasm, zero CDN dependency.

Downloads

520

Readme

@hwpdf/engine

HWP/HWPX 파싱·레이아웃·SVG 렌더링 엔진 — 패치본 rhwp(Rust→wasm, MIT)에 한컴 오피스 실측 정합 페이지네이션 보정(사이클 #3~#14)을 적용해 동봉합니다. wasm 자체호스팅 — CDN 의존 0.

npm i @hwpdf/engine

사용

import { initEngine, openDocument, documentToSvgs } from "@hwpdf/engine";

const mod = await initEngine();            // 동봉 wasm 로드(1회)
const doc = await openDocument(bytes);     // HWP 5.x / HWPX 자동 판별
const svgs = documentToSvgs(doc);          // 페이지별 자기완결 SVG
doc.free();

raw 표면 (rhwp 17표면 보존)

initEngine()이 반환하는 모듈은 rhwp wasm-bindgen 표면 그대로입니다 — new HwpDocument(bytes)(무효 입력 throw 동작 불변), pageCount(), renderPageSvg(p), getPageTextLayout(p), getPageControlLayout(p), getPageDef(s), getDocumentInfo(), getValidationWarnings(), getTableDimensions(s,p,c)(비표 throw 유지), reflowLinesegs(), searchText(...), extractThumbnail(bytes), version(), initSync, init_panic_hook, free(). 검사: node test/parity-17.mjs(소스 체크아웃).

wasm 주입 (계약 1)

await initEngine({ module_or_path: new URL("…/rhwp_bg.wasm", import.meta.url) }); // URL
await initEngine({ module_or_path: wasmBytes });                                   // 바이트

미지정 시 동봉 dist/rhwp_bg.wasm. 정본(무패치) rhwp wasm을 주입하면 동작은 비보증 — 본 패키지의 레이아웃 충실도는 동봉 패치 빌드가 전제입니다(보정 목록: RELEASE-NOTES.md).

에러 (계약 3 — err.name 판별)

| name | 의미 | |---|---| | EncryptedDocument | 암호화(배포용 DRM) 문서 — ODF encryption-data 사전탐지 | | ParseError | 손상·미지원 형식 | | AssetMissing | wasm/자산 미발견 | | ConvertError | 변환 단계 실패(@hwpdf/pdf) |

raw new HwpDocument의 자체 throw 거동은 불변 — openDocument() 헬퍼가 위 분류를 더합니다.

COEP (계약 4)

SharedArrayBuffer 불요·Worker 미사용(단순성 우선). renderPageSvg는 외부 페치 참조 없는 자기완결 SVG. cross-origin isolated 환경에서 추가 설정 없이 동작합니다.

브라우저

Node·브라우저 겸용 — 정적 node: import 없음(전부 isNode 게이트 뒤 지연 로드). 브라우저에선 동봉 dist/rhwp.js(wasm-bindgen web)를 번들하고 wasm 은 번들 상대 URL 로 fetch 하거나 initEngine({ module_or_path }) 로 직접 주입합니다(자체호스팅 권장 — CDN 0).

주의: reflowLinesegs()

저장된 레이아웃(lineseg — 한컴 정합의 원천)을 파기하고 재배치합니다(실측: 일부 문서 65→74쪽). 편집 후 재배치 전용 — 원본 뷰잉 경로에서 호출하지 마세요. 이중 호출은 무해(2회차 레이아웃 불변).

라이선스

MIT. rhwp(MIT) 파생 — NOTICE 참조. 패치 정본: 저장소 packages/pdf/vendor/*.patch.