Releases: reactnativecn/node-hdiffpatch
Releases · reactnativecn/node-hdiffpatch
Release list
v2.2.1
Fixes
- Compatibility: single-format (HDIFFSF20) diffs that store the payload raw (compression would expand it) no longer carry a stale
lzma2compressType label. Old decoders (HDiffPatch ~4.x, including react-native-update clients in the field) decide whether to decompress from the label alone and failed withhpatch error -4on such diffs — typically tiny diffs between near-identical bundles. Output is now byte-compatible with 1.x for this case. Applies todiff(),diffWindow(), anddiffSingleStream();diffStream(HDIFF13) was never affected.
Upgrade urgency: high if you generate update diffs with 2.0.3–2.2.0 — a small enough diff generated by those versions fails to apply on all deployed clients that predate the reader-side guard.
v2.2.0
Added
diffWindow(oldPath, newPath, outDiffPath[, windowSize][, cb]): optionalwindowSize(bytes, default 2MB) controls the sliding window over old data. Larger windows catch longer-distance content moves at roughly linear additional memory — useful when a bundle's sections move further than 2MB between versions.
v2.1.0
Added
diffWindow(oldPath, newPath, outDiffPath[, cb]): window/fast-match single-format generation — big covers from streaming block matching + suffix-string refinement inside a 2MB sliding window over old data. Match quality is close to in-memorydiff()while memory stays at the streaming tier.- Output is standard HDIFFSF20: applies via
patch(),patchSingleStream(), and all existing single-format apply sides (verified byte-exact against the legacy v3.1.1 client patch core). No consumer changes needed.
Benchmarks (vs diffSingleStream, block=64)
| pair | diffSingleStream | diffWindow | in-memory diff |
|---|---|---|---|
| 218KB Hermes HBC | 19,034 B | 4,920 B | 4,929 B |
| 100MB similar | 2,258 B | 455 B | — |
Peak RSS on the 100MB pair: ~27MB for both streaming modes.
v2.0.3
v2.0.2
v2.0.1
v2.0.0
Breaking Changes
- Removed
diffWithCovers. 该实验性 API 无消费方;移除后 HDiffPatch 子模块可直接跟踪纯上游(v5.0.1),不再携带自有补丁。
What's Changed
- Vendored HDiffPatch v3.1.1 → v5.0.1,lzma SDK → v26.02。同输入产物逐字节同级、diff 速度持平;patch 双向兼容已验证(老库产物 ↔ 新库应用)。
- 新增
diffSingleStream(oldPath, newPath, outDiffPath[, cb]):流式块匹配生成 single 格式(与diff()同格式)——生成端内存 O(匹配块),实测 100MB 输入仅 ~27MB RSS 增量;产物经旧版(v3.1.1)客户端 patch 内核逐字节验证可直接应用,存量客户端零升级即可受益。 - 关闭 v5 默认的 diff 进度打印,保持服务端 worker 日志干净。
Full Changelog: v1.3.0...v2.0.0
v1.3.1
Fixes
- Restore glibc ≥ 2.33 compatibility for the linux-x64/arm64 prebuilds. v1.3.0's prebuilds required GLIBC_2.38 (via
__isoc23_strtoull) and failed to load on Ubuntu 22.04, Debian 12, and all bookworm-based official Node Docker images. The uint64 string parser no longer usesstrtoull; accepted input grammar is unchanged (canonical decimal only, overflow rejected).
If you saw ERR_DLOPEN_FAILED: version GLIBC_2.38 not found after upgrading to 1.3.0, this release fixes it.
v1.3.0
New APIs
diffWithCovers(old, new, covers, options)— create standard hdiffpatch payloads from caller-provided cover lines, withreplace/merge/native-coalescemodes and optionaldebugCoversintrospectionpatchSingleStream(oldPath, diffPath, outNewPath[, cb])— file-level apply for single-compressed diffs produced bydiff()/diffWithCovers()
CLI
hdp patchnow auto-detects the diff format by header magic (HDIFF13/HDIFFSF20), so it can apply bothhdp diffoutput anddiff()/diffWithCovers()output
Platforms & packaging
- New prebuilds:
darwin-x64andwin32-x64(in addition todarwin-arm64,linux-x64,linux-arm64) - Robust native module loading: local dev build → per-platform prebuild → node-gyp-build fallback with a clear error on unsupported platforms
- Prebuilds-only install: the
installscript was removed (the published package ships no sources);engines.node >= 14.17declared - npm publish now includes provenance attestation
Hardening & tests
- Diff-declared sizes are validated before allocation (size_t truncation guard)
- Cover fields reject negative numeric strings ("-1" no longer wraps to UINT64_MAX)
- CI test matrix across 5 platforms under both Node and Bun runtimes; async callback paths, corrupt-diff error propagation, and CLI formats are now covered
🤖 Generated with Claude Code