Releases: reactnativecn/node-hdiffpatch
Releases · reactnativecn/node-hdiffpatch
Release list
v2.4.0
Safety hardening
- Transactional file outputs: all file-based diff/patch APIs (and the
hdpCLI) write to an exclusively-created temp file and atomically rename it over the destination only after verification succeeds. Failures remove the temp file and never touch an existing destination. In-place operation (output path == input path, including hard-link/symlink aliases) is now safe and supported. - Patch resource limits:
patch(),patchStream(),patchSingleStream()accept{ maxOutputBytes, maxWorkingMemoryBytes }and enforce finite defaults (2 GiB in-memory / 16 GiB file output, 256 MiB working memory). Corrupt or malicious patch headers are rejected before any allocation or output-file creation. - Async input ownership: async
diff()/patch()copy their buffer inputs before queueing; mutating, transferring, or detaching the source buffers after the call can no longer corrupt results. DataViewinputs are now accepted;windowSizevalues aboveNumber.MAX_SAFE_INTEGERare rejected (previously undefined behavior).- Prebuild load errors are preserved as
err.causewhen the fallback loader also fails.
CI / packaging
- Per-platform smoke test of the packed npm tarball (loads from
prebuilds/only). - Linux prebuilds are rejected if they require glibc symbols above 2.34 (the baseline since v2.3.0; compatible with Ubuntu 22.04 / Debian 12 / RHEL 9).
- Full test suite now also runs on Node 14.17 (the declared engines floor).
- README platform list corrected to the actually published targets: darwin-arm64, linux-x64, linux-arm64.
Dependencies
Updated to latest: node-gyp-build 4.8.4, node-addon-api 8.9.1, node-gyp 13.0.1, prebuildify 6.0.1, @types/bun 1.3.14.
v2.3.0
Add optional, bounded LZMA2 match-finder multithreading with deterministic byte-identical output. The default remains one thread; compression level 9 and the 8 MiB dictionary are unchanged. Published prebuilds target Linux x64/arm64 and macOS arm64.
v2.2.2
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