update electron to v43

This commit is contained in:
olcxja 2026-07-09 22:38:33 +02:00
commit fb6c8b6ee9
5385 changed files with 513060 additions and 123058 deletions

View file

@ -2,9 +2,9 @@ Minizlib was created by Isaac Z. Schlueter.
It is a derivative work of the Node.js project.
"""
Copyright Isaac Z. Schlueter and Contributors
Copyright Node.js contributors. All rights reserved.
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
Copyright (c) 2017-2023 Isaac Z. Schlueter and Contributors
Copyright (c) 2017-2023 Node.js contributors. All rights reserved.
Copyright (c) 2017-2023 Joyent, Inc. and other Node contributors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),

View file

@ -9,7 +9,7 @@ This module was created to serve the needs of
Brotli is supported in versions of node with a Brotli binding.
## How does this differ from the streams in `require('zlib')`?
## How does this differ from the streams in `'node:zlib'`?
First, there are no convenience methods to compress or decompress a
buffer. If you want those, use the built-in `zlib` module. This is
@ -41,13 +41,17 @@ provided by that class.
- Unzip
- BrotliCompress (Node v10 and higher)
- BrotliDecompress (Node v10 and higher)
- ZstdCompress (Node v22.15 and higher)
- ZstdDecompress (Node v22.15 and higher)
## USAGE
```js
const zlib = require('minizlib')
import { BrotliDecompress } from 'minizlib'
// or: const BrotliDecompress = require('minizlib')
const input = sourceOfCompressedData()
const decode = new zlib.BrotliDecompress()
const decode = new BrotliDecompress()
const output = whereToWriteTheDecodedData()
input.pipe(decode).pipe(output)
```

View file

@ -1,115 +0,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 realZlibConstants = require('zlib').constants ||
/* istanbul ignore next */ { ZLIB_VERNUM: 4736 }
module.exports = 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))

View file

@ -0,0 +1,2 @@
export declare const constants: any;
//# sourceMappingURL=constants.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,SAAS,KAiHrB,CAAA"}

View 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

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,99 @@
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, origin?: Function);
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 ZlibHandle = realZlib.Gzip | realZlib.Gunzip | realZlib.Deflate | realZlib.Inflate | realZlib.DeflateRaw | realZlib.InflateRaw | realZlib.BrotliCompress | realZlib.BrotliDecompress | realZlib.ZstdCompress | realZlib.ZstdDecompress;
export type ZlibMode = 'Gzip' | 'Gunzip' | 'Deflate' | 'Inflate' | 'DeflateRaw' | 'InflateRaw' | 'Unzip';
export type BrotliMode = 'BrotliCompress' | 'BrotliDecompress';
export type ZstdMode = 'ZstdCompress' | 'ZstdDecompress';
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 | ZstdMode);
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);
}
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);
}
declare class Zstd extends ZlibBase {
constructor(opts: ZlibOptions, mode: ZstdMode);
}
export declare class ZstdCompress extends Zstd {
constructor(opts: ZlibOptions);
}
export declare class ZstdDecompress extends Zstd {
constructor(opts: ZlibOptions);
}
//# sourceMappingURL=index.d.ts.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9B"}

416
electron/node_modules/minizlib/dist/commonjs/index.js generated vendored Normal file
View file

@ -0,0 +1,416 @@
"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.ZstdDecompress = exports.ZstdCompress = exports.BrotliDecompress = exports.BrotliCompress = 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, origin) {
super('zlib: ' + err.message, { cause: err });
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, origin ?? 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 */
//@ts-ignore
if (typeof realZlib[mode] !== 'function') {
throw new TypeError('Compression method not supported: ' + mode);
}
// 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.constructor);
}
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, this.write));
}
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, this.write)));
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);
}
}
class BrotliCompress extends Brotli {
constructor(opts) {
super(opts, 'BrotliCompress');
}
}
exports.BrotliCompress = BrotliCompress;
class BrotliDecompress extends Brotli {
constructor(opts) {
super(opts, 'BrotliDecompress');
}
}
exports.BrotliDecompress = BrotliDecompress;
class Zstd extends ZlibBase {
constructor(opts, mode) {
opts = opts || {};
opts.flush = opts.flush || constants_js_1.constants.ZSTD_e_continue;
opts.finishFlush = opts.finishFlush || constants_js_1.constants.ZSTD_e_end;
opts.fullFlushFlag = constants_js_1.constants.ZSTD_e_flush;
super(opts, mode);
}
}
class ZstdCompress extends Zstd {
constructor(opts) {
super(opts, 'ZstdCompress');
}
}
exports.ZstdCompress = ZstdCompress;
class ZstdDecompress extends Zstd {
constructor(opts) {
super(opts, 'ZstdDecompress');
}
}
exports.ZstdDecompress = ZstdDecompress;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,3 @@
{
"type": "commonjs"
}

View file

@ -0,0 +1,2 @@
export declare const constants: any;
//# sourceMappingURL=constants.d.ts.map

View file

@ -0,0 +1 @@
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,SAAS,KAiHrB,CAAA"}

117
electron/node_modules/minizlib/dist/esm/constants.js generated vendored Normal file
View 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

File diff suppressed because one or more lines are too long

99
electron/node_modules/minizlib/dist/esm/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,99 @@
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, origin?: Function);
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 ZlibHandle = realZlib.Gzip | realZlib.Gunzip | realZlib.Deflate | realZlib.Inflate | realZlib.DeflateRaw | realZlib.InflateRaw | realZlib.BrotliCompress | realZlib.BrotliDecompress | realZlib.ZstdCompress | realZlib.ZstdDecompress;
export type ZlibMode = 'Gzip' | 'Gunzip' | 'Deflate' | 'Inflate' | 'DeflateRaw' | 'InflateRaw' | 'Unzip';
export type BrotliMode = 'BrotliCompress' | 'BrotliDecompress';
export type ZstdMode = 'ZstdCompress' | 'ZstdDecompress';
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 | ZstdMode);
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);
}
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);
}
declare class Zstd extends ZlibBase {
constructor(opts: ZlibOptions, mode: ZstdMode);
}
export declare class ZstdCompress extends Zstd {
constructor(opts: ZlibOptions);
}
export declare class ZstdDecompress extends Zstd {
constructor(opts: ZlibOptions);
}
//# sourceMappingURL=index.d.ts.map

View 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,OA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C;AAGD,qBAAa,OAAQ,SAAQ,IAAI;gBACnB,IAAI,EAAE,WAAW;CAG9B;AAED,qBAAa,OAAQ,SAAQ,IAAI;gBACnB,IAAI,EAAE,WAAW;CAG9B;AAGD,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG;IAAE,QAAQ,CAAC,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,cAAM,MAAO,SAAQ,QAAQ;gBACf,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;AAED,cAAM,IAAK,SAAQ,QAAQ;gBACb,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ;CAQ9C;AAED,qBAAa,YAAa,SAAQ,IAAI;gBACxB,IAAI,EAAE,WAAW;CAG9B;AAED,qBAAa,cAAe,SAAQ,IAAI;gBAC1B,IAAI,EAAE,WAAW;CAG9B"}

363
electron/node_modules/minizlib/dist/esm/index.js generated vendored Normal file
View file

@ -0,0 +1,363 @@
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, origin) {
super('zlib: ' + err.message, { cause: err });
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, origin ?? 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 */
//@ts-ignore
if (typeof realZlib[mode] !== 'function') {
throw new TypeError('Compression method not supported: ' + mode);
}
// 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.constructor);
}
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, this.write));
}
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, this.write)));
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');
}
}
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');
}
}
class Zstd extends ZlibBase {
constructor(opts, mode) {
opts = opts || {};
opts.flush = opts.flush || constants.ZSTD_e_continue;
opts.finishFlush = opts.finishFlush || constants.ZSTD_e_end;
opts.fullFlushFlag = constants.ZSTD_e_flush;
super(opts, mode);
}
}
export class ZstdCompress extends Zstd {
constructor(opts) {
super(opts, 'ZstdCompress');
}
}
export class ZstdDecompress extends Zstd {
constructor(opts) {
super(opts, 'ZstdDecompress');
}
}
//# sourceMappingURL=index.js.map

1
electron/node_modules/minizlib/dist/esm/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

3
electron/node_modules/minizlib/dist/esm/package.json generated vendored Normal file
View file

@ -0,0 +1,3 @@
{
"type": "module"
}

View file

@ -1,348 +0,0 @@
'use strict'
const assert = require('assert')
const Buffer = require('buffer').Buffer
const realZlib = require('zlib')
const constants = exports.constants = require('./constants.js')
const Minipass = require('minipass')
const OriginalBufferConcat = Buffer.concat
const _superWrite = Symbol('_superWrite')
class ZlibError extends Error {
constructor (err) {
super('zlib: ' + err.message)
this.code = err.code
this.errno = err.errno
/* istanbul ignore if */
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 _opts = Symbol('opts')
const _flushFlag = Symbol('flushFlag')
const _finishFlushFlag = Symbol('finishFlushFlag')
const _fullFlushFlag = Symbol('fullFlushFlag')
const _handle = Symbol('handle')
const _onError = Symbol('onError')
const _sawError = Symbol('sawError')
const _level = Symbol('level')
const _strategy = Symbol('strategy')
const _ended = Symbol('ended')
const _defaultFullFlush = Symbol('_defaultFullFlush')
class ZlibBase extends Minipass {
constructor (opts, mode) {
if (!opts || typeof opts !== 'object')
throw new TypeError('invalid options for ZlibBase constructor')
super(opts)
this[_sawError] = false
this[_ended] = false
this[_opts] = opts
this[_flushFlag] = opts.flush
this[_finishFlushFlag] = opts.finishFlush
// this will throw if any options are invalid for the class selected
try {
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] = null
this.emit('close')
}
}
reset () {
if (!this[_sawError]) {
assert(this[_handle], 'zlib binding closed')
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) {
if (chunk)
this.write(chunk, encoding)
this.flush(this[_finishFlushFlag])
this[_ended] = true
return super.end(null, null, cb)
}
get ended () {
return this[_ended]
}
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.
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.
Buffer.concat = (args) => args
let result
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
Buffer.concat = OriginalBufferConcat
} 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()
Buffer.concat = OriginalBufferConcat
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) {
// 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(result[0]))
for (let i = 1; i < result.length; i++) {
writeReturn = this[_superWrite](result[i])
}
} else {
writeReturn = this[_superWrite](Buffer.from(result))
}
}
if (cb)
cb()
return writeReturn
}
[_superWrite] (data) {
return super.write(data)
}
}
class Zlib extends ZlibBase {
constructor (opts, mode) {
opts = opts || {}
opts.flush = opts.flush || constants.Z_NO_FLUSH
opts.finishFlush = opts.finishFlush || constants.Z_FINISH
super(opts, mode)
this[_fullFlushFlag] = constants.Z_FULL_FLUSH
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
/* istanbul ignore if */
if (!this[_handle].params)
throw new Error('not supported in this implementation')
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) => {
this.flush(flushFlag)
cb()
}
try {
this[_handle].params(level, strategy)
} finally {
this[_handle].flush = origFlush
}
/* istanbul ignore else */
if (this[_handle]) {
this[_level] = level
this[_strategy] = strategy
}
}
}
}
// minimal 2-byte header
class Deflate extends Zlib {
constructor (opts) {
super(opts, 'Deflate')
}
}
class Inflate extends Zlib {
constructor (opts) {
super(opts, 'Inflate')
}
}
// gzip - bigger header, same deflate compression
const _portable = Symbol('_portable')
class Gzip extends Zlib {
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)
}
}
class Gunzip extends Zlib {
constructor (opts) {
super(opts, 'Gunzip')
}
}
// raw - no header
class DeflateRaw extends Zlib {
constructor (opts) {
super(opts, 'DeflateRaw')
}
}
class InflateRaw extends Zlib {
constructor (opts) {
super(opts, 'InflateRaw')
}
}
// auto-detect header.
class Unzip extends Zlib {
constructor (opts) {
super(opts, 'Unzip')
}
}
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
super(opts, mode)
this[_fullFlushFlag] = constants.BROTLI_OPERATION_FLUSH
}
}
class BrotliCompress extends Brotli {
constructor (opts) {
super(opts, 'BrotliCompress')
}
}
class BrotliDecompress extends Brotli {
constructor (opts) {
super(opts, 'BrotliDecompress')
}
}
exports.Deflate = Deflate
exports.Inflate = Inflate
exports.Gzip = Gzip
exports.Gunzip = Gunzip
exports.DeflateRaw = DeflateRaw
exports.InflateRaw = InflateRaw
exports.Unzip = Unzip
/* istanbul ignore else */
if (typeof realZlib.BrotliCompress === 'function') {
exports.BrotliCompress = BrotliCompress
exports.BrotliDecompress = BrotliDecompress
} else {
exports.BrotliCompress = exports.BrotliDecompress = class {
constructor () {
throw new Error('Brotli is not supported in this version of Node.js')
}
}
}

View file

@ -1,17 +1,20 @@
{
"name": "minizlib",
"version": "2.1.2",
"version": "3.1.0",
"description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.",
"main": "index.js",
"main": "./dist/commonjs/index.js",
"dependencies": {
"minipass": "^3.0.0",
"yallist": "^4.0.0"
"minipass": "^7.1.2"
},
"scripts": {
"test": "tap test/*.js --100 -J",
"prepare": "tshy",
"pretest": "npm run prepare",
"test": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"postpublish": "git push origin --all; git push origin --tags"
"prepublishOnly": "git push origin --follow-tags",
"format": "prettier --write . --loglevel warn",
"typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
},
"repository": {
"type": "git",
@ -30,13 +33,48 @@
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
"license": "MIT",
"devDependencies": {
"tap": "^14.6.9"
"@types/node": "^24.5.2",
"tap": "^21.1.0",
"tshy": "^3.0.2",
"typedoc": "^0.28.1"
},
"files": [
"index.js",
"constants.js"
"dist"
],
"engines": {
"node": ">= 8"
}
"node": ">= 18"
},
"tshy": {
"exports": {
"./package.json": "./package.json",
".": "./src/index.ts"
}
},
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
}
},
"types": "./dist/commonjs/index.d.ts",
"type": "module",
"prettier": {
"semi": false,
"printWidth": 75,
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"jsxSingleQuote": false,
"bracketSameLine": true,
"arrowParens": "avoid",
"endOfLine": "lf"
},
"module": "./dist/esm/index.js"
}