inital upload
This commit is contained in:
2
node_modules/minizlib/dist/commonjs/constants.d.ts
generated
vendored
Normal file
2
node_modules/minizlib/dist/commonjs/constants.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare const constants: any;
|
||||
//# sourceMappingURL=constants.d.ts.map
|
||||
1
node_modules/minizlib/dist/commonjs/constants.d.ts.map
generated
vendored
Normal file
1
node_modules/minizlib/dist/commonjs/constants.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,SAAS,KAiHrB,CAAA"}
|
||||
123
node_modules/minizlib/dist/commonjs/constants.js
generated
vendored
Normal file
123
node_modules/minizlib/dist/commonjs/constants.js
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.constants = void 0;
|
||||
// Update with any zlib constants that are added or changed in the future.
|
||||
// Node v6 didn't export this, so we just hard code the version and rely
|
||||
// on all the other hard-coded values from zlib v4736. When node v6
|
||||
// support drops, we can just export the realZlibConstants object.
|
||||
const zlib_1 = __importDefault(require("zlib"));
|
||||
/* c8 ignore start */
|
||||
const realZlibConstants = zlib_1.default.constants || { ZLIB_VERNUM: 4736 };
|
||||
/* c8 ignore stop */
|
||||
exports.constants = Object.freeze(Object.assign(Object.create(null), {
|
||||
Z_NO_FLUSH: 0,
|
||||
Z_PARTIAL_FLUSH: 1,
|
||||
Z_SYNC_FLUSH: 2,
|
||||
Z_FULL_FLUSH: 3,
|
||||
Z_FINISH: 4,
|
||||
Z_BLOCK: 5,
|
||||
Z_OK: 0,
|
||||
Z_STREAM_END: 1,
|
||||
Z_NEED_DICT: 2,
|
||||
Z_ERRNO: -1,
|
||||
Z_STREAM_ERROR: -2,
|
||||
Z_DATA_ERROR: -3,
|
||||
Z_MEM_ERROR: -4,
|
||||
Z_BUF_ERROR: -5,
|
||||
Z_VERSION_ERROR: -6,
|
||||
Z_NO_COMPRESSION: 0,
|
||||
Z_BEST_SPEED: 1,
|
||||
Z_BEST_COMPRESSION: 9,
|
||||
Z_DEFAULT_COMPRESSION: -1,
|
||||
Z_FILTERED: 1,
|
||||
Z_HUFFMAN_ONLY: 2,
|
||||
Z_RLE: 3,
|
||||
Z_FIXED: 4,
|
||||
Z_DEFAULT_STRATEGY: 0,
|
||||
DEFLATE: 1,
|
||||
INFLATE: 2,
|
||||
GZIP: 3,
|
||||
GUNZIP: 4,
|
||||
DEFLATERAW: 5,
|
||||
INFLATERAW: 6,
|
||||
UNZIP: 7,
|
||||
BROTLI_DECODE: 8,
|
||||
BROTLI_ENCODE: 9,
|
||||
Z_MIN_WINDOWBITS: 8,
|
||||
Z_MAX_WINDOWBITS: 15,
|
||||
Z_DEFAULT_WINDOWBITS: 15,
|
||||
Z_MIN_CHUNK: 64,
|
||||
Z_MAX_CHUNK: Infinity,
|
||||
Z_DEFAULT_CHUNK: 16384,
|
||||
Z_MIN_MEMLEVEL: 1,
|
||||
Z_MAX_MEMLEVEL: 9,
|
||||
Z_DEFAULT_MEMLEVEL: 8,
|
||||
Z_MIN_LEVEL: -1,
|
||||
Z_MAX_LEVEL: 9,
|
||||
Z_DEFAULT_LEVEL: -1,
|
||||
BROTLI_OPERATION_PROCESS: 0,
|
||||
BROTLI_OPERATION_FLUSH: 1,
|
||||
BROTLI_OPERATION_FINISH: 2,
|
||||
BROTLI_OPERATION_EMIT_METADATA: 3,
|
||||
BROTLI_MODE_GENERIC: 0,
|
||||
BROTLI_MODE_TEXT: 1,
|
||||
BROTLI_MODE_FONT: 2,
|
||||
BROTLI_DEFAULT_MODE: 0,
|
||||
BROTLI_MIN_QUALITY: 0,
|
||||
BROTLI_MAX_QUALITY: 11,
|
||||
BROTLI_DEFAULT_QUALITY: 11,
|
||||
BROTLI_MIN_WINDOW_BITS: 10,
|
||||
BROTLI_MAX_WINDOW_BITS: 24,
|
||||
BROTLI_LARGE_MAX_WINDOW_BITS: 30,
|
||||
BROTLI_DEFAULT_WINDOW: 22,
|
||||
BROTLI_MIN_INPUT_BLOCK_BITS: 16,
|
||||
BROTLI_MAX_INPUT_BLOCK_BITS: 24,
|
||||
BROTLI_PARAM_MODE: 0,
|
||||
BROTLI_PARAM_QUALITY: 1,
|
||||
BROTLI_PARAM_LGWIN: 2,
|
||||
BROTLI_PARAM_LGBLOCK: 3,
|
||||
BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
|
||||
BROTLI_PARAM_SIZE_HINT: 5,
|
||||
BROTLI_PARAM_LARGE_WINDOW: 6,
|
||||
BROTLI_PARAM_NPOSTFIX: 7,
|
||||
BROTLI_PARAM_NDIRECT: 8,
|
||||
BROTLI_DECODER_RESULT_ERROR: 0,
|
||||
BROTLI_DECODER_RESULT_SUCCESS: 1,
|
||||
BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
|
||||
BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
|
||||
BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
|
||||
BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
|
||||
BROTLI_DECODER_NO_ERROR: 0,
|
||||
BROTLI_DECODER_SUCCESS: 1,
|
||||
BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
|
||||
BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
|
||||
BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
|
||||
BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
|
||||
BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
|
||||
BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
|
||||
BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
|
||||
BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
|
||||
BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
|
||||
BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
|
||||
BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
|
||||
BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
|
||||
BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
|
||||
BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
|
||||
BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
|
||||
BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
|
||||
BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
|
||||
BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
|
||||
BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
|
||||
BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
|
||||
BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
|
||||
BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
|
||||
BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
|
||||
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
|
||||
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
|
||||
BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
|
||||
BROTLI_DECODER_ERROR_UNREACHABLE: -31,
|
||||
}, realZlibConstants));
|
||||
//# sourceMappingURL=constants.js.map
|
||||
1
node_modules/minizlib/dist/commonjs/constants.js.map
generated
vendored
Normal file
1
node_modules/minizlib/dist/commonjs/constants.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
89
node_modules/minizlib/dist/commonjs/index.d.ts
generated
vendored
Normal file
89
node_modules/minizlib/dist/commonjs/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
import { Buffer } from 'buffer';
|
||||
import { Minipass } from 'minipass';
|
||||
import * as realZlib from 'zlib';
|
||||
export { constants } from './constants.js';
|
||||
declare const _superWrite: unique symbol;
|
||||
export declare class ZlibError extends Error {
|
||||
code?: string;
|
||||
errno?: number;
|
||||
constructor(err: NodeJS.ErrnoException | Error);
|
||||
get name(): string;
|
||||
}
|
||||
declare const _flushFlag: unique symbol;
|
||||
export type ChunkWithFlushFlag = Minipass.ContiguousData & {
|
||||
[_flushFlag]?: number;
|
||||
};
|
||||
export type ZlibBaseOptions = Minipass.Options<Minipass.ContiguousData> & {
|
||||
flush?: number;
|
||||
finishFlush?: number;
|
||||
fullFlushFlag?: number;
|
||||
};
|
||||
export type ZlibMode = 'Gzip' | 'Gunzip' | 'Deflate' | 'Inflate' | 'DeflateRaw' | 'InflateRaw' | 'Unzip';
|
||||
export type ZlibHandle = realZlib.Gzip | realZlib.Gunzip | realZlib.Deflate | realZlib.Inflate | realZlib.DeflateRaw | realZlib.InflateRaw;
|
||||
export type BrotliMode = 'BrotliCompress' | 'BrotliDecompress';
|
||||
declare abstract class ZlibBase extends Minipass<Buffer, ChunkWithFlushFlag> {
|
||||
#private;
|
||||
get sawError(): boolean;
|
||||
get handle(): ZlibHandle | undefined;
|
||||
get flushFlag(): number;
|
||||
constructor(opts: ZlibBaseOptions, mode: ZlibMode | BrotliMode);
|
||||
close(): void;
|
||||
reset(): any;
|
||||
flush(flushFlag?: number): void;
|
||||
end(cb?: () => void): this;
|
||||
end(chunk: ChunkWithFlushFlag, cb?: () => void): this;
|
||||
end(chunk: ChunkWithFlushFlag, encoding?: Minipass.Encoding, cb?: () => void): this;
|
||||
get ended(): boolean;
|
||||
[_superWrite](data: Buffer & {
|
||||
[_flushFlag]?: number;
|
||||
}): boolean;
|
||||
write(chunk: ChunkWithFlushFlag, cb?: () => void): boolean;
|
||||
write(chunk: ChunkWithFlushFlag, encoding?: Minipass.Encoding, cb?: () => void): boolean;
|
||||
}
|
||||
export type ZlibOptions = ZlibBaseOptions & {
|
||||
level?: number;
|
||||
strategy?: number;
|
||||
};
|
||||
export declare class Zlib extends ZlibBase {
|
||||
#private;
|
||||
constructor(opts: ZlibOptions, mode: ZlibMode);
|
||||
params(level: number, strategy: number): void;
|
||||
}
|
||||
export declare class Deflate extends Zlib {
|
||||
constructor(opts: ZlibOptions);
|
||||
}
|
||||
export declare class Inflate extends Zlib {
|
||||
constructor(opts: ZlibOptions);
|
||||
}
|
||||
export type GzipOptions = ZlibOptions & {
|
||||
portable?: boolean;
|
||||
};
|
||||
export declare class Gzip extends Zlib {
|
||||
#private;
|
||||
constructor(opts: GzipOptions);
|
||||
[_superWrite](data: Buffer & {
|
||||
[_flushFlag]?: number;
|
||||
}): boolean;
|
||||
}
|
||||
export declare class Gunzip extends Zlib {
|
||||
constructor(opts: ZlibOptions);
|
||||
}
|
||||
export declare class DeflateRaw extends Zlib {
|
||||
constructor(opts: ZlibOptions);
|
||||
}
|
||||
export declare class InflateRaw extends Zlib {
|
||||
constructor(opts: ZlibOptions);
|
||||
}
|
||||
export declare class Unzip extends Zlib {
|
||||
constructor(opts: ZlibOptions);
|
||||
}
|
||||
export declare class Brotli extends ZlibBase {
|
||||
constructor(opts: ZlibOptions, mode: BrotliMode);
|
||||
}
|
||||
export declare class BrotliCompress extends Brotli {
|
||||
constructor(opts: ZlibOptions);
|
||||
}
|
||||
export declare class BrotliDecompress extends Brotli {
|
||||
constructor(opts: ZlibOptions);
|
||||
}
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/minizlib/dist/commonjs/index.d.ts.map
generated
vendored
Normal file
1
node_modules/minizlib/dist/commonjs/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ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AAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAC9D,qBAAa,IAAK,SAAQ,IAAI;;gBAEhB,IAAI,EAAE,WAAW;IAK7B,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,CAAC,UAAU,CAAC,CAAC,EAAE,MAAM,CAAA;KAAE;CASvD;AAED,qBAAa,MAAO,SAAQ,IAAI;gBAClB,IAAI,EAAE,WAAW;CAG9B;AAGD,qBAAa,UAAW,SAAQ,IAAI;gBACtB,IAAI,EAAE,WAAW;CAG9B;AAED,qBAAa,UAAW,SAAQ,IAAI;gBACtB,IAAI,EAAE,WAAW;CAG9B;AAGD,qBAAa,KAAM,SAAQ,IAAI;gBACjB,IAAI,EAAE,WAAW;CAG9B;AAED,qBAAa,MAAO,SAAQ,QAAQ;gBACtB,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU;CAShD;AAED,qBAAa,cAAe,SAAQ,MAAM;gBAC5B,IAAI,EAAE,WAAW;CAG9B;AAED,qBAAa,gBAAiB,SAAQ,MAAM;gBAC9B,IAAI,EAAE,WAAW;CAG9B"}
|
||||
392
node_modules/minizlib/dist/commonjs/index.js
generated
vendored
Normal file
392
node_modules/minizlib/dist/commonjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,392 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BrotliDecompress = exports.BrotliCompress = exports.Brotli = exports.Unzip = exports.InflateRaw = exports.DeflateRaw = exports.Gunzip = exports.Gzip = exports.Inflate = exports.Deflate = exports.Zlib = exports.ZlibError = exports.constants = void 0;
|
||||
const assert_1 = __importDefault(require("assert"));
|
||||
const buffer_1 = require("buffer");
|
||||
const minipass_1 = require("minipass");
|
||||
const realZlib = __importStar(require("zlib"));
|
||||
const constants_js_1 = require("./constants.js");
|
||||
var constants_js_2 = require("./constants.js");
|
||||
Object.defineProperty(exports, "constants", { enumerable: true, get: function () { return constants_js_2.constants; } });
|
||||
const OriginalBufferConcat = buffer_1.Buffer.concat;
|
||||
const desc = Object.getOwnPropertyDescriptor(buffer_1.Buffer, 'concat');
|
||||
const noop = (args) => args;
|
||||
const passthroughBufferConcat = desc?.writable === true || desc?.set !== undefined
|
||||
? (makeNoOp) => {
|
||||
buffer_1.Buffer.concat = makeNoOp ? noop : OriginalBufferConcat;
|
||||
}
|
||||
: (_) => { };
|
||||
const _superWrite = Symbol('_superWrite');
|
||||
class ZlibError extends Error {
|
||||
code;
|
||||
errno;
|
||||
constructor(err) {
|
||||
super('zlib: ' + err.message);
|
||||
this.code = err.code;
|
||||
this.errno = err.errno;
|
||||
/* c8 ignore next */
|
||||
if (!this.code)
|
||||
this.code = 'ZLIB_ERROR';
|
||||
this.message = 'zlib: ' + err.message;
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
get name() {
|
||||
return 'ZlibError';
|
||||
}
|
||||
}
|
||||
exports.ZlibError = ZlibError;
|
||||
// the Zlib class they all inherit from
|
||||
// This thing manages the queue of requests, and returns
|
||||
// true or false if there is anything in the queue when
|
||||
// you call the .write() method.
|
||||
const _flushFlag = Symbol('flushFlag');
|
||||
class ZlibBase extends minipass_1.Minipass {
|
||||
#sawError = false;
|
||||
#ended = false;
|
||||
#flushFlag;
|
||||
#finishFlushFlag;
|
||||
#fullFlushFlag;
|
||||
#handle;
|
||||
#onError;
|
||||
get sawError() {
|
||||
return this.#sawError;
|
||||
}
|
||||
get handle() {
|
||||
return this.#handle;
|
||||
}
|
||||
/* c8 ignore start */
|
||||
get flushFlag() {
|
||||
return this.#flushFlag;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
constructor(opts, mode) {
|
||||
if (!opts || typeof opts !== 'object')
|
||||
throw new TypeError('invalid options for ZlibBase constructor');
|
||||
//@ts-ignore
|
||||
super(opts);
|
||||
/* c8 ignore start */
|
||||
this.#flushFlag = opts.flush ?? 0;
|
||||
this.#finishFlushFlag = opts.finishFlush ?? 0;
|
||||
this.#fullFlushFlag = opts.fullFlushFlag ?? 0;
|
||||
/* c8 ignore stop */
|
||||
// this will throw if any options are invalid for the class selected
|
||||
try {
|
||||
// @types/node doesn't know that it exports the classes, but they're there
|
||||
//@ts-ignore
|
||||
this.#handle = new realZlib[mode](opts);
|
||||
}
|
||||
catch (er) {
|
||||
// make sure that all errors get decorated properly
|
||||
throw new ZlibError(er);
|
||||
}
|
||||
this.#onError = err => {
|
||||
// no sense raising multiple errors, since we abort on the first one.
|
||||
if (this.#sawError)
|
||||
return;
|
||||
this.#sawError = true;
|
||||
// there is no way to cleanly recover.
|
||||
// continuing only obscures problems.
|
||||
this.close();
|
||||
this.emit('error', err);
|
||||
};
|
||||
this.#handle?.on('error', er => this.#onError(new ZlibError(er)));
|
||||
this.once('end', () => this.close);
|
||||
}
|
||||
close() {
|
||||
if (this.#handle) {
|
||||
this.#handle.close();
|
||||
this.#handle = undefined;
|
||||
this.emit('close');
|
||||
}
|
||||
}
|
||||
reset() {
|
||||
if (!this.#sawError) {
|
||||
(0, assert_1.default)(this.#handle, 'zlib binding closed');
|
||||
//@ts-ignore
|
||||
return this.#handle.reset?.();
|
||||
}
|
||||
}
|
||||
flush(flushFlag) {
|
||||
if (this.ended)
|
||||
return;
|
||||
if (typeof flushFlag !== 'number')
|
||||
flushFlag = this.#fullFlushFlag;
|
||||
this.write(Object.assign(buffer_1.Buffer.alloc(0), { [_flushFlag]: flushFlag }));
|
||||
}
|
||||
end(chunk, encoding, cb) {
|
||||
/* c8 ignore start */
|
||||
if (typeof chunk === 'function') {
|
||||
cb = chunk;
|
||||
encoding = undefined;
|
||||
chunk = undefined;
|
||||
}
|
||||
if (typeof encoding === 'function') {
|
||||
cb = encoding;
|
||||
encoding = undefined;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
if (chunk) {
|
||||
if (encoding)
|
||||
this.write(chunk, encoding);
|
||||
else
|
||||
this.write(chunk);
|
||||
}
|
||||
this.flush(this.#finishFlushFlag);
|
||||
this.#ended = true;
|
||||
return super.end(cb);
|
||||
}
|
||||
get ended() {
|
||||
return this.#ended;
|
||||
}
|
||||
// overridden in the gzip classes to do portable writes
|
||||
[_superWrite](data) {
|
||||
return super.write(data);
|
||||
}
|
||||
write(chunk, encoding, cb) {
|
||||
// process the chunk using the sync process
|
||||
// then super.write() all the outputted chunks
|
||||
if (typeof encoding === 'function')
|
||||
(cb = encoding), (encoding = 'utf8');
|
||||
if (typeof chunk === 'string')
|
||||
chunk = buffer_1.Buffer.from(chunk, encoding);
|
||||
if (this.#sawError)
|
||||
return;
|
||||
(0, assert_1.default)(this.#handle, 'zlib binding closed');
|
||||
// _processChunk tries to .close() the native handle after it's done, so we
|
||||
// intercept that by temporarily making it a no-op.
|
||||
// diving into the node:zlib internals a bit here
|
||||
const nativeHandle = this.#handle
|
||||
._handle;
|
||||
const originalNativeClose = nativeHandle.close;
|
||||
nativeHandle.close = () => { };
|
||||
const originalClose = this.#handle.close;
|
||||
this.#handle.close = () => { };
|
||||
// It also calls `Buffer.concat()` at the end, which may be convenient
|
||||
// for some, but which we are not interested in as it slows us down.
|
||||
passthroughBufferConcat(true);
|
||||
let result = undefined;
|
||||
try {
|
||||
const flushFlag = typeof chunk[_flushFlag] === 'number'
|
||||
? chunk[_flushFlag]
|
||||
: this.#flushFlag;
|
||||
result = this.#handle._processChunk(chunk, flushFlag);
|
||||
// if we don't throw, reset it back how it was
|
||||
passthroughBufferConcat(false);
|
||||
}
|
||||
catch (err) {
|
||||
// or if we do, put Buffer.concat() back before we emit error
|
||||
// Error events call into user code, which may call Buffer.concat()
|
||||
passthroughBufferConcat(false);
|
||||
this.#onError(new ZlibError(err));
|
||||
}
|
||||
finally {
|
||||
if (this.#handle) {
|
||||
// Core zlib resets `_handle` to null after attempting to close the
|
||||
// native handle. Our no-op handler prevented actual closure, but we
|
||||
// need to restore the `._handle` property.
|
||||
;
|
||||
this.#handle._handle =
|
||||
nativeHandle;
|
||||
nativeHandle.close = originalNativeClose;
|
||||
this.#handle.close = originalClose;
|
||||
// `_processChunk()` adds an 'error' listener. If we don't remove it
|
||||
// after each call, these handlers start piling up.
|
||||
this.#handle.removeAllListeners('error');
|
||||
// make sure OUR error listener is still attached tho
|
||||
}
|
||||
}
|
||||
if (this.#handle)
|
||||
this.#handle.on('error', er => this.#onError(new ZlibError(er)));
|
||||
let writeReturn;
|
||||
if (result) {
|
||||
if (Array.isArray(result) && result.length > 0) {
|
||||
const r = result[0];
|
||||
// The first buffer is always `handle._outBuffer`, which would be
|
||||
// re-used for later invocations; so, we always have to copy that one.
|
||||
writeReturn = this[_superWrite](buffer_1.Buffer.from(r));
|
||||
for (let i = 1; i < result.length; i++) {
|
||||
writeReturn = this[_superWrite](result[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// either a single Buffer or an empty array
|
||||
writeReturn = this[_superWrite](buffer_1.Buffer.from(result));
|
||||
}
|
||||
}
|
||||
if (cb)
|
||||
cb();
|
||||
return writeReturn;
|
||||
}
|
||||
}
|
||||
class Zlib extends ZlibBase {
|
||||
#level;
|
||||
#strategy;
|
||||
constructor(opts, mode) {
|
||||
opts = opts || {};
|
||||
opts.flush = opts.flush || constants_js_1.constants.Z_NO_FLUSH;
|
||||
opts.finishFlush = opts.finishFlush || constants_js_1.constants.Z_FINISH;
|
||||
opts.fullFlushFlag = constants_js_1.constants.Z_FULL_FLUSH;
|
||||
super(opts, mode);
|
||||
this.#level = opts.level;
|
||||
this.#strategy = opts.strategy;
|
||||
}
|
||||
params(level, strategy) {
|
||||
if (this.sawError)
|
||||
return;
|
||||
if (!this.handle)
|
||||
throw new Error('cannot switch params when binding is closed');
|
||||
// no way to test this without also not supporting params at all
|
||||
/* c8 ignore start */
|
||||
if (!this.handle.params)
|
||||
throw new Error('not supported in this implementation');
|
||||
/* c8 ignore stop */
|
||||
if (this.#level !== level || this.#strategy !== strategy) {
|
||||
this.flush(constants_js_1.constants.Z_SYNC_FLUSH);
|
||||
(0, assert_1.default)(this.handle, 'zlib binding closed');
|
||||
// .params() calls .flush(), but the latter is always async in the
|
||||
// core zlib. We override .flush() temporarily to intercept that and
|
||||
// flush synchronously.
|
||||
const origFlush = this.handle.flush;
|
||||
this.handle.flush = (flushFlag, cb) => {
|
||||
/* c8 ignore start */
|
||||
if (typeof flushFlag === 'function') {
|
||||
cb = flushFlag;
|
||||
flushFlag = this.flushFlag;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
this.flush(flushFlag);
|
||||
cb?.();
|
||||
};
|
||||
try {
|
||||
;
|
||||
this.handle.params(level, strategy);
|
||||
}
|
||||
finally {
|
||||
this.handle.flush = origFlush;
|
||||
}
|
||||
/* c8 ignore start */
|
||||
if (this.handle) {
|
||||
this.#level = level;
|
||||
this.#strategy = strategy;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Zlib = Zlib;
|
||||
// minimal 2-byte header
|
||||
class Deflate extends Zlib {
|
||||
constructor(opts) {
|
||||
super(opts, 'Deflate');
|
||||
}
|
||||
}
|
||||
exports.Deflate = Deflate;
|
||||
class Inflate extends Zlib {
|
||||
constructor(opts) {
|
||||
super(opts, 'Inflate');
|
||||
}
|
||||
}
|
||||
exports.Inflate = Inflate;
|
||||
class Gzip extends Zlib {
|
||||
#portable;
|
||||
constructor(opts) {
|
||||
super(opts, 'Gzip');
|
||||
this.#portable = opts && !!opts.portable;
|
||||
}
|
||||
[_superWrite](data) {
|
||||
if (!this.#portable)
|
||||
return super[_superWrite](data);
|
||||
// we'll always get the header emitted in one first chunk
|
||||
// overwrite the OS indicator byte with 0xFF
|
||||
this.#portable = false;
|
||||
data[9] = 255;
|
||||
return super[_superWrite](data);
|
||||
}
|
||||
}
|
||||
exports.Gzip = Gzip;
|
||||
class Gunzip extends Zlib {
|
||||
constructor(opts) {
|
||||
super(opts, 'Gunzip');
|
||||
}
|
||||
}
|
||||
exports.Gunzip = Gunzip;
|
||||
// raw - no header
|
||||
class DeflateRaw extends Zlib {
|
||||
constructor(opts) {
|
||||
super(opts, 'DeflateRaw');
|
||||
}
|
||||
}
|
||||
exports.DeflateRaw = DeflateRaw;
|
||||
class InflateRaw extends Zlib {
|
||||
constructor(opts) {
|
||||
super(opts, 'InflateRaw');
|
||||
}
|
||||
}
|
||||
exports.InflateRaw = InflateRaw;
|
||||
// auto-detect header.
|
||||
class Unzip extends Zlib {
|
||||
constructor(opts) {
|
||||
super(opts, 'Unzip');
|
||||
}
|
||||
}
|
||||
exports.Unzip = Unzip;
|
||||
class Brotli extends ZlibBase {
|
||||
constructor(opts, mode) {
|
||||
opts = opts || {};
|
||||
opts.flush = opts.flush || constants_js_1.constants.BROTLI_OPERATION_PROCESS;
|
||||
opts.finishFlush =
|
||||
opts.finishFlush || constants_js_1.constants.BROTLI_OPERATION_FINISH;
|
||||
opts.fullFlushFlag = constants_js_1.constants.BROTLI_OPERATION_FLUSH;
|
||||
super(opts, mode);
|
||||
}
|
||||
}
|
||||
exports.Brotli = Brotli;
|
||||
class BrotliCompress extends Brotli {
|
||||
constructor(opts) {
|
||||
super(opts, 'BrotliCompress');
|
||||
}
|
||||
}
|
||||
exports.BrotliCompress = BrotliCompress;
|
||||
class BrotliDecompress extends Brotli {
|
||||
constructor(opts) {
|
||||
super(opts, 'BrotliDecompress');
|
||||
}
|
||||
}
|
||||
exports.BrotliDecompress = BrotliDecompress;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/minizlib/dist/commonjs/index.js.map
generated
vendored
Normal file
1
node_modules/minizlib/dist/commonjs/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/minizlib/dist/commonjs/package.json
generated
vendored
Normal file
3
node_modules/minizlib/dist/commonjs/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
2
node_modules/minizlib/dist/esm/constants.d.ts
generated
vendored
Normal file
2
node_modules/minizlib/dist/esm/constants.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare const constants: any;
|
||||
//# sourceMappingURL=constants.d.ts.map
|
||||
1
node_modules/minizlib/dist/esm/constants.d.ts.map
generated
vendored
Normal file
1
node_modules/minizlib/dist/esm/constants.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,SAAS,KAiHrB,CAAA"}
|
||||
117
node_modules/minizlib/dist/esm/constants.js
generated
vendored
Normal file
117
node_modules/minizlib/dist/esm/constants.js
generated
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
// Update with any zlib constants that are added or changed in the future.
|
||||
// Node v6 didn't export this, so we just hard code the version and rely
|
||||
// on all the other hard-coded values from zlib v4736. When node v6
|
||||
// support drops, we can just export the realZlibConstants object.
|
||||
import realZlib from 'zlib';
|
||||
/* c8 ignore start */
|
||||
const realZlibConstants = realZlib.constants || { ZLIB_VERNUM: 4736 };
|
||||
/* c8 ignore stop */
|
||||
export const constants = Object.freeze(Object.assign(Object.create(null), {
|
||||
Z_NO_FLUSH: 0,
|
||||
Z_PARTIAL_FLUSH: 1,
|
||||
Z_SYNC_FLUSH: 2,
|
||||
Z_FULL_FLUSH: 3,
|
||||
Z_FINISH: 4,
|
||||
Z_BLOCK: 5,
|
||||
Z_OK: 0,
|
||||
Z_STREAM_END: 1,
|
||||
Z_NEED_DICT: 2,
|
||||
Z_ERRNO: -1,
|
||||
Z_STREAM_ERROR: -2,
|
||||
Z_DATA_ERROR: -3,
|
||||
Z_MEM_ERROR: -4,
|
||||
Z_BUF_ERROR: -5,
|
||||
Z_VERSION_ERROR: -6,
|
||||
Z_NO_COMPRESSION: 0,
|
||||
Z_BEST_SPEED: 1,
|
||||
Z_BEST_COMPRESSION: 9,
|
||||
Z_DEFAULT_COMPRESSION: -1,
|
||||
Z_FILTERED: 1,
|
||||
Z_HUFFMAN_ONLY: 2,
|
||||
Z_RLE: 3,
|
||||
Z_FIXED: 4,
|
||||
Z_DEFAULT_STRATEGY: 0,
|
||||
DEFLATE: 1,
|
||||
INFLATE: 2,
|
||||
GZIP: 3,
|
||||
GUNZIP: 4,
|
||||
DEFLATERAW: 5,
|
||||
INFLATERAW: 6,
|
||||
UNZIP: 7,
|
||||
BROTLI_DECODE: 8,
|
||||
BROTLI_ENCODE: 9,
|
||||
Z_MIN_WINDOWBITS: 8,
|
||||
Z_MAX_WINDOWBITS: 15,
|
||||
Z_DEFAULT_WINDOWBITS: 15,
|
||||
Z_MIN_CHUNK: 64,
|
||||
Z_MAX_CHUNK: Infinity,
|
||||
Z_DEFAULT_CHUNK: 16384,
|
||||
Z_MIN_MEMLEVEL: 1,
|
||||
Z_MAX_MEMLEVEL: 9,
|
||||
Z_DEFAULT_MEMLEVEL: 8,
|
||||
Z_MIN_LEVEL: -1,
|
||||
Z_MAX_LEVEL: 9,
|
||||
Z_DEFAULT_LEVEL: -1,
|
||||
BROTLI_OPERATION_PROCESS: 0,
|
||||
BROTLI_OPERATION_FLUSH: 1,
|
||||
BROTLI_OPERATION_FINISH: 2,
|
||||
BROTLI_OPERATION_EMIT_METADATA: 3,
|
||||
BROTLI_MODE_GENERIC: 0,
|
||||
BROTLI_MODE_TEXT: 1,
|
||||
BROTLI_MODE_FONT: 2,
|
||||
BROTLI_DEFAULT_MODE: 0,
|
||||
BROTLI_MIN_QUALITY: 0,
|
||||
BROTLI_MAX_QUALITY: 11,
|
||||
BROTLI_DEFAULT_QUALITY: 11,
|
||||
BROTLI_MIN_WINDOW_BITS: 10,
|
||||
BROTLI_MAX_WINDOW_BITS: 24,
|
||||
BROTLI_LARGE_MAX_WINDOW_BITS: 30,
|
||||
BROTLI_DEFAULT_WINDOW: 22,
|
||||
BROTLI_MIN_INPUT_BLOCK_BITS: 16,
|
||||
BROTLI_MAX_INPUT_BLOCK_BITS: 24,
|
||||
BROTLI_PARAM_MODE: 0,
|
||||
BROTLI_PARAM_QUALITY: 1,
|
||||
BROTLI_PARAM_LGWIN: 2,
|
||||
BROTLI_PARAM_LGBLOCK: 3,
|
||||
BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
|
||||
BROTLI_PARAM_SIZE_HINT: 5,
|
||||
BROTLI_PARAM_LARGE_WINDOW: 6,
|
||||
BROTLI_PARAM_NPOSTFIX: 7,
|
||||
BROTLI_PARAM_NDIRECT: 8,
|
||||
BROTLI_DECODER_RESULT_ERROR: 0,
|
||||
BROTLI_DECODER_RESULT_SUCCESS: 1,
|
||||
BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
|
||||
BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
|
||||
BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
|
||||
BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
|
||||
BROTLI_DECODER_NO_ERROR: 0,
|
||||
BROTLI_DECODER_SUCCESS: 1,
|
||||
BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
|
||||
BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
|
||||
BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
|
||||
BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
|
||||
BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
|
||||
BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
|
||||
BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
|
||||
BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
|
||||
BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
|
||||
BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
|
||||
BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
|
||||
BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
|
||||
BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
|
||||
BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
|
||||
BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
|
||||
BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
|
||||
BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
|
||||
BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
|
||||
BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
|
||||
BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
|
||||
BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
|
||||
BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
|
||||
BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
|
||||
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
|
||||
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
|
||||
BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
|
||||
BROTLI_DECODER_ERROR_UNREACHABLE: -31,
|
||||
}, realZlibConstants));
|
||||
//# sourceMappingURL=constants.js.map
|
||||
1
node_modules/minizlib/dist/esm/constants.js.map
generated
vendored
Normal file
1
node_modules/minizlib/dist/esm/constants.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
89
node_modules/minizlib/dist/esm/index.d.ts
generated
vendored
Normal file
89
node_modules/minizlib/dist/esm/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
import { Buffer } from 'buffer';
|
||||
import { Minipass } from 'minipass';
|
||||
import * as realZlib from 'zlib';
|
||||
export { constants } from './constants.js';
|
||||
declare const _superWrite: unique symbol;
|
||||
export declare class ZlibError extends Error {
|
||||
code?: string;
|
||||
errno?: number;
|
||||
constructor(err: NodeJS.ErrnoException | Error);
|
||||
get name(): string;
|
||||
}
|
||||
declare const _flushFlag: unique symbol;
|
||||
export type ChunkWithFlushFlag = Minipass.ContiguousData & {
|
||||
[_flushFlag]?: number;
|
||||
};
|
||||
export type ZlibBaseOptions = Minipass.Options<Minipass.ContiguousData> & {
|
||||
flush?: number;
|
||||
finishFlush?: number;
|
||||
fullFlushFlag?: number;
|
||||
};
|
||||
export type ZlibMode = 'Gzip' | 'Gunzip' | 'Deflate' | 'Inflate' | 'DeflateRaw' | 'InflateRaw' | 'Unzip';
|
||||
export type ZlibHandle = realZlib.Gzip | realZlib.Gunzip | realZlib.Deflate | realZlib.Inflate | realZlib.DeflateRaw | realZlib.InflateRaw;
|
||||
export type BrotliMode = 'BrotliCompress' | 'BrotliDecompress';
|
||||
declare abstract class ZlibBase extends Minipass<Buffer, ChunkWithFlushFlag> {
|
||||
#private;
|
||||
get sawError(): boolean;
|
||||
get handle(): ZlibHandle | undefined;
|
||||
get flushFlag(): number;
|
||||
constructor(opts: ZlibBaseOptions, mode: ZlibMode | BrotliMode);
|
||||
close(): void;
|
||||
reset(): any;
|
||||
flush(flushFlag?: number): void;
|
||||
end(cb?: () => void): this;
|
||||
end(chunk: ChunkWithFlushFlag, cb?: () => void): this;
|
||||
end(chunk: ChunkWithFlushFlag, encoding?: Minipass.Encoding, cb?: () => void): this;
|
||||
get ended(): boolean;
|
||||
[_superWrite](data: Buffer & {
|
||||
[_flushFlag]?: number;
|
||||
}): boolean;
|
||||
write(chunk: ChunkWithFlushFlag, cb?: () => void): boolean;
|
||||
write(chunk: ChunkWithFlushFlag, encoding?: Minipass.Encoding, cb?: () => void): boolean;
|
||||
}
|
||||
export type ZlibOptions = ZlibBaseOptions & {
|
||||
level?: number;
|
||||
strategy?: number;
|
||||
};
|
||||
export declare class Zlib extends ZlibBase {
|
||||
#private;
|
||||
constructor(opts: ZlibOptions, mode: ZlibMode);
|
||||
params(level: number, strategy: number): void;
|
||||
}
|
||||
export declare class Deflate extends Zlib {
|
||||
constructor(opts: ZlibOptions);
|
||||
}
|
||||
export declare class Inflate extends Zlib {
|
||||
constructor(opts: ZlibOptions);
|
||||
}
|
||||
export type GzipOptions = ZlibOptions & {
|
||||
portable?: boolean;
|
||||
};
|
||||
export declare class Gzip extends Zlib {
|
||||
#private;
|
||||
constructor(opts: GzipOptions);
|
||||
[_superWrite](data: Buffer & {
|
||||
[_flushFlag]?: number;
|
||||
}): boolean;
|
||||
}
|
||||
export declare class Gunzip extends Zlib {
|
||||
constructor(opts: ZlibOptions);
|
||||
}
|
||||
export declare class DeflateRaw extends Zlib {
|
||||
constructor(opts: ZlibOptions);
|
||||
}
|
||||
export declare class InflateRaw extends Zlib {
|
||||
constructor(opts: ZlibOptions);
|
||||
}
|
||||
export declare class Unzip extends Zlib {
|
||||
constructor(opts: ZlibOptions);
|
||||
}
|
||||
export declare class Brotli extends ZlibBase {
|
||||
constructor(opts: ZlibOptions, mode: BrotliMode);
|
||||
}
|
||||
export declare class BrotliCompress extends Brotli {
|
||||
constructor(opts: ZlibOptions);
|
||||
}
|
||||
export declare class BrotliDecompress extends Brotli {
|
||||
constructor(opts: ZlibOptions);
|
||||
}
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/minizlib/dist/esm/index.d.ts.map
generated
vendored
Normal file
1
node_modules/minizlib/dist/esm/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,KAAK,QAAQ,MAAM,MAAM,CAAA;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAY1C,QAAA,MAAM,WAAW,eAAwB,CAAA;AAEzC,qBAAa,SAAU,SAAQ,KAAK;IAClC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;gBACF,GAAG,EAAE,MAAM,CAAC,cAAc,GAAG,KAAK;IAW9C,IAAI,IAAI,WAEP;CACF;AAMD,QAAA,MAAM,UAAU,eAAsB,CAAA;AAEtC,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,cAAc,GAAG;IACzD,CAAC,UAAU,CAAC,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG;IACxE,KAAK,C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AAa,gBAAiB,SAAQ,MAAM;gBAC9B,IAAI,EAAE,WAAW;CAG9B"}
|
||||
340
node_modules/minizlib/dist/esm/index.js
generated
vendored
Normal file
340
node_modules/minizlib/dist/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,340 @@
|
||||
import assert from 'assert';
|
||||
import { Buffer } from 'buffer';
|
||||
import { Minipass } from 'minipass';
|
||||
import * as realZlib from 'zlib';
|
||||
import { constants } from './constants.js';
|
||||
export { constants } from './constants.js';
|
||||
const OriginalBufferConcat = Buffer.concat;
|
||||
const desc = Object.getOwnPropertyDescriptor(Buffer, 'concat');
|
||||
const noop = (args) => args;
|
||||
const passthroughBufferConcat = desc?.writable === true || desc?.set !== undefined
|
||||
? (makeNoOp) => {
|
||||
Buffer.concat = makeNoOp ? noop : OriginalBufferConcat;
|
||||
}
|
||||
: (_) => { };
|
||||
const _superWrite = Symbol('_superWrite');
|
||||
export class ZlibError extends Error {
|
||||
code;
|
||||
errno;
|
||||
constructor(err) {
|
||||
super('zlib: ' + err.message);
|
||||
this.code = err.code;
|
||||
this.errno = err.errno;
|
||||
/* c8 ignore next */
|
||||
if (!this.code)
|
||||
this.code = 'ZLIB_ERROR';
|
||||
this.message = 'zlib: ' + err.message;
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
get name() {
|
||||
return 'ZlibError';
|
||||
}
|
||||
}
|
||||
// the Zlib class they all inherit from
|
||||
// This thing manages the queue of requests, and returns
|
||||
// true or false if there is anything in the queue when
|
||||
// you call the .write() method.
|
||||
const _flushFlag = Symbol('flushFlag');
|
||||
class ZlibBase extends Minipass {
|
||||
#sawError = false;
|
||||
#ended = false;
|
||||
#flushFlag;
|
||||
#finishFlushFlag;
|
||||
#fullFlushFlag;
|
||||
#handle;
|
||||
#onError;
|
||||
get sawError() {
|
||||
return this.#sawError;
|
||||
}
|
||||
get handle() {
|
||||
return this.#handle;
|
||||
}
|
||||
/* c8 ignore start */
|
||||
get flushFlag() {
|
||||
return this.#flushFlag;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
constructor(opts, mode) {
|
||||
if (!opts || typeof opts !== 'object')
|
||||
throw new TypeError('invalid options for ZlibBase constructor');
|
||||
//@ts-ignore
|
||||
super(opts);
|
||||
/* c8 ignore start */
|
||||
this.#flushFlag = opts.flush ?? 0;
|
||||
this.#finishFlushFlag = opts.finishFlush ?? 0;
|
||||
this.#fullFlushFlag = opts.fullFlushFlag ?? 0;
|
||||
/* c8 ignore stop */
|
||||
// this will throw if any options are invalid for the class selected
|
||||
try {
|
||||
// @types/node doesn't know that it exports the classes, but they're there
|
||||
//@ts-ignore
|
||||
this.#handle = new realZlib[mode](opts);
|
||||
}
|
||||
catch (er) {
|
||||
// make sure that all errors get decorated properly
|
||||
throw new ZlibError(er);
|
||||
}
|
||||
this.#onError = err => {
|
||||
// no sense raising multiple errors, since we abort on the first one.
|
||||
if (this.#sawError)
|
||||
return;
|
||||
this.#sawError = true;
|
||||
// there is no way to cleanly recover.
|
||||
// continuing only obscures problems.
|
||||
this.close();
|
||||
this.emit('error', err);
|
||||
};
|
||||
this.#handle?.on('error', er => this.#onError(new ZlibError(er)));
|
||||
this.once('end', () => this.close);
|
||||
}
|
||||
close() {
|
||||
if (this.#handle) {
|
||||
this.#handle.close();
|
||||
this.#handle = undefined;
|
||||
this.emit('close');
|
||||
}
|
||||
}
|
||||
reset() {
|
||||
if (!this.#sawError) {
|
||||
assert(this.#handle, 'zlib binding closed');
|
||||
//@ts-ignore
|
||||
return this.#handle.reset?.();
|
||||
}
|
||||
}
|
||||
flush(flushFlag) {
|
||||
if (this.ended)
|
||||
return;
|
||||
if (typeof flushFlag !== 'number')
|
||||
flushFlag = this.#fullFlushFlag;
|
||||
this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag }));
|
||||
}
|
||||
end(chunk, encoding, cb) {
|
||||
/* c8 ignore start */
|
||||
if (typeof chunk === 'function') {
|
||||
cb = chunk;
|
||||
encoding = undefined;
|
||||
chunk = undefined;
|
||||
}
|
||||
if (typeof encoding === 'function') {
|
||||
cb = encoding;
|
||||
encoding = undefined;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
if (chunk) {
|
||||
if (encoding)
|
||||
this.write(chunk, encoding);
|
||||
else
|
||||
this.write(chunk);
|
||||
}
|
||||
this.flush(this.#finishFlushFlag);
|
||||
this.#ended = true;
|
||||
return super.end(cb);
|
||||
}
|
||||
get ended() {
|
||||
return this.#ended;
|
||||
}
|
||||
// overridden in the gzip classes to do portable writes
|
||||
[_superWrite](data) {
|
||||
return super.write(data);
|
||||
}
|
||||
write(chunk, encoding, cb) {
|
||||
// process the chunk using the sync process
|
||||
// then super.write() all the outputted chunks
|
||||
if (typeof encoding === 'function')
|
||||
(cb = encoding), (encoding = 'utf8');
|
||||
if (typeof chunk === 'string')
|
||||
chunk = Buffer.from(chunk, encoding);
|
||||
if (this.#sawError)
|
||||
return;
|
||||
assert(this.#handle, 'zlib binding closed');
|
||||
// _processChunk tries to .close() the native handle after it's done, so we
|
||||
// intercept that by temporarily making it a no-op.
|
||||
// diving into the node:zlib internals a bit here
|
||||
const nativeHandle = this.#handle
|
||||
._handle;
|
||||
const originalNativeClose = nativeHandle.close;
|
||||
nativeHandle.close = () => { };
|
||||
const originalClose = this.#handle.close;
|
||||
this.#handle.close = () => { };
|
||||
// It also calls `Buffer.concat()` at the end, which may be convenient
|
||||
// for some, but which we are not interested in as it slows us down.
|
||||
passthroughBufferConcat(true);
|
||||
let result = undefined;
|
||||
try {
|
||||
const flushFlag = typeof chunk[_flushFlag] === 'number'
|
||||
? chunk[_flushFlag]
|
||||
: this.#flushFlag;
|
||||
result = this.#handle._processChunk(chunk, flushFlag);
|
||||
// if we don't throw, reset it back how it was
|
||||
passthroughBufferConcat(false);
|
||||
}
|
||||
catch (err) {
|
||||
// or if we do, put Buffer.concat() back before we emit error
|
||||
// Error events call into user code, which may call Buffer.concat()
|
||||
passthroughBufferConcat(false);
|
||||
this.#onError(new ZlibError(err));
|
||||
}
|
||||
finally {
|
||||
if (this.#handle) {
|
||||
// Core zlib resets `_handle` to null after attempting to close the
|
||||
// native handle. Our no-op handler prevented actual closure, but we
|
||||
// need to restore the `._handle` property.
|
||||
;
|
||||
this.#handle._handle =
|
||||
nativeHandle;
|
||||
nativeHandle.close = originalNativeClose;
|
||||
this.#handle.close = originalClose;
|
||||
// `_processChunk()` adds an 'error' listener. If we don't remove it
|
||||
// after each call, these handlers start piling up.
|
||||
this.#handle.removeAllListeners('error');
|
||||
// make sure OUR error listener is still attached tho
|
||||
}
|
||||
}
|
||||
if (this.#handle)
|
||||
this.#handle.on('error', er => this.#onError(new ZlibError(er)));
|
||||
let writeReturn;
|
||||
if (result) {
|
||||
if (Array.isArray(result) && result.length > 0) {
|
||||
const r = result[0];
|
||||
// The first buffer is always `handle._outBuffer`, which would be
|
||||
// re-used for later invocations; so, we always have to copy that one.
|
||||
writeReturn = this[_superWrite](Buffer.from(r));
|
||||
for (let i = 1; i < result.length; i++) {
|
||||
writeReturn = this[_superWrite](result[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// either a single Buffer or an empty array
|
||||
writeReturn = this[_superWrite](Buffer.from(result));
|
||||
}
|
||||
}
|
||||
if (cb)
|
||||
cb();
|
||||
return writeReturn;
|
||||
}
|
||||
}
|
||||
export class Zlib extends ZlibBase {
|
||||
#level;
|
||||
#strategy;
|
||||
constructor(opts, mode) {
|
||||
opts = opts || {};
|
||||
opts.flush = opts.flush || constants.Z_NO_FLUSH;
|
||||
opts.finishFlush = opts.finishFlush || constants.Z_FINISH;
|
||||
opts.fullFlushFlag = constants.Z_FULL_FLUSH;
|
||||
super(opts, mode);
|
||||
this.#level = opts.level;
|
||||
this.#strategy = opts.strategy;
|
||||
}
|
||||
params(level, strategy) {
|
||||
if (this.sawError)
|
||||
return;
|
||||
if (!this.handle)
|
||||
throw new Error('cannot switch params when binding is closed');
|
||||
// no way to test this without also not supporting params at all
|
||||
/* c8 ignore start */
|
||||
if (!this.handle.params)
|
||||
throw new Error('not supported in this implementation');
|
||||
/* c8 ignore stop */
|
||||
if (this.#level !== level || this.#strategy !== strategy) {
|
||||
this.flush(constants.Z_SYNC_FLUSH);
|
||||
assert(this.handle, 'zlib binding closed');
|
||||
// .params() calls .flush(), but the latter is always async in the
|
||||
// core zlib. We override .flush() temporarily to intercept that and
|
||||
// flush synchronously.
|
||||
const origFlush = this.handle.flush;
|
||||
this.handle.flush = (flushFlag, cb) => {
|
||||
/* c8 ignore start */
|
||||
if (typeof flushFlag === 'function') {
|
||||
cb = flushFlag;
|
||||
flushFlag = this.flushFlag;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
this.flush(flushFlag);
|
||||
cb?.();
|
||||
};
|
||||
try {
|
||||
;
|
||||
this.handle.params(level, strategy);
|
||||
}
|
||||
finally {
|
||||
this.handle.flush = origFlush;
|
||||
}
|
||||
/* c8 ignore start */
|
||||
if (this.handle) {
|
||||
this.#level = level;
|
||||
this.#strategy = strategy;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
}
|
||||
}
|
||||
}
|
||||
// minimal 2-byte header
|
||||
export class Deflate extends Zlib {
|
||||
constructor(opts) {
|
||||
super(opts, 'Deflate');
|
||||
}
|
||||
}
|
||||
export class Inflate extends Zlib {
|
||||
constructor(opts) {
|
||||
super(opts, 'Inflate');
|
||||
}
|
||||
}
|
||||
export class Gzip extends Zlib {
|
||||
#portable;
|
||||
constructor(opts) {
|
||||
super(opts, 'Gzip');
|
||||
this.#portable = opts && !!opts.portable;
|
||||
}
|
||||
[_superWrite](data) {
|
||||
if (!this.#portable)
|
||||
return super[_superWrite](data);
|
||||
// we'll always get the header emitted in one first chunk
|
||||
// overwrite the OS indicator byte with 0xFF
|
||||
this.#portable = false;
|
||||
data[9] = 255;
|
||||
return super[_superWrite](data);
|
||||
}
|
||||
}
|
||||
export class Gunzip extends Zlib {
|
||||
constructor(opts) {
|
||||
super(opts, 'Gunzip');
|
||||
}
|
||||
}
|
||||
// raw - no header
|
||||
export class DeflateRaw extends Zlib {
|
||||
constructor(opts) {
|
||||
super(opts, 'DeflateRaw');
|
||||
}
|
||||
}
|
||||
export class InflateRaw extends Zlib {
|
||||
constructor(opts) {
|
||||
super(opts, 'InflateRaw');
|
||||
}
|
||||
}
|
||||
// auto-detect header.
|
||||
export class Unzip extends Zlib {
|
||||
constructor(opts) {
|
||||
super(opts, 'Unzip');
|
||||
}
|
||||
}
|
||||
export class Brotli extends ZlibBase {
|
||||
constructor(opts, mode) {
|
||||
opts = opts || {};
|
||||
opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS;
|
||||
opts.finishFlush =
|
||||
opts.finishFlush || constants.BROTLI_OPERATION_FINISH;
|
||||
opts.fullFlushFlag = constants.BROTLI_OPERATION_FLUSH;
|
||||
super(opts, mode);
|
||||
}
|
||||
}
|
||||
export class BrotliCompress extends Brotli {
|
||||
constructor(opts) {
|
||||
super(opts, 'BrotliCompress');
|
||||
}
|
||||
}
|
||||
export class BrotliDecompress extends Brotli {
|
||||
constructor(opts) {
|
||||
super(opts, 'BrotliDecompress');
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/minizlib/dist/esm/index.js.map
generated
vendored
Normal file
1
node_modules/minizlib/dist/esm/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/minizlib/dist/esm/package.json
generated
vendored
Normal file
3
node_modules/minizlib/dist/esm/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
Reference in New Issue
Block a user