npm / entities
entities
What changed in entities 3 to 9, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
11 breaking1 deprecations4 new APIs and options19 performance1 tooling4 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initentities 96 changes
Breaking changes 4
Encoding emits decimal numeric references and the shortest named aliases, changing outputs such as ü to ü and ℵ to ℵ.
escapeAttribute and EncodingMode.Attribute now also escape < and >, matching the latest HTML spec.
The deprecated export from entities/escape is removed; use String.prototype.codePointAt instead.
Streaming decoders now use HtmlEntityDecoder and XmlEntityDecoder without a decode table; htmlDecodeTree, xmlDecodeTree, and determineBranch exports are removed. Synchronous decoding APIs are unchanged.
Performance 2
The HTML bundle shrinks from 15.54 to 13.42 kB gzipped, the XML-only bundle from 0.92 to 0.84 kB gzipped, and import retains 29–32 kB less memory.
HTML decoding is 1.15–1.33× as fast across reported inputs, and mixed-reference XML decoding is 1.06–1.09× as fast, using cuckoo hashing instead of a trie.
entities 820 changes
Breaking changes 5
Default decoding preserves XML numeric code points such as
€, yielding U+0080 instead of€.XML numeric code points such as
€now yield U+0080 instead of€.Deprecated functions and polyfills have been removed, so code relying on them must be updated.
entities is now ESM-only, affecting how developers import and use the package.
The minimum supported Node.js version is now 20.19.0.
Deprecations 1
Use
String.prototype.codePointAtinstead ofgetCodePointfromentities/escape.
Performance 12
The full bundle is 19% smaller (18% gzipped), targeting ES2022.
Default decoding is 1.44× faster.
Decoding is 1.19× faster.
Decoding is 1.18× faster.
Decoding is 1.14× faster.
Decoding is 1.46× faster.
Default encoding is 2.46× faster for mostly ASCII 4 KiB prose, but takes about 6% longer on the short, dense benchmark input.
Encoding mostly ASCII 4 KiB prose is 2.46× faster; XML encoding takes about 6% longer on the short, dense benchmark input.
Encoding mostly ASCII 4 KiB prose is 2.46× faster.
Escaping is 1.23× faster.
Escaping is 1.33× faster.
Escaping is 1.49× faster.
Fixes and other changes 2
Preserves unterminated names such as
&Xi$, rather than incorrectly decoding them toÂ.Preserves interrupted references such as
¬in<, rather than incorrectly decoding them to¬in<.
entities 75 changes
Performance 3
The encoded HTML decode trie is 21% smaller, and the encoded table is 32% smaller, reducing internal data size.
The encode trie is stored as a string and parsed on load, decreasing its file size by 44%.
Bitmaps replace regex when identifying ASCII code points to encode, speeding up encodeHTML by about 1.6x.
Tooling 1
Test files are excluded from the published package.
Fixes and other changes 1
Fixes an issue that broke streaming for htmlparser2.
entities 63 changes
Breaking changes 1
Deep imports changed from entities/dist/decode.js to entities/decode; update existing imports. The same applies to escape.
Performance 1
Pure annotations were added to improve bundler tree shaking.
Fixes and other changes 1
entities is now available on JSR as well as npm.
entities 51 changes
Breaking changes 1
The lib directory was renamed to dist, so deep imports must be updated.
entities 42 changes
New APIs and options 2
The package is now available as both an ESM and a CommonJS module, allowing developers to use either module system.
Added a function implementing the escaping required by the HTML serializer algorithm.
entities 33 changes
New APIs and options 2
The exported function accepts an object with additional configuration options, making it easier to configure decoding.
The exported function accepts an object with additional configuration options, making it easier to configure encoding.
Performance 1
Encoding and decoding are faster; the notes report speedups of 2.1x and 2.9x, respectively.