Releases: ExodusOSS/bytes
v1.14.1
fix: ensure TextEncoder never returns pooled arrays
Previous implementation always ensured 0-offset Uint8Array (ret.byteOffset === 0),
but not that there is no data past the returned view (ret.byteLength === ret.buffer.byteLength).
This is now fixed.
This only affected Node.js-like platforms, as only there native buffers are pooled.
Full Changelog: v1.14.0...v1.14.1
v1.14.0
-
Fix
makeBase58check()Typescript types -
Add
sideEffectsconfigurationOnly
@exodus/bytes/encoding.jsexport has side-effects, and those side-effects are internal:It is documented to load multi-byte codecs for both this import and future (and previous)
/encoding-lite.jsimports, even if the current import does not use the provided TextDecoder.Both
/encoding.jsand/encoding-lite.jsare designed to return the exact same TextDecoder class and methods, and loading full implementation provides multi-byte encodings support everywhere.As
/encoding-lite.jscan be used as a global polyfill, the setup has to avoid polyfill conflicts if something loads/encoding.jsand then something else replaces it with/encoding-lite.js(or vice versa)The same mechanism is reused to keep
/whatwg.jsminimal by default, and only support multi-byte encodings if/encoding.jswas imported and loaded them at any point.This is not a new change, just documenting the existing behavior and exposing
sideEffectsconfiguration so that bundlers can optmize out other imports. -
Further bundle size optimizations
Full Changelog: v1.13.0...v1.14.0
v1.13.0
What's Changed
-
Bundle size reductions, especially for browsers
Under
browsermodule resolution target, we rely on browsers to have a working UTF-8 / UTF-16 / windows-1252 (latin1 subset)TextDecoderimplementation that doesn't have bugs when used without streaming and withignoreBOM: true, and aTextEncoderWhile browsers have bugs even in UTF-8, those bugs are related to streams and/or BOM processing, and that specific combination we use seems to be always robust.
In previous versions we already used native codepaths for those where possible and operated under the same assumption.
-
Disable hex/base64 performance optimization for Firefox >=133 <146
We used a guarded useragent check for those versions to prefer js fallback instead of native base64 / hex implementations, as native was slow before FF 146 (ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1994067 and linked issues)
As the usage of FF <146 diminished according to caniuse stats, this check is not worth it anymore.
This version removes that useragent check.
Those Firefox versions are still supported by the library, but now the native base64 / hex implementation is always used when available.
See 8cab29a for implementation details.
Full Changelog: v1.12.0...v1.13.0
v1.12.0
- Fix UTF-16 on platforms with present but broken native UTF-16 TextDecoder (e.g. workerd, see cloudflare/workerd#6028)
- Test in CI on workerd, xs and graaljs
Full Changelog: v1.11.0...v1.12.0
v1.11.0
What's Changed
- feat: add
/whatwg.jsandpercentEncodeAfterEncoding()in #37 - doc: add documentation on https://exodusoss.github.io/bytes
- fix:
utf16toStringLoose(Uint16Array)on Big-Endian hardware in #44
New Contributors
Full Changelog: v1.10.0...v1.11.0
v1.10.0
What's Changed
- Add TypeScript types for all entry points
- Test and accept
Uint8Array<SharedArrayBuffer>input - Add iso-2022-jp fatal encoder (in #36)
- Improve documentation
Full Changelog: v1.9.0...v1.10.0
v1.9.0
- Implement strict multi-byte encoders, except for
iso-2022-jpfor now - Add
/encoding-browser.jsto load only native lightweight TextDecoder/TextEncoder in browser bundles - Add
/index.jsexport with usage warning, mostly for IDEs - Switch
/base58check.jspeer dep (used on non-Node.js platforms) to@noble/hashesdirectly (previously@exodus/crypto) - Fix
legacyHookDecode()behavior on non-even (incomplete) UTF-16 byte length - Fix
utf16toString(uint16arr)on Big-Endian Node.js - Performance improvements in encoders and decoders
Full Changelog: v1.8.0...v1.9.0
v1.8.0
What's Changed
- feat: support
iso-8859-1,iso-8859-9,iso-8859-11encodings insingle-byte.js - feat:
latin1fromString,latin1toString - feat: types for
encoding.jsby @ajaymathur in #12 - feat: types for
encoding-lite.js - perf improvements for encodings
New Contributors
- @ajaymathur made their first contribution in #12
Full Changelog: v1.7.0...v1.8.0
v1.7.0
What's Changed
Features:
- Implement
TextDecoderStream/TextEncoderStream
Requires Streams to be either supported by the platform or polyfilled - Implement
createSinglebyteEncoder(only fatal mode for now)
Fixes:
- Fix a missing check for non-Latin1 chars in
fromBech32/fromBech32mon non-Hermes barebone engines
Node.js, browsers, other non-barebones and Hermes / React Native were not affected - Passing detached
ArrayBufferinstances toTextDecodershould return empty strings, not throw
Full Changelog: v1.6.0...v1.7.0
v1.6.0
TextDecoder performance improvements for non-Unicode encodings.
Full Changelog: v1.5.0...v1.6.0