The exact same exports as @exodus/bytes/encoding.js are also exported as
@exodus/bytes/encoding-lite.js, with the difference that the lite version does not load
multi-byte TextDecoder encodings by default to reduce bundle size 10x.
The only affected encodings are: gbk, gb18030, big5, euc-jp, iso-2022-jp, shift_jis
and their labels when used with TextDecoder.
Legacy single-byte encodingds are loaded by default in both cases.
TextEncoder and hooks for standards (including labelToName / normalizeEncoding) do not have any behavior
differences in the lite version and support full range if inputs.
To avoid inconsistencies, the exported classes and methods are exactly the same objects.
> lite = require('@exodus/bytes/encoding-lite.js') [Module: null prototype] { TextDecoder: [class TextDecoder], TextDecoderStream: [class TextDecoderStream], TextEncoder: [class TextEncoder], TextEncoderStream: [class TextEncoderStream], getBOMEncoding: [Function: getBOMEncoding], labelToName: [Function: labelToName], legacyHookDecode: [Function: legacyHookDecode], normalizeEncoding: [Function: normalizeEncoding] } > new lite.TextDecoder('big5').decode(Uint8Array.of(0x25)) Uncaught: Error: Legacy multi-byte encodings are disabled in /encoding-lite.js, use /encoding.js for full encodings range support
The exact same exports as
@exodus/bytes/encoding.jsare also exported as@exodus/bytes/encoding-lite.js, with the difference that the lite version does not load multi-byteTextDecoderencodings by default to reduce bundle size 10x.The only affected encodings are:
gbk,gb18030,big5,euc-jp,iso-2022-jp,shift_jisand their labels when used withTextDecoder.Legacy single-byte encodingds are loaded by default in both cases.
TextEncoderand hooks for standards (includinglabelToName/normalizeEncoding) do not have any behavior differences in the lite version and support full range if inputs.To avoid inconsistencies, the exported classes and methods are exactly the same objects.