npm / pinyin-pro
pinyin-pro
What changed in pinyin-pro 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
2 new APIs and options19 performance5 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initpinyin-pro 326 changes
New APIs and options 2
Supports continuous third-tone sandhi, enabled with thirdTone, while preserving the compatible semantics of the existing toneSandhi boolean.
Adds a mode for recognizing traditional Chinese characters.
Performance 19
Optimizes node lookup and queue processing during AC automaton construction.
Merges consecutive custom pronunciation updates to reduce repeated custom dictionary builds.
Uses backtracking pointers to reconstruct match paths, reducing array allocations during matching.
Optimizes prefix matching to reduce unnecessary string processing.
Reuses already-split text characters to avoid splitting them repeatedly.
Reuses final parsing results to reduce repeated computation in type: 'all' mode.
Optimized repeated computation in the DP process and reduced memory usage.
In Node, no longer prebuilds the AC automaton through
setTimeout, further reducing import overhead.Skips the repeated-character processor when text does not contain 々, contributing to a reported 20%+ performance improvement.
Avoids prefix string allocation when building the AC automaton, improving segmentation performance.
Reuses child-node lookups during AC matching to improve segmentation performance.
Uses backtracking pointers to reconstruct the maximum-probability path, improving segmentation performance.
Uses a native split fast path for BMP text.
Reuses parsed final across all output modes, improving pinyin API performance.
Reuses split characters across multiple middleware.
Delays building the Aho-Corasick automaton to reduce main-thread blocking when importing pinyin-pro.
Optimizes repeated computation in middlewareMultiple.
Adjusted ESM packaging so tree shaking includes only necessary code, reducing bundle size across APIs.
Reduced the ESM tree-shaken bundle size for the match API from 306.81 KB (gzip 134.49 KB) to 185.44 KB (gzip 80.79 KB).
Fixes and other changes 5
Compatible with restrictions in runtimes such as Cloudflare Workers that disable timers during module initialization.
Prevents pattern from accumulating duplicate entries during updates.
Avoids splitting pinyin for non-polyphonic characters.
Fixes incomplete removal of non-Chinese characters with nonZhScope.
Corrects the dictionary pronunciation of 行长 from háng cháng to háng zhǎng.