mirror of
https://github.com/0x5eal/rbxts-pako.git
synced 2025-04-02 01:40:57 +01:00
refactor: make library lune compatible
* Moved over to requires with type assertion to remove dependence on `TS` runtime which is roblox exclusive * Imports are now exclusively used for types, which are stripped at compile-time * Renamed `buff` utility to `typedArrays` * Added patch for roblox-ts global types to modify `require` signature to behave like ES5 requires
This commit is contained in:
parent
0404f2d333
commit
622aa75ae3
15 changed files with 113 additions and 75 deletions
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
|
@ -40,5 +40,8 @@
|
|||
"prettier": "^3.4.2",
|
||||
"roblox-ts": "^3.0.0",
|
||||
"typescript": "^5.7.2"
|
||||
},
|
||||
"patchedDependencies": {
|
||||
"@rbxts/types@1.0.813": "patches/@rbxts%2Ftypes@1.0.813.patch"
|
||||
}
|
||||
}
|
17
patches/@rbxts%2Ftypes@1.0.813.patch
Normal file
17
patches/@rbxts%2Ftypes@1.0.813.patch
Normal file
|
@ -0,0 +1,17 @@
|
|||
diff --git a/include/roblox.d.ts b/include/roblox.d.ts
|
||||
index 9ca6669431ba395dbe25552c447fdd3f3b00825d..220aab8b642727dc6ed3959fe514445ff8190dd2 100644
|
||||
--- a/include/roblox.d.ts
|
||||
+++ b/include/roblox.d.ts
|
||||
@@ -2676,10 +2676,8 @@ declare function elapsedTime(): number;
|
||||
* The number reflects the current heap consumption from the operating system perspective, which fluctuates over time as garbage collector frees objects.
|
||||
*/
|
||||
declare function gcinfo(): number;
|
||||
-/** Runs the supplied ModuleScript if it has not been run already, and returns what the ModuleScript returned (in both cases).
|
||||
-
|
||||
-If the ModuleScript the user wants to use has been uploaded to Roblox (with the instance’s name being ‘MainModule’), it can be loaded by using the require function on the asset ID of the ModuleScript, though only on the server. */
|
||||
-declare function require(moduleScript: ModuleScript | number): unknown;
|
||||
+/** Requires a module with a path relative to the current module's path. */
|
||||
+declare function require(id: string): any;
|
||||
/** Runs the specified callback function in a separate thread, without yielding the current thread.
|
||||
The function will be executed the next time Roblox’s Task Scheduler runs an update cycle. This delay will take at least 29 milliseconds but can arbitrarily take longer, depending on the target framerate and various throttling conditions. */
|
||||
declare function spawn(callback: DelayedCallback): void;
|
|
@ -1,13 +1,20 @@
|
|||
"use strict";
|
||||
|
||||
import { DeflateState } from "./zlib/deflate";
|
||||
import * as zlibDeflate from "./zlib/deflate";
|
||||
import { ZStream } from "./zlib/zstream";
|
||||
import type { DeflateState } from "./zlib/deflate";
|
||||
import type Messages from "./zlib/messages"
|
||||
import type * as TypedArrays from "./utils/typedArrays";
|
||||
|
||||
const { ZStream } = require("./zlib/zstream") as typeof import("./zlib/zstream");
|
||||
const zlibDeflate = require("./zlib/deflate") as typeof import("./zlib/deflate");
|
||||
const messages = require("./zlib/messages") as typeof Messages;
|
||||
|
||||
const { assign, flattenChunks } = require("./utils/common") as typeof import("./utils/common");
|
||||
const { Uint8Array } = require("./utils/typedArrays") as typeof TypedArrays;
|
||||
|
||||
/* Public constants ==========================================================*/
|
||||
/* ===========================================================================*/
|
||||
|
||||
import {
|
||||
export const {
|
||||
Z_NO_FLUSH,
|
||||
Z_SYNC_FLUSH,
|
||||
Z_FULL_FLUSH,
|
||||
|
@ -17,10 +24,7 @@ import {
|
|||
Z_DEFAULT_COMPRESSION,
|
||||
Z_DEFAULT_STRATEGY,
|
||||
Z_DEFLATED,
|
||||
} from "./zlib/constants";
|
||||
import { assign, flattenChunks } from "./utils/common";
|
||||
import { Uint8Array } from "./utils/buffs";
|
||||
import messages from "./zlib/messages";
|
||||
} = require("./zlib/constants") as typeof import("./zlib/constants");
|
||||
|
||||
/* ===========================================================================*/
|
||||
|
||||
|
@ -119,15 +123,15 @@ type Options = {
|
|||
raw: boolean;
|
||||
gzip: boolean;
|
||||
header?: DeflateState["gzhead"];
|
||||
dictionary?: Uint8Array | string;
|
||||
dictionary?: TypedArrays.Uint8Array | string;
|
||||
};
|
||||
|
||||
export class Deflate {
|
||||
public options: Exclude<Options, "dictionary"> & { dictionary?: Uint8Array };
|
||||
public err: keyof typeof messages = Z_OK;
|
||||
public options: Exclude<Options, "dictionary"> & { dictionary?: TypedArrays.Uint8Array };
|
||||
public err: keyof typeof Messages = Z_OK;
|
||||
public msg?: string;
|
||||
public ended = false;
|
||||
public chunks: Uint8Array[] = [];
|
||||
public chunks: TypedArrays.Uint8Array[] = [];
|
||||
public strm = new ZStream<DeflateState>();
|
||||
public result?: buffer;
|
||||
|
||||
|
@ -214,7 +218,7 @@ export class Deflate {
|
|||
* push(chunk, true); // push last chunk
|
||||
* ```
|
||||
**/
|
||||
push(data: Uint8Array | string, flush_mode: boolean | number) {
|
||||
push(data: TypedArrays.Uint8Array | string, flush_mode: boolean | number) {
|
||||
const strm = this.strm;
|
||||
const { chunkSize } = this.options;
|
||||
let status, _flush_mode;
|
||||
|
@ -234,7 +238,7 @@ export class Deflate {
|
|||
strm.next_in = 0;
|
||||
strm.avail_in = strm.input.length;
|
||||
|
||||
for (;;) {
|
||||
for (; ;) {
|
||||
if (strm.avail_out === 0) {
|
||||
strm.output = new Uint8Array(chunkSize);
|
||||
strm.next_out = 0;
|
||||
|
@ -287,7 +291,7 @@ export class Deflate {
|
|||
* By default, stores data blocks in `chunks[]` property and glue
|
||||
* those in `onEnd`. Override this handler, if you need another behaviour.
|
||||
**/
|
||||
onData(chunk: Uint8Array) {
|
||||
onData(chunk: TypedArrays.Uint8Array) {
|
||||
this.chunks.push(chunk);
|
||||
}
|
||||
|
||||
|
@ -300,7 +304,7 @@ export class Deflate {
|
|||
* complete (Z_FINISH). By default - join collected chunks,
|
||||
* free memory and fill `results` / `err` properties.
|
||||
**/
|
||||
onEnd(status: keyof typeof messages) {
|
||||
onEnd(status: keyof typeof Messages) {
|
||||
// On success - join
|
||||
if (status === Z_OK) {
|
||||
this.result = flattenChunks(this.chunks.map((chunk) => chunk.buf));
|
||||
|
@ -343,7 +347,7 @@ export class Deflate {
|
|||
* console.log(pako.deflate(data));
|
||||
* ```
|
||||
**/
|
||||
export function deflate(input: Uint8Array, options: Partial<Options> = {}) {
|
||||
export function deflate(input: TypedArrays.Uint8Array, options: Partial<Options> = {}) {
|
||||
const deflator = new Deflate(options);
|
||||
|
||||
deflator.push(input, true);
|
||||
|
@ -364,10 +368,8 @@ export function deflate(input: Uint8Array, options: Partial<Options> = {}) {
|
|||
* The same as [[deflate]], but creates raw data, without wrapper
|
||||
* (header and adler32 crc).
|
||||
**/
|
||||
export function deflateRaw(input: Uint8Array, options: Exclude<Partial<Options>, "raw"> = {}) {
|
||||
export function deflateRaw(input: TypedArrays.Uint8Array, options: Exclude<Partial<Options>, "raw"> = {}) {
|
||||
options = options || {};
|
||||
options.raw = true;
|
||||
return deflate(input, options);
|
||||
}
|
||||
|
||||
export * from "./zlib/constants";
|
||||
|
|
|
@ -1,14 +1,20 @@
|
|||
"use strict";
|
||||
|
||||
import { type InflateState } from "./zlib/inflate";
|
||||
import * as zlibInflate from "./zlib/inflate";
|
||||
import { ZStream } from "./zlib/zstream";
|
||||
import { GZheader } from "./zlib/gzheader";
|
||||
import type { InflateState } from "./zlib/inflate";
|
||||
import type Messages from "./zlib/messages";
|
||||
import type * as TypedArrays from "./utils/typedArrays";
|
||||
|
||||
const zlibInflate = require("./zlib/inflate") as typeof import("./zlib/inflate");
|
||||
const { ZStream } = require("./zlib/zstream") as typeof import("./zlib/zstream");
|
||||
const { GZheader } = require("./zlib/gzheader") as typeof import("./zlib/gzheader");
|
||||
const messages = require("./zlib/messages") as typeof Messages;
|
||||
|
||||
const { Uint8Array } = require("./utils/typedArrays") as typeof TypedArrays;
|
||||
const { assign, flattenChunks } = require("./utils/common") as typeof import("./utils/common");
|
||||
|
||||
/* Public constants ==========================================================*/
|
||||
/* ===========================================================================*/
|
||||
|
||||
import {
|
||||
export const {
|
||||
Z_NO_FLUSH,
|
||||
Z_FINISH,
|
||||
Z_OK,
|
||||
|
@ -17,10 +23,7 @@ import {
|
|||
Z_STREAM_ERROR,
|
||||
Z_DATA_ERROR,
|
||||
Z_MEM_ERROR,
|
||||
} from "./zlib/constants";
|
||||
import { Uint8Array } from "./utils/buffs";
|
||||
import { assign, flattenChunks } from "./utils/common";
|
||||
import messages from "./zlib/messages";
|
||||
} = require("./zlib/constants") as typeof import("./zlib/constants");
|
||||
|
||||
/* ===========================================================================*/
|
||||
|
||||
|
@ -106,15 +109,15 @@ type Options = {
|
|||
windowBits: number;
|
||||
to: string;
|
||||
raw: boolean;
|
||||
dictionary?: string | Uint8Array;
|
||||
dictionary?: string | TypedArrays.Uint8Array;
|
||||
};
|
||||
|
||||
export class Inflate {
|
||||
public options: Exclude<Options, "dictionary"> & { dictionary?: Uint8Array };
|
||||
public err: keyof typeof messages = Z_OK;
|
||||
public options: Exclude<Options, "dictionary"> & { dictionary?: TypedArrays.Uint8Array };
|
||||
public err: keyof typeof Messages = Z_OK;
|
||||
public msg?: string;
|
||||
public ended = false;
|
||||
public chunks: Uint8Array[] = [];
|
||||
public chunks: TypedArrays.Uint8Array[] = [];
|
||||
public strm = new ZStream<InflateState>();
|
||||
public header = new GZheader();
|
||||
public result?: buffer | string;
|
||||
|
@ -212,7 +215,7 @@ export class Inflate {
|
|||
* push(chunk, true); // push last chunk
|
||||
* ```
|
||||
**/
|
||||
push(data: Uint8Array, flush_mode: number | boolean) {
|
||||
push(data: TypedArrays.Uint8Array, flush_mode: number | boolean) {
|
||||
const strm = this.strm;
|
||||
const { chunkSize, dictionary } = this.options;
|
||||
let status, _flush_mode, last_avail_out;
|
||||
|
@ -298,7 +301,7 @@ export class Inflate {
|
|||
* By default, stores data blocks in `chunks[]` property and glue
|
||||
* those in `onEnd`. Override this handler, if you need another behaviour.
|
||||
**/
|
||||
onData(chunk: Uint8Array) {
|
||||
onData(chunk: TypedArrays.Uint8Array) {
|
||||
this.chunks.push(chunk);
|
||||
}
|
||||
|
||||
|
@ -311,7 +314,7 @@ export class Inflate {
|
|||
* complete (Z_FINISH). By default - join collected chunks,
|
||||
* free memory and fill `results` / `err` properties.
|
||||
**/
|
||||
onEnd(status: keyof typeof messages) {
|
||||
onEnd(status: keyof typeof Messages) {
|
||||
// On success - join
|
||||
if (status === Z_OK) {
|
||||
if (this.options.to === "string") {
|
||||
|
@ -365,7 +368,7 @@ export class Inflate {
|
|||
* }
|
||||
* ```
|
||||
**/
|
||||
export function inflate(input: Uint8Array, options: Partial<Options> = {}) {
|
||||
export function inflate(input: TypedArrays.Uint8Array, options: Partial<Options> = {}) {
|
||||
const inflator = new Inflate(options);
|
||||
|
||||
inflator.push(input, true);
|
||||
|
@ -384,10 +387,8 @@ export function inflate(input: Uint8Array, options: Partial<Options> = {}) {
|
|||
* The same as [[inflate]], but creates raw data, without wrapper
|
||||
* (header and adler32 crc).
|
||||
**/
|
||||
export function inflateRaw(input: Uint8Array, options: Exclude<Partial<Options>, "raw"> = {}) {
|
||||
export function inflateRaw(input: TypedArrays.Uint8Array, options: Exclude<Partial<Options>, "raw"> = {}) {
|
||||
options = options || {};
|
||||
options.raw = true;
|
||||
return inflate(input, options);
|
||||
}
|
||||
|
||||
export * from "./zlib/constants";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
import { NumericArrayLike } from "../utils/buffs";
|
||||
import type { NumericArrayLike } from "../utils/typedArrays";
|
||||
|
||||
// Note: adler32 takes 12% for level 0 and 2% for level 6.
|
||||
// It isn't worth it to make additional optimizations as in original.
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
"use strict";
|
||||
|
||||
import { NumericArrayLike, Uint32Array } from "../utils/buffs";
|
||||
import type * as TypedArrays from "../utils/typedArrays";
|
||||
type NumericArrayLike = TypedArrays.NumericArrayLike;
|
||||
|
||||
const { Uint32Array } = require("../utils/typedArrays") as typeof TypedArrays;
|
||||
|
||||
// Note: we can't get significant speed boost here.
|
||||
// So write code to minimize size - no pregenerated tables
|
||||
|
|
|
@ -19,11 +19,15 @@
|
|||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
import { _tr_init, _tr_stored_block, _tr_flush_block, _tr_tally, _tr_align, TreeDesc } from "./trees";
|
||||
import { adler32 } from "./adler32";
|
||||
import { crc32 } from "./crc32";
|
||||
import { Uint16Array, Uint8Array } from "../utils/buffs";
|
||||
import {
|
||||
import type { ZStream } from "./zstream";
|
||||
import type { TreeDesc } from "./trees";
|
||||
import type Messages from "./messages";
|
||||
import type * as TypedArrays from "../utils/typedArrays";
|
||||
|
||||
const { _tr_init, _tr_stored_block, _tr_flush_block, _tr_tally, _tr_align } = require("./trees") as typeof import("./trees");
|
||||
const { adler32 } = require("./adler32") as typeof import("./adler32");
|
||||
const { crc32 } = require("./crc32") as typeof import("./crc32");
|
||||
const {
|
||||
Z_FINISH,
|
||||
Z_NO_FLUSH,
|
||||
Z_FILTERED,
|
||||
|
@ -42,9 +46,9 @@ import {
|
|||
Z_FULL_FLUSH,
|
||||
Z_STREAM_END,
|
||||
Z_DATA_ERROR,
|
||||
} from "./constants";
|
||||
import messages from "./messages";
|
||||
import { ZStream } from "./zstream";
|
||||
} = require("./constants") as typeof import("./constants");
|
||||
const messages = require("./messages") as typeof Messages;
|
||||
const { Uint8Array, Uint16Array } = require("../utils/typedArrays") as typeof TypedArrays;
|
||||
|
||||
/* Public constants ==========================================================*/
|
||||
/* ===========================================================================*/
|
||||
|
@ -96,7 +100,7 @@ const BS_FINISH_DONE = 4; /* finish done, accept no more input or output */
|
|||
|
||||
const OS_CODE = 0x03; // Unix :) . Don't detect, use this default.
|
||||
|
||||
const err = (strm: ZStream<DeflateState>, errorCode: keyof typeof messages) => {
|
||||
const err = (strm: ZStream<DeflateState>, errorCode: keyof typeof Messages) => {
|
||||
strm.msg = messages[errorCode];
|
||||
return errorCode;
|
||||
};
|
||||
|
@ -199,7 +203,7 @@ const putShortMSB = (s: DeflateState, b: number) => {
|
|||
* allocating a large strm->input buffer and copying from it.
|
||||
* (See also flush_pending()).
|
||||
*/
|
||||
const read_buf = (strm: ZStream<DeflateState>, buf: Uint8Array, start: number, size: number) => {
|
||||
const read_buf = (strm: ZStream<DeflateState>, buf: TypedArrays.Uint8Array, start: number, size: number) => {
|
||||
let len = strm.avail_in;
|
||||
|
||||
if (len > size) {
|
||||
|
@ -1207,7 +1211,7 @@ const lm_init = (s: DeflateState) => {
|
|||
export class DeflateState {
|
||||
public strm!: ZStream<DeflateState>; /* pointer back to this zlib stream */
|
||||
public status = 0; /* as the name implies */
|
||||
public pending_buf!: Uint8Array; /* output still pending */
|
||||
public pending_buf!: TypedArrays.Uint8Array; /* output still pending */
|
||||
public pending_buf_size = 0; /* size of pending_buf */
|
||||
public pending_out = 0; /* next pending byte to output to the stream */
|
||||
public pending = 0; /* nb of bytes in the pending buffer */
|
||||
|
@ -1219,7 +1223,7 @@ export class DeflateState {
|
|||
os: number;
|
||||
extra_len: number;
|
||||
comment: string | null;
|
||||
extra: Uint8Array | null;
|
||||
extra: TypedArrays.Uint8Array | null;
|
||||
name: string | null;
|
||||
hcrc: number;
|
||||
text: number;
|
||||
|
@ -1232,7 +1236,7 @@ export class DeflateState {
|
|||
public w_bits = 0; /* log2(w_size) (8..16) */
|
||||
public w_mask = 0; /* w_size - 1 */
|
||||
|
||||
public window!: Uint8Array;
|
||||
public window!: TypedArrays.Uint8Array;
|
||||
/* Sliding window. Input bytes are read into the second half of the window,
|
||||
* and move to the first half later to keep a dictionary of at least wSize
|
||||
* bytes. With this organization, matches are limited to a distance of
|
||||
|
@ -1245,13 +1249,13 @@ export class DeflateState {
|
|||
* is directly used as sliding window.
|
||||
*/
|
||||
|
||||
public prev!: Uint16Array;
|
||||
public prev!: TypedArrays.Uint16Array;
|
||||
/* Link to older string with same hash index. To limit the size of this
|
||||
* array to 64K, this link is maintained only for the last 32K strings.
|
||||
* An index in this array is thus a window index modulo 32K.
|
||||
*/
|
||||
|
||||
public head!: Uint16Array; /* Heads of the hash chains or NIL. */
|
||||
public head!: TypedArrays.Uint16Array; /* Heads of the hash chains or NIL. */
|
||||
|
||||
public ins_h = 0; /* hash index of string to be inserted */
|
||||
public hash_size = 0; /* number of elements in hash table */
|
||||
|
@ -1976,7 +1980,7 @@ export function deflateEnd(strm: ZStream<DeflateState>) {
|
|||
* Initializes the compression dictionary from the given byte
|
||||
* sequence without producing any compressed output.
|
||||
*/
|
||||
export function deflateSetDictionary(strm: ZStream<DeflateState>, dictionary: Uint8Array) {
|
||||
export function deflateSetDictionary(strm: ZStream<DeflateState>, dictionary: TypedArrays.Uint8Array) {
|
||||
let dictLength = dictionary.length;
|
||||
|
||||
if (deflateStateCheck(strm)) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
import { Uint8Array } from "../utils/buffs";
|
||||
import type { Uint8Array } from "../utils/typedArrays";
|
||||
|
||||
// (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
import { InflateState } from "./inflate";
|
||||
import { ZStream } from "./zstream";
|
||||
import type { ZStream } from "./zstream";
|
||||
import type { InflateState } from "./inflate";
|
||||
|
||||
// (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
import { adler32 } from "./adler32";
|
||||
import { crc32 } from "./crc32";
|
||||
import { inflate_fast } from "./inffast";
|
||||
import { inflate_table } from "./inftrees";
|
||||
const { adler32 } = require("./adler32") as typeof import("./adler32");
|
||||
const { crc32 } = require("./crc32") as typeof import("./crc32");
|
||||
const { inflate_fast } = require("./inffast") as typeof import("./inffast");
|
||||
const { inflate_table } = require("./inftrees") as typeof import("./inftrees");
|
||||
|
||||
const CODES = 0;
|
||||
const LENS = 1;
|
||||
|
@ -31,7 +31,7 @@ const DISTS = 2;
|
|||
/* Public constants ==========================================================*/
|
||||
/* ===========================================================================*/
|
||||
|
||||
import { Int32Array, Uint16Array, Uint8Array } from "../utils/buffs";
|
||||
import { Int32Array, Uint16Array, Uint8Array } from "../utils/typedArrays";
|
||||
import {
|
||||
Z_STREAM_ERROR,
|
||||
Z_OK,
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
"use strict";
|
||||
|
||||
import { NumericArrayLike, Uint16Array, Uint8Array } from "../utils/buffs";
|
||||
import * as TypedArrays from "../utils/typedArrays";
|
||||
type NumericArrayLike = TypedArrays.NumericArrayLike;
|
||||
|
||||
const { Uint8Array, Uint16Array } = require("../utils/typedArrays") as typeof TypedArrays;
|
||||
|
||||
// (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
"use strict";
|
||||
|
||||
import { NumericArrayLike, Uint16Array, Uint8Array } from "../utils/buffs";
|
||||
import type * as TypedArrays from "../utils/typedArrays";
|
||||
type NumericArrayLike = TypedArrays.NumericArrayLike;
|
||||
|
||||
const { Uint16Array, Uint8Array } = require("../utils/typedArrays") as typeof TypedArrays;
|
||||
import { DeflateState } from "./deflate";
|
||||
|
||||
// (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
|
@ -160,7 +163,7 @@ class StaticTreeDesc {
|
|||
public has_stree: boolean;
|
||||
constructor(
|
||||
public static_tree: Array<number>,
|
||||
public extra_bits: Uint8Array,
|
||||
public extra_bits: TypedArrays.Uint8Array,
|
||||
public extra_base: number,
|
||||
public elems: number,
|
||||
public max_length: number,
|
||||
|
@ -176,7 +179,7 @@ let static_bl_desc: StaticTreeDesc;
|
|||
export class TreeDesc {
|
||||
public max_code = 0; /* largest code with non zero frequency */
|
||||
constructor(
|
||||
public dyn_tree: Uint16Array,
|
||||
public dyn_tree: TypedArrays.Uint16Array,
|
||||
public stat_desc: StaticTreeDesc,
|
||||
) {}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
"use strict";
|
||||
|
||||
import { Uint8Array } from "../utils/buffs";
|
||||
import { Z_UNKNOWN } from "./constants";
|
||||
import type * as TypedArrays from "../utils/typedArrays";
|
||||
|
||||
const { Uint8Array } = require("../utils/typedArrays") as typeof TypedArrays;
|
||||
const { Z_UNKNOWN } = require("./constants") as typeof import("./constants");
|
||||
|
||||
// (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
|
||||
|
@ -24,14 +26,14 @@ import { Z_UNKNOWN } from "./constants";
|
|||
|
||||
export class ZStream<State> {
|
||||
/* next input byte */
|
||||
public input!: Uint8Array; // JS specific, because we have no pointers
|
||||
public input!: TypedArrays.Uint8Array; // JS specific, because we have no pointers
|
||||
public next_in = 0;
|
||||
/* number of bytes available at input */
|
||||
public avail_in = 0;
|
||||
/* total number of input bytes read so far */
|
||||
public total_in = 0;
|
||||
/* next output byte should be put there */
|
||||
public output!: Uint8Array; // JS specific, because we have no pointers
|
||||
public output!: TypedArrays.Uint8Array; // JS specific, because we have no pointers
|
||||
public next_out = 0;
|
||||
/* remaining free space at output */
|
||||
public avail_out = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue