document-bytes 2.0.1 → 2.0.3

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
@@ -125,11 +125,6 @@ declare class UndecodableTextError extends Error {
125
125
  readonly reason: UndecodableTextReason;
126
126
  constructor(reason: UndecodableTextReason, message: string);
127
127
  }
128
- /**
129
- * Code units converted by one `String.fromCharCode.apply` call. JavaScriptCore rejects a call with more than 65536 arguments, a limit MDN documents as hard-coded (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply), and other engines bound the same thing by stack size, so this is half that stated figure, leaving the engine room for whatever else it puts on its argument stack. The same quantum src/bytes/base64.ts's own chunked encode uses, for the same reason: appending one character at a time to a string is what made converting a few megabytes take seconds under instrumentation.
130
- *
131
- * Exported so tests can place inputs on and around a chunk boundary without repeating the figure.
132
- */
133
128
  declare const TEXT_DECODE_CHUNK_CODE_UNITS: number;
134
129
  /**
135
130
  * 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.
@@ -207,10 +202,11 @@ declare function tryDecodeText(bytes: Uint8Array, options?: DecodeTextOptions):
207
202
  declare function resolveEncodingLabel(label: string): TextEncodingLabel | undefined;
208
203
  //#endregion
209
204
  //#region src/image/png-decode.d.ts
205
+ type RawImageChannels = 1 | 3;
210
206
  interface RawImage {
211
207
  readonly width: number;
212
208
  readonly height: number;
213
- readonly channels: 1 | 3;
209
+ readonly channels: RawImageChannels;
214
210
  readonly data: Uint8Array<ArrayBuffer>;
215
211
  readonly alpha?: Uint8Array<ArrayBuffer>;
216
212
  }
package/dist/index.d.ts CHANGED
@@ -125,11 +125,6 @@ declare class UndecodableTextError extends Error {
125
125
  readonly reason: UndecodableTextReason;
126
126
  constructor(reason: UndecodableTextReason, message: string);
127
127
  }
128
- /**
129
- * Code units converted by one `String.fromCharCode.apply` call. JavaScriptCore rejects a call with more than 65536 arguments, a limit MDN documents as hard-coded (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply), and other engines bound the same thing by stack size, so this is half that stated figure, leaving the engine room for whatever else it puts on its argument stack. The same quantum src/bytes/base64.ts's own chunked encode uses, for the same reason: appending one character at a time to a string is what made converting a few megabytes take seconds under instrumentation.
130
- *
131
- * Exported so tests can place inputs on and around a chunk boundary without repeating the figure.
132
- */
133
128
  declare const TEXT_DECODE_CHUNK_CODE_UNITS: number;
134
129
  /**
135
130
  * 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.
@@ -207,10 +202,11 @@ declare function tryDecodeText(bytes: Uint8Array, options?: DecodeTextOptions):
207
202
  declare function resolveEncodingLabel(label: string): TextEncodingLabel | undefined;
208
203
  //#endregion
209
204
  //#region src/image/png-decode.d.ts
205
+ type RawImageChannels = 1 | 3;
210
206
  interface RawImage {
211
207
  readonly width: number;
212
208
  readonly height: number;
213
- readonly channels: 1 | 3;
209
+ readonly channels: RawImageChannels;
214
210
  readonly data: Uint8Array<ArrayBuffer>;
215
211
  readonly alpha?: Uint8Array<ArrayBuffer>;
216
212
  }