In v3, EntityEncoder no longer includes a default entity set.
If you pass no options and encodeAllNamed is true (the default), the constructor will throw an error:
const enc = new EntityEncoder(); // throws: "encodeAllNamed is true but no `namedEntities` was provided"
How to update
What you need
v2 code
v3 code
Full built‑in set (same as v2)
new EntityEncoder()
import { ALL_ENTITIES } from '@nodable/entities'; new EntityEncoder({ namedEntities: ALL_ENTITIES })
Only XML‑unsafe chars (no named entities)
new EntityEncoder({ encodeAllNamed: false })
Same – no change
Custom subset
new EntityEncoder({ namedEntities: myMap })
Same – but now your map is required for named‑entity encoding
This change allows bundlers to tree‑shake unused entity categories – you only pay for the characters you actually encode.
Upgrading step‑by‑step
Update to @nodable/entities@3.0.0.
Find all new EntityEncoder() calls in your project.
Decide:
If you need the full set: import ALL_ENTITIES and pass it as namedEntities.
If you only need XML‑unsafe escaping: add { encodeAllNamed: false }.
If you used a custom set: keep it as‑is – it already worked.
Run your tests – the encoder should now behave as before, but with better bundle size.