document-bytes 1.10.1 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -132,11 +132,17 @@ declare class UndecodableTextError extends Error {
132
132
  */
133
133
  declare const TEXT_DECODE_CHUNK_CODE_UNITS: number;
134
134
  /**
135
- * Splits `codePoint` into one or two UTF-16 code units and pushes them onto `units`: the code point itself below the supplementary plane, a surrogate pair biased by {@link SURROGATE_BITS} and {@link LOW_SURROGATE_MASK} above it. Shared by every decoder here that can produce a code point outside the Basic Multilingual Plane — {@link decodeUtf32} for UTF-32's own scalar values, and decode-dbcs.ts's decoders for the WHATWG index tables' own supplementary-plane entries (Big5's CJK Compatibility Ideographs Supplement pointers, gb18030's final algorithmic range) — so the split happens in exactly one place rather than once per caller.
136
- * @param units - The code unit array to push onto, in place.
135
+ * A code unit accumulator threaded by reference into {@link appendCodePoint}, rather than the bare mutable array it wraps: the array itself is owned entirely by whichever decoder loop builds it, appended to hundreds or thousands of times per call, and this wrapper's own `units` property is not itself a primitive or callback, which is what keeps it out of scope for exadev/prefer-readonly-object-param (see this package's own eslint.config.ts, and PackageLintOptions.preferReadonlyParams in the workspace's shared eslint.shared.ts) the same way a bare `number[]` parameter is squarely inside exadev/prefer-readonly-array-param's.
136
+ */
137
+ interface CodeUnitSink {
138
+ readonly units: number[];
139
+ }
140
+ /**
141
+ * Splits `codePoint` into one or two UTF-16 code units and pushes them onto `sink.units`: the code point itself below the supplementary plane, a surrogate pair biased by {@link SURROGATE_BITS} and {@link LOW_SURROGATE_MASK} above it. Shared by every decoder here that can produce a code point outside the Basic Multilingual Plane — {@link decodeUtf32} for UTF-32's own scalar values, and decode-dbcs.ts's decoders for the WHATWG index tables' own supplementary-plane entries (Big5's CJK Compatibility Ideographs Supplement pointers, gb18030's final algorithmic range) — so the split happens in exactly one place rather than once per caller.
142
+ * @param sink - The code unit accumulator to push onto, in place.
137
143
  * @param codePoint - A Unicode scalar value in the range 0 to {@link MAX_CODE_POINT}.
138
144
  */
139
- declare function appendCodePoint(units: number[], codePoint: number): void;
145
+ declare function appendCodePoint(sink: CodeUnitSink, codePoint: number): void;
140
146
  /**
141
147
  * Converts a sequence of UTF-16 code units to a string in fixed-size chunks (see {@link TEXT_DECODE_CHUNK_CODE_UNITS}), shared by every decoder in this module and in decode-dbcs.ts so each collects code units into a plain array and calls this once at the end rather than concatenating a string one character at a time.
142
148
  * @param units - The code units to convert, in order.
@@ -238,4 +244,4 @@ interface JpegInfo {
238
244
  }
239
245
  declare function readJpegInfo(bytes: Uint8Array<ArrayBuffer>): JpegInfo;
240
246
  //#endregion
241
- export { BASE64_ENCODE_CHUNK_CHARS, ByteOrderMark, ByteReader, ByteWriter, DecodeTextOptions, DecodedText, DecodedTextConfidence, DecodedTextSource, DeflateLevel, InflateResult, JpegInfo, MAX_INFLATE_OUTPUT_BYTES, PNG_MAX_DIMENSION, PNG_MAX_PIXELS, PngDecodeOptions, PngEncodeOptions, PngFilterType, RawImage, TEXT_DECODE_CHUNK_CODE_UNITS, TextEncodingLabel, UndecodableTextError, UndecodableTextReason, appendCodePoint, base64ToBytes, bytesToBase64, concatBytes, crc32, decodePng, decodeText, deflate, detectByteOrderMark, encodePng, exceedsMaxPixelCount, filterScanlines, fromCodeUnits, inflate, inflateTolerant, isAsciiWhitespace, isProbablyText, readJpegInfo, resolveEncodingLabel, tryDecodeText, unfilterScanlines };
247
+ export { BASE64_ENCODE_CHUNK_CHARS, ByteOrderMark, ByteReader, ByteWriter, CodeUnitSink, DecodeTextOptions, DecodedText, DecodedTextConfidence, DecodedTextSource, DeflateLevel, InflateResult, JpegInfo, MAX_INFLATE_OUTPUT_BYTES, PNG_MAX_DIMENSION, PNG_MAX_PIXELS, PngDecodeOptions, PngEncodeOptions, PngFilterType, RawImage, TEXT_DECODE_CHUNK_CODE_UNITS, TextEncodingLabel, UndecodableTextError, UndecodableTextReason, appendCodePoint, base64ToBytes, bytesToBase64, concatBytes, crc32, decodePng, decodeText, deflate, detectByteOrderMark, encodePng, exceedsMaxPixelCount, filterScanlines, fromCodeUnits, inflate, inflateTolerant, isAsciiWhitespace, isProbablyText, readJpegInfo, resolveEncodingLabel, tryDecodeText, unfilterScanlines };
package/dist/index.d.ts CHANGED
@@ -132,11 +132,17 @@ declare class UndecodableTextError extends Error {
132
132
  */
133
133
  declare const TEXT_DECODE_CHUNK_CODE_UNITS: number;
134
134
  /**
135
- * Splits `codePoint` into one or two UTF-16 code units and pushes them onto `units`: the code point itself below the supplementary plane, a surrogate pair biased by {@link SURROGATE_BITS} and {@link LOW_SURROGATE_MASK} above it. Shared by every decoder here that can produce a code point outside the Basic Multilingual Plane — {@link decodeUtf32} for UTF-32's own scalar values, and decode-dbcs.ts's decoders for the WHATWG index tables' own supplementary-plane entries (Big5's CJK Compatibility Ideographs Supplement pointers, gb18030's final algorithmic range) — so the split happens in exactly one place rather than once per caller.
136
- * @param units - The code unit array to push onto, in place.
135
+ * A code unit accumulator threaded by reference into {@link appendCodePoint}, rather than the bare mutable array it wraps: the array itself is owned entirely by whichever decoder loop builds it, appended to hundreds or thousands of times per call, and this wrapper's own `units` property is not itself a primitive or callback, which is what keeps it out of scope for exadev/prefer-readonly-object-param (see this package's own eslint.config.ts, and PackageLintOptions.preferReadonlyParams in the workspace's shared eslint.shared.ts) the same way a bare `number[]` parameter is squarely inside exadev/prefer-readonly-array-param's.
136
+ */
137
+ interface CodeUnitSink {
138
+ readonly units: number[];
139
+ }
140
+ /**
141
+ * Splits `codePoint` into one or two UTF-16 code units and pushes them onto `sink.units`: the code point itself below the supplementary plane, a surrogate pair biased by {@link SURROGATE_BITS} and {@link LOW_SURROGATE_MASK} above it. Shared by every decoder here that can produce a code point outside the Basic Multilingual Plane — {@link decodeUtf32} for UTF-32's own scalar values, and decode-dbcs.ts's decoders for the WHATWG index tables' own supplementary-plane entries (Big5's CJK Compatibility Ideographs Supplement pointers, gb18030's final algorithmic range) — so the split happens in exactly one place rather than once per caller.
142
+ * @param sink - The code unit accumulator to push onto, in place.
137
143
  * @param codePoint - A Unicode scalar value in the range 0 to {@link MAX_CODE_POINT}.
138
144
  */
139
- declare function appendCodePoint(units: number[], codePoint: number): void;
145
+ declare function appendCodePoint(sink: CodeUnitSink, codePoint: number): void;
140
146
  /**
141
147
  * Converts a sequence of UTF-16 code units to a string in fixed-size chunks (see {@link TEXT_DECODE_CHUNK_CODE_UNITS}), shared by every decoder in this module and in decode-dbcs.ts so each collects code units into a plain array and calls this once at the end rather than concatenating a string one character at a time.
142
148
  * @param units - The code units to convert, in order.
@@ -238,4 +244,4 @@ interface JpegInfo {
238
244
  }
239
245
  declare function readJpegInfo(bytes: Uint8Array<ArrayBuffer>): JpegInfo;
240
246
  //#endregion
241
- export { BASE64_ENCODE_CHUNK_CHARS, ByteOrderMark, ByteReader, ByteWriter, DecodeTextOptions, DecodedText, DecodedTextConfidence, DecodedTextSource, DeflateLevel, InflateResult, JpegInfo, MAX_INFLATE_OUTPUT_BYTES, PNG_MAX_DIMENSION, PNG_MAX_PIXELS, PngDecodeOptions, PngEncodeOptions, PngFilterType, RawImage, TEXT_DECODE_CHUNK_CODE_UNITS, TextEncodingLabel, UndecodableTextError, UndecodableTextReason, appendCodePoint, base64ToBytes, bytesToBase64, concatBytes, crc32, decodePng, decodeText, deflate, detectByteOrderMark, encodePng, exceedsMaxPixelCount, filterScanlines, fromCodeUnits, inflate, inflateTolerant, isAsciiWhitespace, isProbablyText, readJpegInfo, resolveEncodingLabel, tryDecodeText, unfilterScanlines };
247
+ export { BASE64_ENCODE_CHUNK_CHARS, ByteOrderMark, ByteReader, ByteWriter, CodeUnitSink, DecodeTextOptions, DecodedText, DecodedTextConfidence, DecodedTextSource, DeflateLevel, InflateResult, JpegInfo, MAX_INFLATE_OUTPUT_BYTES, PNG_MAX_DIMENSION, PNG_MAX_PIXELS, PngDecodeOptions, PngEncodeOptions, PngFilterType, RawImage, TEXT_DECODE_CHUNK_CODE_UNITS, TextEncodingLabel, UndecodableTextError, UndecodableTextReason, appendCodePoint, base64ToBytes, bytesToBase64, concatBytes, crc32, decodePng, decodeText, deflate, detectByteOrderMark, encodePng, exceedsMaxPixelCount, filterScanlines, fromCodeUnits, inflate, inflateTolerant, isAsciiWhitespace, isProbablyText, readJpegInfo, resolveEncodingLabel, tryDecodeText, unfilterScanlines };