Upload folder using huggingface_hub (part 45)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- tools/ui/node_modules/minipass/dist/commonjs/package.json +3 -0
- tools/ui/node_modules/minipass/dist/esm/index.d.ts +545 -0
- tools/ui/node_modules/minipass/dist/esm/index.d.ts.map +1 -0
- tools/ui/node_modules/minipass/dist/esm/index.js +1020 -0
- tools/ui/node_modules/minipass/dist/esm/index.js.map +1 -0
- tools/ui/node_modules/minipass/dist/esm/package.json +3 -0
- tools/ui/node_modules/minipass/package.json +77 -0
- tools/ui/node_modules/minizlib/LICENSE +26 -0
- tools/ui/node_modules/minizlib/README.md +64 -0
- tools/ui/node_modules/minizlib/dist/commonjs/constants.d.ts +2 -0
- tools/ui/node_modules/minizlib/dist/commonjs/constants.d.ts.map +1 -0
- tools/ui/node_modules/minizlib/dist/commonjs/constants.js +123 -0
- tools/ui/node_modules/minizlib/dist/commonjs/constants.js.map +1 -0
- tools/ui/node_modules/minizlib/dist/commonjs/index.d.ts +99 -0
- tools/ui/node_modules/minizlib/dist/commonjs/index.d.ts.map +1 -0
- tools/ui/node_modules/minizlib/dist/commonjs/index.js +416 -0
- tools/ui/node_modules/minizlib/dist/commonjs/index.js.map +1 -0
- tools/ui/node_modules/minizlib/dist/commonjs/package.json +3 -0
- tools/ui/node_modules/minizlib/dist/esm/constants.d.ts +2 -0
- tools/ui/node_modules/minizlib/dist/esm/constants.d.ts.map +1 -0
- tools/ui/node_modules/minizlib/dist/esm/constants.js +117 -0
- tools/ui/node_modules/minizlib/dist/esm/constants.js.map +1 -0
- tools/ui/node_modules/minizlib/dist/esm/index.d.ts +99 -0
- tools/ui/node_modules/minizlib/dist/esm/index.d.ts.map +1 -0
- tools/ui/node_modules/minizlib/dist/esm/index.js +363 -0
- tools/ui/node_modules/minizlib/dist/esm/index.js.map +1 -0
- tools/ui/node_modules/minizlib/dist/esm/package.json +3 -0
- tools/ui/node_modules/minizlib/package.json +80 -0
- tools/ui/node_modules/mode-watcher/LICENSE +22 -0
- tools/ui/node_modules/mode-watcher/README.md +162 -0
- tools/ui/node_modules/mode-watcher/dist/components/mode-watcher-full.svelte +29 -0
- tools/ui/node_modules/mode-watcher/dist/components/mode-watcher-full.svelte.d.ts +10 -0
- tools/ui/node_modules/mode-watcher/dist/components/mode-watcher-lite.svelte +12 -0
- tools/ui/node_modules/mode-watcher/dist/components/mode-watcher-lite.svelte.d.ts +7 -0
- tools/ui/node_modules/mode-watcher/dist/components/mode-watcher.svelte +104 -0
- tools/ui/node_modules/mode-watcher/dist/components/mode-watcher.svelte.d.ts +4 -0
- tools/ui/node_modules/mode-watcher/dist/components/types.d.ts +1 -0
- tools/ui/node_modules/mode-watcher/dist/components/types.js +1 -0
- tools/ui/node_modules/mode-watcher/dist/index.d.ts +7 -0
- tools/ui/node_modules/mode-watcher/dist/index.js +6 -0
- tools/ui/node_modules/mode-watcher/dist/mode-states.svelte.d.ts +24 -0
- tools/ui/node_modules/mode-watcher/dist/mode-states.svelte.js +80 -0
- tools/ui/node_modules/mode-watcher/dist/mode.d.ts +32 -0
- tools/ui/node_modules/mode-watcher/dist/mode.js +66 -0
- tools/ui/node_modules/mode-watcher/dist/modes.d.ts +7 -0
- tools/ui/node_modules/mode-watcher/dist/modes.js +10 -0
- tools/ui/node_modules/mode-watcher/dist/states.svelte.d.ts +36 -0
- tools/ui/node_modules/mode-watcher/dist/states.svelte.js +107 -0
- tools/ui/node_modules/mode-watcher/dist/storage-keys.svelte.d.ts +8 -0
- tools/ui/node_modules/mode-watcher/dist/storage-keys.svelte.js +9 -0
tools/ui/node_modules/minipass/dist/commonjs/package.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"type": "commonjs"
|
| 3 |
+
}
|
tools/ui/node_modules/minipass/dist/esm/index.d.ts
ADDED
|
@@ -0,0 +1,545 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { EventEmitter } from 'node:events';
|
| 2 |
+
import { StringDecoder } from 'node:string_decoder';
|
| 3 |
+
/**
|
| 4 |
+
* Same as StringDecoder, but exposing the `lastNeed` flag on the type
|
| 5 |
+
*/
|
| 6 |
+
type SD = StringDecoder & {
|
| 7 |
+
lastNeed: boolean;
|
| 8 |
+
};
|
| 9 |
+
export type { SD, Pipe, PipeProxyErrors };
|
| 10 |
+
/**
|
| 11 |
+
* Return true if the argument is a Minipass stream, Node stream, or something
|
| 12 |
+
* else that Minipass can interact with.
|
| 13 |
+
*/
|
| 14 |
+
export declare const isStream: (s: any) => s is Minipass<any, any, any> | NodeJS.ReadStream | NodeJS.WriteStream | (EventEmitter<any> & {
|
| 15 |
+
end(): any;
|
| 16 |
+
write(chunk: any, ...args: any[]): any;
|
| 17 |
+
}) | (EventEmitter<any> & {
|
| 18 |
+
pause(): any;
|
| 19 |
+
resume(): any;
|
| 20 |
+
pipe(...destArgs: any[]): any;
|
| 21 |
+
}) | (NodeJS.ReadStream & {
|
| 22 |
+
fd: number;
|
| 23 |
+
}) | (NodeJS.WriteStream & {
|
| 24 |
+
fd: number;
|
| 25 |
+
});
|
| 26 |
+
/**
|
| 27 |
+
* Return true if the argument is a valid {@link Minipass.Readable}
|
| 28 |
+
*/
|
| 29 |
+
export declare const isReadable: (s: any) => s is Minipass.Readable;
|
| 30 |
+
/**
|
| 31 |
+
* Return true if the argument is a valid {@link Minipass.Writable}
|
| 32 |
+
*/
|
| 33 |
+
export declare const isWritable: (s: any) => s is Minipass.Readable;
|
| 34 |
+
declare const EOF: unique symbol;
|
| 35 |
+
declare const MAYBE_EMIT_END: unique symbol;
|
| 36 |
+
declare const EMITTED_END: unique symbol;
|
| 37 |
+
declare const EMITTING_END: unique symbol;
|
| 38 |
+
declare const EMITTED_ERROR: unique symbol;
|
| 39 |
+
declare const CLOSED: unique symbol;
|
| 40 |
+
declare const READ: unique symbol;
|
| 41 |
+
declare const FLUSH: unique symbol;
|
| 42 |
+
declare const FLUSHCHUNK: unique symbol;
|
| 43 |
+
declare const ENCODING: unique symbol;
|
| 44 |
+
declare const DECODER: unique symbol;
|
| 45 |
+
declare const FLOWING: unique symbol;
|
| 46 |
+
declare const PAUSED: unique symbol;
|
| 47 |
+
declare const RESUME: unique symbol;
|
| 48 |
+
declare const BUFFER: unique symbol;
|
| 49 |
+
declare const PIPES: unique symbol;
|
| 50 |
+
declare const BUFFERLENGTH: unique symbol;
|
| 51 |
+
declare const BUFFERPUSH: unique symbol;
|
| 52 |
+
declare const BUFFERSHIFT: unique symbol;
|
| 53 |
+
declare const OBJECTMODE: unique symbol;
|
| 54 |
+
declare const DESTROYED: unique symbol;
|
| 55 |
+
declare const ERROR: unique symbol;
|
| 56 |
+
declare const EMITDATA: unique symbol;
|
| 57 |
+
declare const EMITEND: unique symbol;
|
| 58 |
+
declare const EMITEND2: unique symbol;
|
| 59 |
+
declare const ASYNC: unique symbol;
|
| 60 |
+
declare const ABORT: unique symbol;
|
| 61 |
+
declare const ABORTED: unique symbol;
|
| 62 |
+
declare const SIGNAL: unique symbol;
|
| 63 |
+
declare const DATALISTENERS: unique symbol;
|
| 64 |
+
declare const DISCARDED: unique symbol;
|
| 65 |
+
/**
|
| 66 |
+
* Options that may be passed to stream.pipe()
|
| 67 |
+
*/
|
| 68 |
+
export interface PipeOptions {
|
| 69 |
+
/**
|
| 70 |
+
* end the destination stream when the source stream ends
|
| 71 |
+
*/
|
| 72 |
+
end?: boolean;
|
| 73 |
+
/**
|
| 74 |
+
* proxy errors from the source stream to the destination stream
|
| 75 |
+
*/
|
| 76 |
+
proxyErrors?: boolean;
|
| 77 |
+
}
|
| 78 |
+
/**
|
| 79 |
+
* Internal class representing a pipe to a destination stream.
|
| 80 |
+
*
|
| 81 |
+
* @internal
|
| 82 |
+
*/
|
| 83 |
+
declare class Pipe<T extends unknown> {
|
| 84 |
+
src: Minipass<T>;
|
| 85 |
+
dest: Minipass<any, T>;
|
| 86 |
+
opts: PipeOptions;
|
| 87 |
+
ondrain: () => any;
|
| 88 |
+
constructor(src: Minipass<T>, dest: Minipass.Writable, opts: PipeOptions);
|
| 89 |
+
unpipe(): void;
|
| 90 |
+
proxyErrors(_er: any): void;
|
| 91 |
+
end(): void;
|
| 92 |
+
}
|
| 93 |
+
/**
|
| 94 |
+
* Internal class representing a pipe to a destination stream where
|
| 95 |
+
* errors are proxied.
|
| 96 |
+
*
|
| 97 |
+
* @internal
|
| 98 |
+
*/
|
| 99 |
+
declare class PipeProxyErrors<T> extends Pipe<T> {
|
| 100 |
+
unpipe(): void;
|
| 101 |
+
constructor(src: Minipass<T>, dest: Minipass.Writable, opts: PipeOptions);
|
| 102 |
+
}
|
| 103 |
+
export declare namespace Minipass {
|
| 104 |
+
/**
|
| 105 |
+
* Encoding used to create a stream that outputs strings rather than
|
| 106 |
+
* Buffer objects.
|
| 107 |
+
*/
|
| 108 |
+
export type Encoding = BufferEncoding | 'buffer' | null;
|
| 109 |
+
/**
|
| 110 |
+
* Any stream that Minipass can pipe into
|
| 111 |
+
*/
|
| 112 |
+
export type Writable = Minipass<any, any, any> | NodeJS.WriteStream | (NodeJS.WriteStream & {
|
| 113 |
+
fd: number;
|
| 114 |
+
}) | (EventEmitter & {
|
| 115 |
+
end(): any;
|
| 116 |
+
write(chunk: any, ...args: any[]): any;
|
| 117 |
+
});
|
| 118 |
+
/**
|
| 119 |
+
* Any stream that can be read from
|
| 120 |
+
*/
|
| 121 |
+
export type Readable = Minipass<any, any, any> | NodeJS.ReadStream | (NodeJS.ReadStream & {
|
| 122 |
+
fd: number;
|
| 123 |
+
}) | (EventEmitter & {
|
| 124 |
+
pause(): any;
|
| 125 |
+
resume(): any;
|
| 126 |
+
pipe(...destArgs: any[]): any;
|
| 127 |
+
});
|
| 128 |
+
/**
|
| 129 |
+
* Utility type that can be iterated sync or async
|
| 130 |
+
*/
|
| 131 |
+
export type DualIterable<T> = Iterable<T> & AsyncIterable<T>;
|
| 132 |
+
type EventArguments = Record<string | symbol, unknown[]>;
|
| 133 |
+
/**
|
| 134 |
+
* The listing of events that a Minipass class can emit.
|
| 135 |
+
* Extend this when extending the Minipass class, and pass as
|
| 136 |
+
* the third template argument. The key is the name of the event,
|
| 137 |
+
* and the value is the argument list.
|
| 138 |
+
*
|
| 139 |
+
* Any undeclared events will still be allowed, but the handler will get
|
| 140 |
+
* arguments as `unknown[]`.
|
| 141 |
+
*/
|
| 142 |
+
export interface Events<RType extends any = Buffer> extends EventArguments {
|
| 143 |
+
readable: [];
|
| 144 |
+
data: [chunk: RType];
|
| 145 |
+
error: [er: unknown];
|
| 146 |
+
abort: [reason: unknown];
|
| 147 |
+
drain: [];
|
| 148 |
+
resume: [];
|
| 149 |
+
end: [];
|
| 150 |
+
finish: [];
|
| 151 |
+
prefinish: [];
|
| 152 |
+
close: [];
|
| 153 |
+
[DESTROYED]: [er?: unknown];
|
| 154 |
+
[ERROR]: [er: unknown];
|
| 155 |
+
}
|
| 156 |
+
/**
|
| 157 |
+
* String or buffer-like data that can be joined and sliced
|
| 158 |
+
*/
|
| 159 |
+
export type ContiguousData = Buffer | ArrayBufferLike | ArrayBufferView | string;
|
| 160 |
+
export type BufferOrString = Buffer | string;
|
| 161 |
+
/**
|
| 162 |
+
* Options passed to the Minipass constructor.
|
| 163 |
+
*/
|
| 164 |
+
export type SharedOptions = {
|
| 165 |
+
/**
|
| 166 |
+
* Defer all data emission and other events until the end of the
|
| 167 |
+
* current tick, similar to Node core streams
|
| 168 |
+
*/
|
| 169 |
+
async?: boolean;
|
| 170 |
+
/**
|
| 171 |
+
* A signal which will abort the stream
|
| 172 |
+
*/
|
| 173 |
+
signal?: AbortSignal;
|
| 174 |
+
/**
|
| 175 |
+
* Output string encoding. Set to `null` or `'buffer'` (or omit) to
|
| 176 |
+
* emit Buffer objects rather than strings.
|
| 177 |
+
*
|
| 178 |
+
* Conflicts with `objectMode`
|
| 179 |
+
*/
|
| 180 |
+
encoding?: BufferEncoding | null | 'buffer';
|
| 181 |
+
/**
|
| 182 |
+
* Output data exactly as it was written, supporting non-buffer/string
|
| 183 |
+
* data (such as arbitrary objects, falsey values, etc.)
|
| 184 |
+
*
|
| 185 |
+
* Conflicts with `encoding`
|
| 186 |
+
*/
|
| 187 |
+
objectMode?: boolean;
|
| 188 |
+
};
|
| 189 |
+
/**
|
| 190 |
+
* Options for a string encoded output
|
| 191 |
+
*/
|
| 192 |
+
export type EncodingOptions = SharedOptions & {
|
| 193 |
+
encoding: BufferEncoding;
|
| 194 |
+
objectMode?: false;
|
| 195 |
+
};
|
| 196 |
+
/**
|
| 197 |
+
* Options for contiguous data buffer output
|
| 198 |
+
*/
|
| 199 |
+
export type BufferOptions = SharedOptions & {
|
| 200 |
+
encoding?: null | 'buffer';
|
| 201 |
+
objectMode?: false;
|
| 202 |
+
};
|
| 203 |
+
/**
|
| 204 |
+
* Options for objectMode arbitrary output
|
| 205 |
+
*/
|
| 206 |
+
export type ObjectModeOptions = SharedOptions & {
|
| 207 |
+
objectMode: true;
|
| 208 |
+
encoding?: null;
|
| 209 |
+
};
|
| 210 |
+
/**
|
| 211 |
+
* Utility type to determine allowed options based on read type
|
| 212 |
+
*/
|
| 213 |
+
export type Options<T> = ObjectModeOptions | (T extends string ? EncodingOptions : T extends Buffer ? BufferOptions : SharedOptions);
|
| 214 |
+
export {};
|
| 215 |
+
}
|
| 216 |
+
/**
|
| 217 |
+
* Main export, the Minipass class
|
| 218 |
+
*
|
| 219 |
+
* `RType` is the type of data emitted, defaults to Buffer
|
| 220 |
+
*
|
| 221 |
+
* `WType` is the type of data to be written, if RType is buffer or string,
|
| 222 |
+
* then any {@link Minipass.ContiguousData} is allowed.
|
| 223 |
+
*
|
| 224 |
+
* `Events` is the set of event handler signatures that this object
|
| 225 |
+
* will emit, see {@link Minipass.Events}
|
| 226 |
+
*/
|
| 227 |
+
export declare class Minipass<RType extends unknown = Buffer, WType extends unknown = RType extends Minipass.BufferOrString ? Minipass.ContiguousData : RType, Events extends Minipass.Events<RType> = Minipass.Events<RType>> extends EventEmitter implements Minipass.DualIterable<RType> {
|
| 228 |
+
[FLOWING]: boolean;
|
| 229 |
+
[PAUSED]: boolean;
|
| 230 |
+
[PIPES]: Pipe<RType>[];
|
| 231 |
+
[BUFFER]: RType[];
|
| 232 |
+
[OBJECTMODE]: boolean;
|
| 233 |
+
[ENCODING]: BufferEncoding | null;
|
| 234 |
+
[ASYNC]: boolean;
|
| 235 |
+
[DECODER]: SD | null;
|
| 236 |
+
[EOF]: boolean;
|
| 237 |
+
[EMITTED_END]: boolean;
|
| 238 |
+
[EMITTING_END]: boolean;
|
| 239 |
+
[CLOSED]: boolean;
|
| 240 |
+
[EMITTED_ERROR]: unknown;
|
| 241 |
+
[BUFFERLENGTH]: number;
|
| 242 |
+
[DESTROYED]: boolean;
|
| 243 |
+
[SIGNAL]?: AbortSignal;
|
| 244 |
+
[ABORTED]: boolean;
|
| 245 |
+
[DATALISTENERS]: number;
|
| 246 |
+
[DISCARDED]: boolean;
|
| 247 |
+
/**
|
| 248 |
+
* true if the stream can be written
|
| 249 |
+
*/
|
| 250 |
+
writable: boolean;
|
| 251 |
+
/**
|
| 252 |
+
* true if the stream can be read
|
| 253 |
+
*/
|
| 254 |
+
readable: boolean;
|
| 255 |
+
/**
|
| 256 |
+
* If `RType` is Buffer, then options do not need to be provided.
|
| 257 |
+
* Otherwise, an options object must be provided to specify either
|
| 258 |
+
* {@link Minipass.SharedOptions.objectMode} or
|
| 259 |
+
* {@link Minipass.SharedOptions.encoding}, as appropriate.
|
| 260 |
+
*/
|
| 261 |
+
constructor(...args: [Minipass.ObjectModeOptions] | (RType extends Buffer ? [] | [Minipass.Options<RType>] : [Minipass.Options<RType>]));
|
| 262 |
+
/**
|
| 263 |
+
* The amount of data stored in the buffer waiting to be read.
|
| 264 |
+
*
|
| 265 |
+
* For Buffer strings, this will be the total byte length.
|
| 266 |
+
* For string encoding streams, this will be the string character length,
|
| 267 |
+
* according to JavaScript's `string.length` logic.
|
| 268 |
+
* For objectMode streams, this is a count of the items waiting to be
|
| 269 |
+
* emitted.
|
| 270 |
+
*/
|
| 271 |
+
get bufferLength(): number;
|
| 272 |
+
/**
|
| 273 |
+
* The `BufferEncoding` currently in use, or `null`
|
| 274 |
+
*/
|
| 275 |
+
get encoding(): BufferEncoding | null;
|
| 276 |
+
/**
|
| 277 |
+
* @deprecated - This is a read only property
|
| 278 |
+
*/
|
| 279 |
+
set encoding(_enc: BufferEncoding | null);
|
| 280 |
+
/**
|
| 281 |
+
* @deprecated - Encoding may only be set at instantiation time
|
| 282 |
+
*/
|
| 283 |
+
setEncoding(_enc: Minipass.Encoding): void;
|
| 284 |
+
/**
|
| 285 |
+
* True if this is an objectMode stream
|
| 286 |
+
*/
|
| 287 |
+
get objectMode(): boolean;
|
| 288 |
+
/**
|
| 289 |
+
* @deprecated - This is a read-only property
|
| 290 |
+
*/
|
| 291 |
+
set objectMode(_om: boolean);
|
| 292 |
+
/**
|
| 293 |
+
* true if this is an async stream
|
| 294 |
+
*/
|
| 295 |
+
get ['async'](): boolean;
|
| 296 |
+
/**
|
| 297 |
+
* Set to true to make this stream async.
|
| 298 |
+
*
|
| 299 |
+
* Once set, it cannot be unset, as this would potentially cause incorrect
|
| 300 |
+
* behavior. Ie, a sync stream can be made async, but an async stream
|
| 301 |
+
* cannot be safely made sync.
|
| 302 |
+
*/
|
| 303 |
+
set ['async'](a: boolean);
|
| 304 |
+
[ABORT](): void;
|
| 305 |
+
/**
|
| 306 |
+
* True if the stream has been aborted.
|
| 307 |
+
*/
|
| 308 |
+
get aborted(): boolean;
|
| 309 |
+
/**
|
| 310 |
+
* No-op setter. Stream aborted status is set via the AbortSignal provided
|
| 311 |
+
* in the constructor options.
|
| 312 |
+
*/
|
| 313 |
+
set aborted(_: boolean);
|
| 314 |
+
/**
|
| 315 |
+
* Write data into the stream
|
| 316 |
+
*
|
| 317 |
+
* If the chunk written is a string, and encoding is not specified, then
|
| 318 |
+
* `utf8` will be assumed. If the stream encoding matches the encoding of
|
| 319 |
+
* a written string, and the state of the string decoder allows it, then
|
| 320 |
+
* the string will be passed through to either the output or the internal
|
| 321 |
+
* buffer without any processing. Otherwise, it will be turned into a
|
| 322 |
+
* Buffer object for processing into the desired encoding.
|
| 323 |
+
*
|
| 324 |
+
* If provided, `cb` function is called immediately before return for
|
| 325 |
+
* sync streams, or on next tick for async streams, because for this
|
| 326 |
+
* base class, a chunk is considered "processed" once it is accepted
|
| 327 |
+
* and either emitted or buffered. That is, the callback does not indicate
|
| 328 |
+
* that the chunk has been eventually emitted, though of course child
|
| 329 |
+
* classes can override this function to do whatever processing is required
|
| 330 |
+
* and call `super.write(...)` only once processing is completed.
|
| 331 |
+
*/
|
| 332 |
+
write(chunk: WType, cb?: () => void): boolean;
|
| 333 |
+
write(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): boolean;
|
| 334 |
+
/**
|
| 335 |
+
* Low-level explicit read method.
|
| 336 |
+
*
|
| 337 |
+
* In objectMode, the argument is ignored, and one item is returned if
|
| 338 |
+
* available.
|
| 339 |
+
*
|
| 340 |
+
* `n` is the number of bytes (or in the case of encoding streams,
|
| 341 |
+
* characters) to consume. If `n` is not provided, then the entire buffer
|
| 342 |
+
* is returned, or `null` is returned if no data is available.
|
| 343 |
+
*
|
| 344 |
+
* If `n` is greater that the amount of data in the internal buffer,
|
| 345 |
+
* then `null` is returned.
|
| 346 |
+
*/
|
| 347 |
+
read(n?: number | null): RType | null;
|
| 348 |
+
[READ](n: number | null, chunk: RType): RType;
|
| 349 |
+
/**
|
| 350 |
+
* End the stream, optionally providing a final write.
|
| 351 |
+
*
|
| 352 |
+
* See {@link Minipass#write} for argument descriptions
|
| 353 |
+
*/
|
| 354 |
+
end(cb?: () => void): this;
|
| 355 |
+
end(chunk: WType, cb?: () => void): this;
|
| 356 |
+
end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this;
|
| 357 |
+
[RESUME](): void;
|
| 358 |
+
/**
|
| 359 |
+
* Resume the stream if it is currently in a paused state
|
| 360 |
+
*
|
| 361 |
+
* If called when there are no pipe destinations or `data` event listeners,
|
| 362 |
+
* this will place the stream in a "discarded" state, where all data will
|
| 363 |
+
* be thrown away. The discarded state is removed if a pipe destination or
|
| 364 |
+
* data handler is added, if pause() is called, or if any synchronous or
|
| 365 |
+
* asynchronous iteration is started.
|
| 366 |
+
*/
|
| 367 |
+
resume(): void;
|
| 368 |
+
/**
|
| 369 |
+
* Pause the stream
|
| 370 |
+
*/
|
| 371 |
+
pause(): void;
|
| 372 |
+
/**
|
| 373 |
+
* true if the stream has been forcibly destroyed
|
| 374 |
+
*/
|
| 375 |
+
get destroyed(): boolean;
|
| 376 |
+
/**
|
| 377 |
+
* true if the stream is currently in a flowing state, meaning that
|
| 378 |
+
* any writes will be immediately emitted.
|
| 379 |
+
*/
|
| 380 |
+
get flowing(): boolean;
|
| 381 |
+
/**
|
| 382 |
+
* true if the stream is currently in a paused state
|
| 383 |
+
*/
|
| 384 |
+
get paused(): boolean;
|
| 385 |
+
[BUFFERPUSH](chunk: RType): void;
|
| 386 |
+
[BUFFERSHIFT](): RType;
|
| 387 |
+
[FLUSH](noDrain?: boolean): void;
|
| 388 |
+
[FLUSHCHUNK](chunk: RType): boolean;
|
| 389 |
+
/**
|
| 390 |
+
* Pipe all data emitted by this stream into the destination provided.
|
| 391 |
+
*
|
| 392 |
+
* Triggers the flow of data.
|
| 393 |
+
*/
|
| 394 |
+
pipe<W extends Minipass.Writable>(dest: W, opts?: PipeOptions): W;
|
| 395 |
+
/**
|
| 396 |
+
* Fully unhook a piped destination stream.
|
| 397 |
+
*
|
| 398 |
+
* If the destination stream was the only consumer of this stream (ie,
|
| 399 |
+
* there are no other piped destinations or `'data'` event listeners)
|
| 400 |
+
* then the flow of data will stop until there is another consumer or
|
| 401 |
+
* {@link Minipass#resume} is explicitly called.
|
| 402 |
+
*/
|
| 403 |
+
unpipe<W extends Minipass.Writable>(dest: W): void;
|
| 404 |
+
/**
|
| 405 |
+
* Alias for {@link Minipass#on}
|
| 406 |
+
*/
|
| 407 |
+
addListener<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any): this;
|
| 408 |
+
/**
|
| 409 |
+
* Mostly identical to `EventEmitter.on`, with the following
|
| 410 |
+
* behavior differences to prevent data loss and unnecessary hangs:
|
| 411 |
+
*
|
| 412 |
+
* - Adding a 'data' event handler will trigger the flow of data
|
| 413 |
+
*
|
| 414 |
+
* - Adding a 'readable' event handler when there is data waiting to be read
|
| 415 |
+
* will cause 'readable' to be emitted immediately.
|
| 416 |
+
*
|
| 417 |
+
* - Adding an 'endish' event handler ('end', 'finish', etc.) which has
|
| 418 |
+
* already passed will cause the event to be emitted immediately and all
|
| 419 |
+
* handlers removed.
|
| 420 |
+
*
|
| 421 |
+
* - Adding an 'error' event handler after an error has been emitted will
|
| 422 |
+
* cause the event to be re-emitted immediately with the error previously
|
| 423 |
+
* raised.
|
| 424 |
+
*/
|
| 425 |
+
on<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any): this;
|
| 426 |
+
/**
|
| 427 |
+
* Alias for {@link Minipass#off}
|
| 428 |
+
*/
|
| 429 |
+
removeListener<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any): this;
|
| 430 |
+
/**
|
| 431 |
+
* Mostly identical to `EventEmitter.off`
|
| 432 |
+
*
|
| 433 |
+
* If a 'data' event handler is removed, and it was the last consumer
|
| 434 |
+
* (ie, there are no pipe destinations or other 'data' event listeners),
|
| 435 |
+
* then the flow of data will stop until there is another consumer or
|
| 436 |
+
* {@link Minipass#resume} is explicitly called.
|
| 437 |
+
*/
|
| 438 |
+
off<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any): this;
|
| 439 |
+
/**
|
| 440 |
+
* Mostly identical to `EventEmitter.removeAllListeners`
|
| 441 |
+
*
|
| 442 |
+
* If all 'data' event handlers are removed, and they were the last consumer
|
| 443 |
+
* (ie, there are no pipe destinations), then the flow of data will stop
|
| 444 |
+
* until there is another consumer or {@link Minipass#resume} is explicitly
|
| 445 |
+
* called.
|
| 446 |
+
*/
|
| 447 |
+
removeAllListeners<Event extends keyof Events>(ev?: Event): this;
|
| 448 |
+
/**
|
| 449 |
+
* true if the 'end' event has been emitted
|
| 450 |
+
*/
|
| 451 |
+
get emittedEnd(): boolean;
|
| 452 |
+
[MAYBE_EMIT_END](): void;
|
| 453 |
+
/**
|
| 454 |
+
* Mostly identical to `EventEmitter.emit`, with the following
|
| 455 |
+
* behavior differences to prevent data loss and unnecessary hangs:
|
| 456 |
+
*
|
| 457 |
+
* If the stream has been destroyed, and the event is something other
|
| 458 |
+
* than 'close' or 'error', then `false` is returned and no handlers
|
| 459 |
+
* are called.
|
| 460 |
+
*
|
| 461 |
+
* If the event is 'end', and has already been emitted, then the event
|
| 462 |
+
* is ignored. If the stream is in a paused or non-flowing state, then
|
| 463 |
+
* the event will be deferred until data flow resumes. If the stream is
|
| 464 |
+
* async, then handlers will be called on the next tick rather than
|
| 465 |
+
* immediately.
|
| 466 |
+
*
|
| 467 |
+
* If the event is 'close', and 'end' has not yet been emitted, then
|
| 468 |
+
* the event will be deferred until after 'end' is emitted.
|
| 469 |
+
*
|
| 470 |
+
* If the event is 'error', and an AbortSignal was provided for the stream,
|
| 471 |
+
* and there are no listeners, then the event is ignored, matching the
|
| 472 |
+
* behavior of node core streams in the presense of an AbortSignal.
|
| 473 |
+
*
|
| 474 |
+
* If the event is 'finish' or 'prefinish', then all listeners will be
|
| 475 |
+
* removed after emitting the event, to prevent double-firing.
|
| 476 |
+
*/
|
| 477 |
+
emit<Event extends keyof Events>(ev: Event, ...args: Events[Event]): boolean;
|
| 478 |
+
[EMITDATA](data: RType): boolean;
|
| 479 |
+
[EMITEND](): boolean;
|
| 480 |
+
[EMITEND2](): boolean;
|
| 481 |
+
/**
|
| 482 |
+
* Return a Promise that resolves to an array of all emitted data once
|
| 483 |
+
* the stream ends.
|
| 484 |
+
*/
|
| 485 |
+
collect(): Promise<RType[] & {
|
| 486 |
+
dataLength: number;
|
| 487 |
+
}>;
|
| 488 |
+
/**
|
| 489 |
+
* Return a Promise that resolves to the concatenation of all emitted data
|
| 490 |
+
* once the stream ends.
|
| 491 |
+
*
|
| 492 |
+
* Not allowed on objectMode streams.
|
| 493 |
+
*/
|
| 494 |
+
concat(): Promise<RType>;
|
| 495 |
+
/**
|
| 496 |
+
* Return a void Promise that resolves once the stream ends.
|
| 497 |
+
*/
|
| 498 |
+
promise(): Promise<void>;
|
| 499 |
+
/**
|
| 500 |
+
* Asynchronous `for await of` iteration.
|
| 501 |
+
*
|
| 502 |
+
* This will continue emitting all chunks until the stream terminates.
|
| 503 |
+
*/
|
| 504 |
+
[Symbol.asyncIterator](): AsyncGenerator<RType, void, void>;
|
| 505 |
+
/**
|
| 506 |
+
* Synchronous `for of` iteration.
|
| 507 |
+
*
|
| 508 |
+
* The iteration will terminate when the internal buffer runs out, even
|
| 509 |
+
* if the stream has not yet terminated.
|
| 510 |
+
*/
|
| 511 |
+
[Symbol.iterator](): Generator<RType, void, void>;
|
| 512 |
+
/**
|
| 513 |
+
* Destroy a stream, preventing it from being used for any further purpose.
|
| 514 |
+
*
|
| 515 |
+
* If the stream has a `close()` method, then it will be called on
|
| 516 |
+
* destruction.
|
| 517 |
+
*
|
| 518 |
+
* After destruction, any attempt to write data, read data, or emit most
|
| 519 |
+
* events will be ignored.
|
| 520 |
+
*
|
| 521 |
+
* If an error argument is provided, then it will be emitted in an
|
| 522 |
+
* 'error' event.
|
| 523 |
+
*/
|
| 524 |
+
destroy(er?: unknown): this;
|
| 525 |
+
/**
|
| 526 |
+
* Alias for {@link isStream}
|
| 527 |
+
*
|
| 528 |
+
* Former export location, maintained for backwards compatibility.
|
| 529 |
+
*
|
| 530 |
+
* @deprecated
|
| 531 |
+
*/
|
| 532 |
+
static get isStream(): (s: any) => s is Minipass<any, any, any> | NodeJS.ReadStream | NodeJS.WriteStream | (EventEmitter<any> & {
|
| 533 |
+
end(): any;
|
| 534 |
+
write(chunk: any, ...args: any[]): any;
|
| 535 |
+
}) | (EventEmitter<any> & {
|
| 536 |
+
pause(): any;
|
| 537 |
+
resume(): any;
|
| 538 |
+
pipe(...destArgs: any[]): any;
|
| 539 |
+
}) | (NodeJS.ReadStream & {
|
| 540 |
+
fd: number;
|
| 541 |
+
}) | (NodeJS.WriteStream & {
|
| 542 |
+
fd: number;
|
| 543 |
+
});
|
| 544 |
+
}
|
| 545 |
+
//# sourceMappingURL=index.d.ts.map
|
tools/ui/node_modules/minipass/dist/esm/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD;;GAEG;AACH,KAAK,EAAE,GAAG,aAAa,GAAG;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAA;AAE/C,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAA;AAEzC;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;EAQH,CAAA;AAElB;;GAEG;AACH,eAAO,MAAM,UAAU,oCAM2C,CAAA;AAElE;;GAEG;AACH,eAAO,MAAM,UAAU,oCAK6B,CAAA;AAEpD,QAAA,MAAM,GAAG,eAAgB,CAAA;AACzB,QAAA,MAAM,cAAc,eAAyB,CAAA;AAC7C,QAAA,MAAM,WAAW,eAAuB,CAAA;AACxC,QAAA,MAAM,YAAY,eAAwB,CAAA;AAC1C,QAAA,MAAM,aAAa,eAAyB,CAAA;AAC5C,QAAA,MAAM,MAAM,eAAmB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ED;;;;;;;OAOG;IACH,kBAAkB,CAAC,KAAK,SAAS,MAAM,MAAM,EAAE,EAAE,CAAC,EAAE,KAAK,QASxD;IAED;;OAEG;IACH,IAAI,UAAU,YAEb;IAED,CAAC,cAAc,CAAC,SAef;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,IAAI,CAAC,KAAK,SAAS,MAAM,MAAM,EAC7B,EAAE,EAAE,KAAK,EACT,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,GACrB,OAAO,CAgDT;IAED,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,KAAK,WAOrB;IAED,CAAC,OAAO,CAAC,YAQR;IAED,CAAC,QAAQ,CAAC,YAiBT;IAED;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAezD;IAED;;;;;OAKG;IACG,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,CAU7B;IAED;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAM7B;IAED;;;;OAIG;IACH,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CA4D1D;IAED;;;;;OAKG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAiChD;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO,QAwBnB;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ;;;;;;;;;;;OAElB;CACF","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe<T extends unknown> {\n src: Minipass<T>\n dest: Minipass<any, T>\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass<T>,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass<any, T>\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors<T> extends Pipe<T> {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass<T>,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = (er: Error) => this.dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass<any, any, any>\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass<any, any, any>\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable<T> = Iterable<T> & AsyncIterable<T>\n\n type EventArguments = Record<string | symbol, unknown[]>\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events<RType extends any = Buffer>\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options<T> =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events<RType> = Minipass.Events<RType>\n >\n extends EventEmitter\n implements Minipass.DualIterable<RType>\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe<RType>[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options<RType>]\n : [Minipass.Options<RType>])\n ) {\n const options: Minipass.Options<RType> = (args[0] ||\n {}) as Minipass.Options<RType>\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe<W extends Minipass.Writable>(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe<RType>(this as Minipass<RType>, dest, opts)\n : new PipeProxyErrors<RType>(this as Minipass<RType>, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe<W extends Minipass.Writable>(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener<Event extends keyof Events>(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on<Event extends keyof Events>(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener<Event extends keyof Events>(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off<Event extends keyof Events>(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners<Event extends keyof Events>(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit<Event extends keyof Events>(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise<RType[] & { dataLength: number }> {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise<RType> {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator<RType, void, void> {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise<IteratorReturnResult<void>> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise<IteratorResult<RType, void>> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult<RType>) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise<IteratorResult<RType>>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n [Symbol.asyncDispose]: async () => {},\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator<RType, void, void> {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult<void> => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult<RType, void> => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n [Symbol.dispose]: () => {},\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass<RType, WType, Events> & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]}
|
tools/ui/node_modules/minipass/dist/esm/index.js
ADDED
|
@@ -0,0 +1,1020 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const proc = typeof process === 'object' && process
|
| 2 |
+
? process
|
| 3 |
+
: {
|
| 4 |
+
stdout: null,
|
| 5 |
+
stderr: null,
|
| 6 |
+
};
|
| 7 |
+
import { EventEmitter } from 'node:events';
|
| 8 |
+
import Stream from 'node:stream';
|
| 9 |
+
import { StringDecoder } from 'node:string_decoder';
|
| 10 |
+
/**
|
| 11 |
+
* Return true if the argument is a Minipass stream, Node stream, or something
|
| 12 |
+
* else that Minipass can interact with.
|
| 13 |
+
*/
|
| 14 |
+
export const isStream = (s) => !!s &&
|
| 15 |
+
typeof s === 'object' &&
|
| 16 |
+
(s instanceof Minipass ||
|
| 17 |
+
s instanceof Stream ||
|
| 18 |
+
isReadable(s) ||
|
| 19 |
+
isWritable(s));
|
| 20 |
+
/**
|
| 21 |
+
* Return true if the argument is a valid {@link Minipass.Readable}
|
| 22 |
+
*/
|
| 23 |
+
export const isReadable = (s) => !!s &&
|
| 24 |
+
typeof s === 'object' &&
|
| 25 |
+
s instanceof EventEmitter &&
|
| 26 |
+
typeof s.pipe === 'function' &&
|
| 27 |
+
// node core Writable streams have a pipe() method, but it throws
|
| 28 |
+
s.pipe !== Stream.Writable.prototype.pipe;
|
| 29 |
+
/**
|
| 30 |
+
* Return true if the argument is a valid {@link Minipass.Writable}
|
| 31 |
+
*/
|
| 32 |
+
export const isWritable = (s) => !!s &&
|
| 33 |
+
typeof s === 'object' &&
|
| 34 |
+
s instanceof EventEmitter &&
|
| 35 |
+
typeof s.write === 'function' &&
|
| 36 |
+
typeof s.end === 'function';
|
| 37 |
+
const EOF = Symbol('EOF');
|
| 38 |
+
const MAYBE_EMIT_END = Symbol('maybeEmitEnd');
|
| 39 |
+
const EMITTED_END = Symbol('emittedEnd');
|
| 40 |
+
const EMITTING_END = Symbol('emittingEnd');
|
| 41 |
+
const EMITTED_ERROR = Symbol('emittedError');
|
| 42 |
+
const CLOSED = Symbol('closed');
|
| 43 |
+
const READ = Symbol('read');
|
| 44 |
+
const FLUSH = Symbol('flush');
|
| 45 |
+
const FLUSHCHUNK = Symbol('flushChunk');
|
| 46 |
+
const ENCODING = Symbol('encoding');
|
| 47 |
+
const DECODER = Symbol('decoder');
|
| 48 |
+
const FLOWING = Symbol('flowing');
|
| 49 |
+
const PAUSED = Symbol('paused');
|
| 50 |
+
const RESUME = Symbol('resume');
|
| 51 |
+
const BUFFER = Symbol('buffer');
|
| 52 |
+
const PIPES = Symbol('pipes');
|
| 53 |
+
const BUFFERLENGTH = Symbol('bufferLength');
|
| 54 |
+
const BUFFERPUSH = Symbol('bufferPush');
|
| 55 |
+
const BUFFERSHIFT = Symbol('bufferShift');
|
| 56 |
+
const OBJECTMODE = Symbol('objectMode');
|
| 57 |
+
// internal event when stream is destroyed
|
| 58 |
+
const DESTROYED = Symbol('destroyed');
|
| 59 |
+
// internal event when stream has an error
|
| 60 |
+
const ERROR = Symbol('error');
|
| 61 |
+
const EMITDATA = Symbol('emitData');
|
| 62 |
+
const EMITEND = Symbol('emitEnd');
|
| 63 |
+
const EMITEND2 = Symbol('emitEnd2');
|
| 64 |
+
const ASYNC = Symbol('async');
|
| 65 |
+
const ABORT = Symbol('abort');
|
| 66 |
+
const ABORTED = Symbol('aborted');
|
| 67 |
+
const SIGNAL = Symbol('signal');
|
| 68 |
+
const DATALISTENERS = Symbol('dataListeners');
|
| 69 |
+
const DISCARDED = Symbol('discarded');
|
| 70 |
+
const defer = (fn) => Promise.resolve().then(fn);
|
| 71 |
+
const nodefer = (fn) => fn();
|
| 72 |
+
const isEndish = (ev) => ev === 'end' || ev === 'finish' || ev === 'prefinish';
|
| 73 |
+
const isArrayBufferLike = (b) => b instanceof ArrayBuffer ||
|
| 74 |
+
(!!b &&
|
| 75 |
+
typeof b === 'object' &&
|
| 76 |
+
b.constructor &&
|
| 77 |
+
b.constructor.name === 'ArrayBuffer' &&
|
| 78 |
+
b.byteLength >= 0);
|
| 79 |
+
const isArrayBufferView = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b);
|
| 80 |
+
/**
|
| 81 |
+
* Internal class representing a pipe to a destination stream.
|
| 82 |
+
*
|
| 83 |
+
* @internal
|
| 84 |
+
*/
|
| 85 |
+
class Pipe {
|
| 86 |
+
src;
|
| 87 |
+
dest;
|
| 88 |
+
opts;
|
| 89 |
+
ondrain;
|
| 90 |
+
constructor(src, dest, opts) {
|
| 91 |
+
this.src = src;
|
| 92 |
+
this.dest = dest;
|
| 93 |
+
this.opts = opts;
|
| 94 |
+
this.ondrain = () => src[RESUME]();
|
| 95 |
+
this.dest.on('drain', this.ondrain);
|
| 96 |
+
}
|
| 97 |
+
unpipe() {
|
| 98 |
+
this.dest.removeListener('drain', this.ondrain);
|
| 99 |
+
}
|
| 100 |
+
// only here for the prototype
|
| 101 |
+
/* c8 ignore start */
|
| 102 |
+
proxyErrors(_er) { }
|
| 103 |
+
/* c8 ignore stop */
|
| 104 |
+
end() {
|
| 105 |
+
this.unpipe();
|
| 106 |
+
if (this.opts.end)
|
| 107 |
+
this.dest.end();
|
| 108 |
+
}
|
| 109 |
+
}
|
| 110 |
+
/**
|
| 111 |
+
* Internal class representing a pipe to a destination stream where
|
| 112 |
+
* errors are proxied.
|
| 113 |
+
*
|
| 114 |
+
* @internal
|
| 115 |
+
*/
|
| 116 |
+
class PipeProxyErrors extends Pipe {
|
| 117 |
+
unpipe() {
|
| 118 |
+
this.src.removeListener('error', this.proxyErrors);
|
| 119 |
+
super.unpipe();
|
| 120 |
+
}
|
| 121 |
+
constructor(src, dest, opts) {
|
| 122 |
+
super(src, dest, opts);
|
| 123 |
+
this.proxyErrors = (er) => this.dest.emit('error', er);
|
| 124 |
+
src.on('error', this.proxyErrors);
|
| 125 |
+
}
|
| 126 |
+
}
|
| 127 |
+
const isObjectModeOptions = (o) => !!o.objectMode;
|
| 128 |
+
const isEncodingOptions = (o) => !o.objectMode && !!o.encoding && o.encoding !== 'buffer';
|
| 129 |
+
/**
|
| 130 |
+
* Main export, the Minipass class
|
| 131 |
+
*
|
| 132 |
+
* `RType` is the type of data emitted, defaults to Buffer
|
| 133 |
+
*
|
| 134 |
+
* `WType` is the type of data to be written, if RType is buffer or string,
|
| 135 |
+
* then any {@link Minipass.ContiguousData} is allowed.
|
| 136 |
+
*
|
| 137 |
+
* `Events` is the set of event handler signatures that this object
|
| 138 |
+
* will emit, see {@link Minipass.Events}
|
| 139 |
+
*/
|
| 140 |
+
export class Minipass extends EventEmitter {
|
| 141 |
+
[FLOWING] = false;
|
| 142 |
+
[PAUSED] = false;
|
| 143 |
+
[PIPES] = [];
|
| 144 |
+
[BUFFER] = [];
|
| 145 |
+
[OBJECTMODE];
|
| 146 |
+
[ENCODING];
|
| 147 |
+
[ASYNC];
|
| 148 |
+
[DECODER];
|
| 149 |
+
[EOF] = false;
|
| 150 |
+
[EMITTED_END] = false;
|
| 151 |
+
[EMITTING_END] = false;
|
| 152 |
+
[CLOSED] = false;
|
| 153 |
+
[EMITTED_ERROR] = null;
|
| 154 |
+
[BUFFERLENGTH] = 0;
|
| 155 |
+
[DESTROYED] = false;
|
| 156 |
+
[SIGNAL];
|
| 157 |
+
[ABORTED] = false;
|
| 158 |
+
[DATALISTENERS] = 0;
|
| 159 |
+
[DISCARDED] = false;
|
| 160 |
+
/**
|
| 161 |
+
* true if the stream can be written
|
| 162 |
+
*/
|
| 163 |
+
writable = true;
|
| 164 |
+
/**
|
| 165 |
+
* true if the stream can be read
|
| 166 |
+
*/
|
| 167 |
+
readable = true;
|
| 168 |
+
/**
|
| 169 |
+
* If `RType` is Buffer, then options do not need to be provided.
|
| 170 |
+
* Otherwise, an options object must be provided to specify either
|
| 171 |
+
* {@link Minipass.SharedOptions.objectMode} or
|
| 172 |
+
* {@link Minipass.SharedOptions.encoding}, as appropriate.
|
| 173 |
+
*/
|
| 174 |
+
constructor(...args) {
|
| 175 |
+
const options = (args[0] ||
|
| 176 |
+
{});
|
| 177 |
+
super();
|
| 178 |
+
if (options.objectMode && typeof options.encoding === 'string') {
|
| 179 |
+
throw new TypeError('Encoding and objectMode may not be used together');
|
| 180 |
+
}
|
| 181 |
+
if (isObjectModeOptions(options)) {
|
| 182 |
+
this[OBJECTMODE] = true;
|
| 183 |
+
this[ENCODING] = null;
|
| 184 |
+
}
|
| 185 |
+
else if (isEncodingOptions(options)) {
|
| 186 |
+
this[ENCODING] = options.encoding;
|
| 187 |
+
this[OBJECTMODE] = false;
|
| 188 |
+
}
|
| 189 |
+
else {
|
| 190 |
+
this[OBJECTMODE] = false;
|
| 191 |
+
this[ENCODING] = null;
|
| 192 |
+
}
|
| 193 |
+
this[ASYNC] = !!options.async;
|
| 194 |
+
this[DECODER] = this[ENCODING]
|
| 195 |
+
? new StringDecoder(this[ENCODING])
|
| 196 |
+
: null;
|
| 197 |
+
//@ts-ignore - private option for debugging and testing
|
| 198 |
+
if (options && options.debugExposeBuffer === true) {
|
| 199 |
+
Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] });
|
| 200 |
+
}
|
| 201 |
+
//@ts-ignore - private option for debugging and testing
|
| 202 |
+
if (options && options.debugExposePipes === true) {
|
| 203 |
+
Object.defineProperty(this, 'pipes', { get: () => this[PIPES] });
|
| 204 |
+
}
|
| 205 |
+
const { signal } = options;
|
| 206 |
+
if (signal) {
|
| 207 |
+
this[SIGNAL] = signal;
|
| 208 |
+
if (signal.aborted) {
|
| 209 |
+
this[ABORT]();
|
| 210 |
+
}
|
| 211 |
+
else {
|
| 212 |
+
signal.addEventListener('abort', () => this[ABORT]());
|
| 213 |
+
}
|
| 214 |
+
}
|
| 215 |
+
}
|
| 216 |
+
/**
|
| 217 |
+
* The amount of data stored in the buffer waiting to be read.
|
| 218 |
+
*
|
| 219 |
+
* For Buffer strings, this will be the total byte length.
|
| 220 |
+
* For string encoding streams, this will be the string character length,
|
| 221 |
+
* according to JavaScript's `string.length` logic.
|
| 222 |
+
* For objectMode streams, this is a count of the items waiting to be
|
| 223 |
+
* emitted.
|
| 224 |
+
*/
|
| 225 |
+
get bufferLength() {
|
| 226 |
+
return this[BUFFERLENGTH];
|
| 227 |
+
}
|
| 228 |
+
/**
|
| 229 |
+
* The `BufferEncoding` currently in use, or `null`
|
| 230 |
+
*/
|
| 231 |
+
get encoding() {
|
| 232 |
+
return this[ENCODING];
|
| 233 |
+
}
|
| 234 |
+
/**
|
| 235 |
+
* @deprecated - This is a read only property
|
| 236 |
+
*/
|
| 237 |
+
set encoding(_enc) {
|
| 238 |
+
throw new Error('Encoding must be set at instantiation time');
|
| 239 |
+
}
|
| 240 |
+
/**
|
| 241 |
+
* @deprecated - Encoding may only be set at instantiation time
|
| 242 |
+
*/
|
| 243 |
+
setEncoding(_enc) {
|
| 244 |
+
throw new Error('Encoding must be set at instantiation time');
|
| 245 |
+
}
|
| 246 |
+
/**
|
| 247 |
+
* True if this is an objectMode stream
|
| 248 |
+
*/
|
| 249 |
+
get objectMode() {
|
| 250 |
+
return this[OBJECTMODE];
|
| 251 |
+
}
|
| 252 |
+
/**
|
| 253 |
+
* @deprecated - This is a read-only property
|
| 254 |
+
*/
|
| 255 |
+
set objectMode(_om) {
|
| 256 |
+
throw new Error('objectMode must be set at instantiation time');
|
| 257 |
+
}
|
| 258 |
+
/**
|
| 259 |
+
* true if this is an async stream
|
| 260 |
+
*/
|
| 261 |
+
get ['async']() {
|
| 262 |
+
return this[ASYNC];
|
| 263 |
+
}
|
| 264 |
+
/**
|
| 265 |
+
* Set to true to make this stream async.
|
| 266 |
+
*
|
| 267 |
+
* Once set, it cannot be unset, as this would potentially cause incorrect
|
| 268 |
+
* behavior. Ie, a sync stream can be made async, but an async stream
|
| 269 |
+
* cannot be safely made sync.
|
| 270 |
+
*/
|
| 271 |
+
set ['async'](a) {
|
| 272 |
+
this[ASYNC] = this[ASYNC] || !!a;
|
| 273 |
+
}
|
| 274 |
+
// drop everything and get out of the flow completely
|
| 275 |
+
[ABORT]() {
|
| 276 |
+
this[ABORTED] = true;
|
| 277 |
+
this.emit('abort', this[SIGNAL]?.reason);
|
| 278 |
+
this.destroy(this[SIGNAL]?.reason);
|
| 279 |
+
}
|
| 280 |
+
/**
|
| 281 |
+
* True if the stream has been aborted.
|
| 282 |
+
*/
|
| 283 |
+
get aborted() {
|
| 284 |
+
return this[ABORTED];
|
| 285 |
+
}
|
| 286 |
+
/**
|
| 287 |
+
* No-op setter. Stream aborted status is set via the AbortSignal provided
|
| 288 |
+
* in the constructor options.
|
| 289 |
+
*/
|
| 290 |
+
set aborted(_) { }
|
| 291 |
+
write(chunk, encoding, cb) {
|
| 292 |
+
if (this[ABORTED])
|
| 293 |
+
return false;
|
| 294 |
+
if (this[EOF])
|
| 295 |
+
throw new Error('write after end');
|
| 296 |
+
if (this[DESTROYED]) {
|
| 297 |
+
this.emit('error', Object.assign(new Error('Cannot call write after a stream was destroyed'), { code: 'ERR_STREAM_DESTROYED' }));
|
| 298 |
+
return true;
|
| 299 |
+
}
|
| 300 |
+
if (typeof encoding === 'function') {
|
| 301 |
+
cb = encoding;
|
| 302 |
+
encoding = 'utf8';
|
| 303 |
+
}
|
| 304 |
+
if (!encoding)
|
| 305 |
+
encoding = 'utf8';
|
| 306 |
+
const fn = this[ASYNC] ? defer : nodefer;
|
| 307 |
+
// convert array buffers and typed array views into buffers
|
| 308 |
+
// at some point in the future, we may want to do the opposite!
|
| 309 |
+
// leave strings and buffers as-is
|
| 310 |
+
// anything is only allowed if in object mode, so throw
|
| 311 |
+
if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {
|
| 312 |
+
if (isArrayBufferView(chunk)) {
|
| 313 |
+
//@ts-ignore - sinful unsafe type changing
|
| 314 |
+
chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
| 315 |
+
}
|
| 316 |
+
else if (isArrayBufferLike(chunk)) {
|
| 317 |
+
//@ts-ignore - sinful unsafe type changing
|
| 318 |
+
chunk = Buffer.from(chunk);
|
| 319 |
+
}
|
| 320 |
+
else if (typeof chunk !== 'string') {
|
| 321 |
+
throw new Error('Non-contiguous data written to non-objectMode stream');
|
| 322 |
+
}
|
| 323 |
+
}
|
| 324 |
+
// handle object mode up front, since it's simpler
|
| 325 |
+
// this yields better performance, fewer checks later.
|
| 326 |
+
if (this[OBJECTMODE]) {
|
| 327 |
+
// maybe impossible?
|
| 328 |
+
/* c8 ignore start */
|
| 329 |
+
if (this[FLOWING] && this[BUFFERLENGTH] !== 0)
|
| 330 |
+
this[FLUSH](true);
|
| 331 |
+
/* c8 ignore stop */
|
| 332 |
+
if (this[FLOWING])
|
| 333 |
+
this.emit('data', chunk);
|
| 334 |
+
else
|
| 335 |
+
this[BUFFERPUSH](chunk);
|
| 336 |
+
if (this[BUFFERLENGTH] !== 0)
|
| 337 |
+
this.emit('readable');
|
| 338 |
+
if (cb)
|
| 339 |
+
fn(cb);
|
| 340 |
+
return this[FLOWING];
|
| 341 |
+
}
|
| 342 |
+
// at this point the chunk is a buffer or string
|
| 343 |
+
// don't buffer it up or send it to the decoder
|
| 344 |
+
if (!chunk.length) {
|
| 345 |
+
if (this[BUFFERLENGTH] !== 0)
|
| 346 |
+
this.emit('readable');
|
| 347 |
+
if (cb)
|
| 348 |
+
fn(cb);
|
| 349 |
+
return this[FLOWING];
|
| 350 |
+
}
|
| 351 |
+
// fast-path writing strings of same encoding to a stream with
|
| 352 |
+
// an empty buffer, skipping the buffer/decoder dance
|
| 353 |
+
if (typeof chunk === 'string' &&
|
| 354 |
+
// unless it is a string already ready for us to use
|
| 355 |
+
!(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)) {
|
| 356 |
+
//@ts-ignore - sinful unsafe type change
|
| 357 |
+
chunk = Buffer.from(chunk, encoding);
|
| 358 |
+
}
|
| 359 |
+
if (Buffer.isBuffer(chunk) && this[ENCODING]) {
|
| 360 |
+
//@ts-ignore - sinful unsafe type change
|
| 361 |
+
chunk = this[DECODER].write(chunk);
|
| 362 |
+
}
|
| 363 |
+
// Note: flushing CAN potentially switch us into not-flowing mode
|
| 364 |
+
if (this[FLOWING] && this[BUFFERLENGTH] !== 0)
|
| 365 |
+
this[FLUSH](true);
|
| 366 |
+
if (this[FLOWING])
|
| 367 |
+
this.emit('data', chunk);
|
| 368 |
+
else
|
| 369 |
+
this[BUFFERPUSH](chunk);
|
| 370 |
+
if (this[BUFFERLENGTH] !== 0)
|
| 371 |
+
this.emit('readable');
|
| 372 |
+
if (cb)
|
| 373 |
+
fn(cb);
|
| 374 |
+
return this[FLOWING];
|
| 375 |
+
}
|
| 376 |
+
/**
|
| 377 |
+
* Low-level explicit read method.
|
| 378 |
+
*
|
| 379 |
+
* In objectMode, the argument is ignored, and one item is returned if
|
| 380 |
+
* available.
|
| 381 |
+
*
|
| 382 |
+
* `n` is the number of bytes (or in the case of encoding streams,
|
| 383 |
+
* characters) to consume. If `n` is not provided, then the entire buffer
|
| 384 |
+
* is returned, or `null` is returned if no data is available.
|
| 385 |
+
*
|
| 386 |
+
* If `n` is greater that the amount of data in the internal buffer,
|
| 387 |
+
* then `null` is returned.
|
| 388 |
+
*/
|
| 389 |
+
read(n) {
|
| 390 |
+
if (this[DESTROYED])
|
| 391 |
+
return null;
|
| 392 |
+
this[DISCARDED] = false;
|
| 393 |
+
if (this[BUFFERLENGTH] === 0 ||
|
| 394 |
+
n === 0 ||
|
| 395 |
+
(n && n > this[BUFFERLENGTH])) {
|
| 396 |
+
this[MAYBE_EMIT_END]();
|
| 397 |
+
return null;
|
| 398 |
+
}
|
| 399 |
+
if (this[OBJECTMODE])
|
| 400 |
+
n = null;
|
| 401 |
+
if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {
|
| 402 |
+
// not object mode, so if we have an encoding, then RType is string
|
| 403 |
+
// otherwise, must be Buffer
|
| 404 |
+
this[BUFFER] = [
|
| 405 |
+
(this[ENCODING]
|
| 406 |
+
? this[BUFFER].join('')
|
| 407 |
+
: Buffer.concat(this[BUFFER], this[BUFFERLENGTH])),
|
| 408 |
+
];
|
| 409 |
+
}
|
| 410 |
+
const ret = this[READ](n || null, this[BUFFER][0]);
|
| 411 |
+
this[MAYBE_EMIT_END]();
|
| 412 |
+
return ret;
|
| 413 |
+
}
|
| 414 |
+
[READ](n, chunk) {
|
| 415 |
+
if (this[OBJECTMODE])
|
| 416 |
+
this[BUFFERSHIFT]();
|
| 417 |
+
else {
|
| 418 |
+
const c = chunk;
|
| 419 |
+
if (n === c.length || n === null)
|
| 420 |
+
this[BUFFERSHIFT]();
|
| 421 |
+
else if (typeof c === 'string') {
|
| 422 |
+
this[BUFFER][0] = c.slice(n);
|
| 423 |
+
chunk = c.slice(0, n);
|
| 424 |
+
this[BUFFERLENGTH] -= n;
|
| 425 |
+
}
|
| 426 |
+
else {
|
| 427 |
+
this[BUFFER][0] = c.subarray(n);
|
| 428 |
+
chunk = c.subarray(0, n);
|
| 429 |
+
this[BUFFERLENGTH] -= n;
|
| 430 |
+
}
|
| 431 |
+
}
|
| 432 |
+
this.emit('data', chunk);
|
| 433 |
+
if (!this[BUFFER].length && !this[EOF])
|
| 434 |
+
this.emit('drain');
|
| 435 |
+
return chunk;
|
| 436 |
+
}
|
| 437 |
+
end(chunk, encoding, cb) {
|
| 438 |
+
if (typeof chunk === 'function') {
|
| 439 |
+
cb = chunk;
|
| 440 |
+
chunk = undefined;
|
| 441 |
+
}
|
| 442 |
+
if (typeof encoding === 'function') {
|
| 443 |
+
cb = encoding;
|
| 444 |
+
encoding = 'utf8';
|
| 445 |
+
}
|
| 446 |
+
if (chunk !== undefined)
|
| 447 |
+
this.write(chunk, encoding);
|
| 448 |
+
if (cb)
|
| 449 |
+
this.once('end', cb);
|
| 450 |
+
this[EOF] = true;
|
| 451 |
+
this.writable = false;
|
| 452 |
+
// if we haven't written anything, then go ahead and emit,
|
| 453 |
+
// even if we're not reading.
|
| 454 |
+
// we'll re-emit if a new 'end' listener is added anyway.
|
| 455 |
+
// This makes MP more suitable to write-only use cases.
|
| 456 |
+
if (this[FLOWING] || !this[PAUSED])
|
| 457 |
+
this[MAYBE_EMIT_END]();
|
| 458 |
+
return this;
|
| 459 |
+
}
|
| 460 |
+
// don't let the internal resume be overwritten
|
| 461 |
+
[RESUME]() {
|
| 462 |
+
if (this[DESTROYED])
|
| 463 |
+
return;
|
| 464 |
+
if (!this[DATALISTENERS] && !this[PIPES].length) {
|
| 465 |
+
this[DISCARDED] = true;
|
| 466 |
+
}
|
| 467 |
+
this[PAUSED] = false;
|
| 468 |
+
this[FLOWING] = true;
|
| 469 |
+
this.emit('resume');
|
| 470 |
+
if (this[BUFFER].length)
|
| 471 |
+
this[FLUSH]();
|
| 472 |
+
else if (this[EOF])
|
| 473 |
+
this[MAYBE_EMIT_END]();
|
| 474 |
+
else
|
| 475 |
+
this.emit('drain');
|
| 476 |
+
}
|
| 477 |
+
/**
|
| 478 |
+
* Resume the stream if it is currently in a paused state
|
| 479 |
+
*
|
| 480 |
+
* If called when there are no pipe destinations or `data` event listeners,
|
| 481 |
+
* this will place the stream in a "discarded" state, where all data will
|
| 482 |
+
* be thrown away. The discarded state is removed if a pipe destination or
|
| 483 |
+
* data handler is added, if pause() is called, or if any synchronous or
|
| 484 |
+
* asynchronous iteration is started.
|
| 485 |
+
*/
|
| 486 |
+
resume() {
|
| 487 |
+
return this[RESUME]();
|
| 488 |
+
}
|
| 489 |
+
/**
|
| 490 |
+
* Pause the stream
|
| 491 |
+
*/
|
| 492 |
+
pause() {
|
| 493 |
+
this[FLOWING] = false;
|
| 494 |
+
this[PAUSED] = true;
|
| 495 |
+
this[DISCARDED] = false;
|
| 496 |
+
}
|
| 497 |
+
/**
|
| 498 |
+
* true if the stream has been forcibly destroyed
|
| 499 |
+
*/
|
| 500 |
+
get destroyed() {
|
| 501 |
+
return this[DESTROYED];
|
| 502 |
+
}
|
| 503 |
+
/**
|
| 504 |
+
* true if the stream is currently in a flowing state, meaning that
|
| 505 |
+
* any writes will be immediately emitted.
|
| 506 |
+
*/
|
| 507 |
+
get flowing() {
|
| 508 |
+
return this[FLOWING];
|
| 509 |
+
}
|
| 510 |
+
/**
|
| 511 |
+
* true if the stream is currently in a paused state
|
| 512 |
+
*/
|
| 513 |
+
get paused() {
|
| 514 |
+
return this[PAUSED];
|
| 515 |
+
}
|
| 516 |
+
[BUFFERPUSH](chunk) {
|
| 517 |
+
if (this[OBJECTMODE])
|
| 518 |
+
this[BUFFERLENGTH] += 1;
|
| 519 |
+
else
|
| 520 |
+
this[BUFFERLENGTH] += chunk.length;
|
| 521 |
+
this[BUFFER].push(chunk);
|
| 522 |
+
}
|
| 523 |
+
[BUFFERSHIFT]() {
|
| 524 |
+
if (this[OBJECTMODE])
|
| 525 |
+
this[BUFFERLENGTH] -= 1;
|
| 526 |
+
else
|
| 527 |
+
this[BUFFERLENGTH] -= this[BUFFER][0].length;
|
| 528 |
+
return this[BUFFER].shift();
|
| 529 |
+
}
|
| 530 |
+
[FLUSH](noDrain = false) {
|
| 531 |
+
do { } while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&
|
| 532 |
+
this[BUFFER].length);
|
| 533 |
+
if (!noDrain && !this[BUFFER].length && !this[EOF])
|
| 534 |
+
this.emit('drain');
|
| 535 |
+
}
|
| 536 |
+
[FLUSHCHUNK](chunk) {
|
| 537 |
+
this.emit('data', chunk);
|
| 538 |
+
return this[FLOWING];
|
| 539 |
+
}
|
| 540 |
+
/**
|
| 541 |
+
* Pipe all data emitted by this stream into the destination provided.
|
| 542 |
+
*
|
| 543 |
+
* Triggers the flow of data.
|
| 544 |
+
*/
|
| 545 |
+
pipe(dest, opts) {
|
| 546 |
+
if (this[DESTROYED])
|
| 547 |
+
return dest;
|
| 548 |
+
this[DISCARDED] = false;
|
| 549 |
+
const ended = this[EMITTED_END];
|
| 550 |
+
opts = opts || {};
|
| 551 |
+
if (dest === proc.stdout || dest === proc.stderr)
|
| 552 |
+
opts.end = false;
|
| 553 |
+
else
|
| 554 |
+
opts.end = opts.end !== false;
|
| 555 |
+
opts.proxyErrors = !!opts.proxyErrors;
|
| 556 |
+
// piping an ended stream ends immediately
|
| 557 |
+
if (ended) {
|
| 558 |
+
if (opts.end)
|
| 559 |
+
dest.end();
|
| 560 |
+
}
|
| 561 |
+
else {
|
| 562 |
+
// "as" here just ignores the WType, which pipes don't care about,
|
| 563 |
+
// since they're only consuming from us, and writing to the dest
|
| 564 |
+
this[PIPES].push(!opts.proxyErrors
|
| 565 |
+
? new Pipe(this, dest, opts)
|
| 566 |
+
: new PipeProxyErrors(this, dest, opts));
|
| 567 |
+
if (this[ASYNC])
|
| 568 |
+
defer(() => this[RESUME]());
|
| 569 |
+
else
|
| 570 |
+
this[RESUME]();
|
| 571 |
+
}
|
| 572 |
+
return dest;
|
| 573 |
+
}
|
| 574 |
+
/**
|
| 575 |
+
* Fully unhook a piped destination stream.
|
| 576 |
+
*
|
| 577 |
+
* If the destination stream was the only consumer of this stream (ie,
|
| 578 |
+
* there are no other piped destinations or `'data'` event listeners)
|
| 579 |
+
* then the flow of data will stop until there is another consumer or
|
| 580 |
+
* {@link Minipass#resume} is explicitly called.
|
| 581 |
+
*/
|
| 582 |
+
unpipe(dest) {
|
| 583 |
+
const p = this[PIPES].find(p => p.dest === dest);
|
| 584 |
+
if (p) {
|
| 585 |
+
if (this[PIPES].length === 1) {
|
| 586 |
+
if (this[FLOWING] && this[DATALISTENERS] === 0) {
|
| 587 |
+
this[FLOWING] = false;
|
| 588 |
+
}
|
| 589 |
+
this[PIPES] = [];
|
| 590 |
+
}
|
| 591 |
+
else
|
| 592 |
+
this[PIPES].splice(this[PIPES].indexOf(p), 1);
|
| 593 |
+
p.unpipe();
|
| 594 |
+
}
|
| 595 |
+
}
|
| 596 |
+
/**
|
| 597 |
+
* Alias for {@link Minipass#on}
|
| 598 |
+
*/
|
| 599 |
+
addListener(ev, handler) {
|
| 600 |
+
return this.on(ev, handler);
|
| 601 |
+
}
|
| 602 |
+
/**
|
| 603 |
+
* Mostly identical to `EventEmitter.on`, with the following
|
| 604 |
+
* behavior differences to prevent data loss and unnecessary hangs:
|
| 605 |
+
*
|
| 606 |
+
* - Adding a 'data' event handler will trigger the flow of data
|
| 607 |
+
*
|
| 608 |
+
* - Adding a 'readable' event handler when there is data waiting to be read
|
| 609 |
+
* will cause 'readable' to be emitted immediately.
|
| 610 |
+
*
|
| 611 |
+
* - Adding an 'endish' event handler ('end', 'finish', etc.) which has
|
| 612 |
+
* already passed will cause the event to be emitted immediately and all
|
| 613 |
+
* handlers removed.
|
| 614 |
+
*
|
| 615 |
+
* - Adding an 'error' event handler after an error has been emitted will
|
| 616 |
+
* cause the event to be re-emitted immediately with the error previously
|
| 617 |
+
* raised.
|
| 618 |
+
*/
|
| 619 |
+
on(ev, handler) {
|
| 620 |
+
const ret = super.on(ev, handler);
|
| 621 |
+
if (ev === 'data') {
|
| 622 |
+
this[DISCARDED] = false;
|
| 623 |
+
this[DATALISTENERS]++;
|
| 624 |
+
if (!this[PIPES].length && !this[FLOWING]) {
|
| 625 |
+
this[RESUME]();
|
| 626 |
+
}
|
| 627 |
+
}
|
| 628 |
+
else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {
|
| 629 |
+
super.emit('readable');
|
| 630 |
+
}
|
| 631 |
+
else if (isEndish(ev) && this[EMITTED_END]) {
|
| 632 |
+
super.emit(ev);
|
| 633 |
+
this.removeAllListeners(ev);
|
| 634 |
+
}
|
| 635 |
+
else if (ev === 'error' && this[EMITTED_ERROR]) {
|
| 636 |
+
const h = handler;
|
| 637 |
+
if (this[ASYNC])
|
| 638 |
+
defer(() => h.call(this, this[EMITTED_ERROR]));
|
| 639 |
+
else
|
| 640 |
+
h.call(this, this[EMITTED_ERROR]);
|
| 641 |
+
}
|
| 642 |
+
return ret;
|
| 643 |
+
}
|
| 644 |
+
/**
|
| 645 |
+
* Alias for {@link Minipass#off}
|
| 646 |
+
*/
|
| 647 |
+
removeListener(ev, handler) {
|
| 648 |
+
return this.off(ev, handler);
|
| 649 |
+
}
|
| 650 |
+
/**
|
| 651 |
+
* Mostly identical to `EventEmitter.off`
|
| 652 |
+
*
|
| 653 |
+
* If a 'data' event handler is removed, and it was the last consumer
|
| 654 |
+
* (ie, there are no pipe destinations or other 'data' event listeners),
|
| 655 |
+
* then the flow of data will stop until there is another consumer or
|
| 656 |
+
* {@link Minipass#resume} is explicitly called.
|
| 657 |
+
*/
|
| 658 |
+
off(ev, handler) {
|
| 659 |
+
const ret = super.off(ev, handler);
|
| 660 |
+
// if we previously had listeners, and now we don't, and we don't
|
| 661 |
+
// have any pipes, then stop the flow, unless it's been explicitly
|
| 662 |
+
// put in a discarded flowing state via stream.resume().
|
| 663 |
+
if (ev === 'data') {
|
| 664 |
+
this[DATALISTENERS] = this.listeners('data').length;
|
| 665 |
+
if (this[DATALISTENERS] === 0 &&
|
| 666 |
+
!this[DISCARDED] &&
|
| 667 |
+
!this[PIPES].length) {
|
| 668 |
+
this[FLOWING] = false;
|
| 669 |
+
}
|
| 670 |
+
}
|
| 671 |
+
return ret;
|
| 672 |
+
}
|
| 673 |
+
/**
|
| 674 |
+
* Mostly identical to `EventEmitter.removeAllListeners`
|
| 675 |
+
*
|
| 676 |
+
* If all 'data' event handlers are removed, and they were the last consumer
|
| 677 |
+
* (ie, there are no pipe destinations), then the flow of data will stop
|
| 678 |
+
* until there is another consumer or {@link Minipass#resume} is explicitly
|
| 679 |
+
* called.
|
| 680 |
+
*/
|
| 681 |
+
removeAllListeners(ev) {
|
| 682 |
+
const ret = super.removeAllListeners(ev);
|
| 683 |
+
if (ev === 'data' || ev === undefined) {
|
| 684 |
+
this[DATALISTENERS] = 0;
|
| 685 |
+
if (!this[DISCARDED] && !this[PIPES].length) {
|
| 686 |
+
this[FLOWING] = false;
|
| 687 |
+
}
|
| 688 |
+
}
|
| 689 |
+
return ret;
|
| 690 |
+
}
|
| 691 |
+
/**
|
| 692 |
+
* true if the 'end' event has been emitted
|
| 693 |
+
*/
|
| 694 |
+
get emittedEnd() {
|
| 695 |
+
return this[EMITTED_END];
|
| 696 |
+
}
|
| 697 |
+
[MAYBE_EMIT_END]() {
|
| 698 |
+
if (!this[EMITTING_END] &&
|
| 699 |
+
!this[EMITTED_END] &&
|
| 700 |
+
!this[DESTROYED] &&
|
| 701 |
+
this[BUFFER].length === 0 &&
|
| 702 |
+
this[EOF]) {
|
| 703 |
+
this[EMITTING_END] = true;
|
| 704 |
+
this.emit('end');
|
| 705 |
+
this.emit('prefinish');
|
| 706 |
+
this.emit('finish');
|
| 707 |
+
if (this[CLOSED])
|
| 708 |
+
this.emit('close');
|
| 709 |
+
this[EMITTING_END] = false;
|
| 710 |
+
}
|
| 711 |
+
}
|
| 712 |
+
/**
|
| 713 |
+
* Mostly identical to `EventEmitter.emit`, with the following
|
| 714 |
+
* behavior differences to prevent data loss and unnecessary hangs:
|
| 715 |
+
*
|
| 716 |
+
* If the stream has been destroyed, and the event is something other
|
| 717 |
+
* than 'close' or 'error', then `false` is returned and no handlers
|
| 718 |
+
* are called.
|
| 719 |
+
*
|
| 720 |
+
* If the event is 'end', and has already been emitted, then the event
|
| 721 |
+
* is ignored. If the stream is in a paused or non-flowing state, then
|
| 722 |
+
* the event will be deferred until data flow resumes. If the stream is
|
| 723 |
+
* async, then handlers will be called on the next tick rather than
|
| 724 |
+
* immediately.
|
| 725 |
+
*
|
| 726 |
+
* If the event is 'close', and 'end' has not yet been emitted, then
|
| 727 |
+
* the event will be deferred until after 'end' is emitted.
|
| 728 |
+
*
|
| 729 |
+
* If the event is 'error', and an AbortSignal was provided for the stream,
|
| 730 |
+
* and there are no listeners, then the event is ignored, matching the
|
| 731 |
+
* behavior of node core streams in the presense of an AbortSignal.
|
| 732 |
+
*
|
| 733 |
+
* If the event is 'finish' or 'prefinish', then all listeners will be
|
| 734 |
+
* removed after emitting the event, to prevent double-firing.
|
| 735 |
+
*/
|
| 736 |
+
emit(ev, ...args) {
|
| 737 |
+
const data = args[0];
|
| 738 |
+
// error and close are only events allowed after calling destroy()
|
| 739 |
+
if (ev !== 'error' &&
|
| 740 |
+
ev !== 'close' &&
|
| 741 |
+
ev !== DESTROYED &&
|
| 742 |
+
this[DESTROYED]) {
|
| 743 |
+
return false;
|
| 744 |
+
}
|
| 745 |
+
else if (ev === 'data') {
|
| 746 |
+
return !this[OBJECTMODE] && !data
|
| 747 |
+
? false
|
| 748 |
+
: this[ASYNC]
|
| 749 |
+
? (defer(() => this[EMITDATA](data)), true)
|
| 750 |
+
: this[EMITDATA](data);
|
| 751 |
+
}
|
| 752 |
+
else if (ev === 'end') {
|
| 753 |
+
return this[EMITEND]();
|
| 754 |
+
}
|
| 755 |
+
else if (ev === 'close') {
|
| 756 |
+
this[CLOSED] = true;
|
| 757 |
+
// don't emit close before 'end' and 'finish'
|
| 758 |
+
if (!this[EMITTED_END] && !this[DESTROYED])
|
| 759 |
+
return false;
|
| 760 |
+
const ret = super.emit('close');
|
| 761 |
+
this.removeAllListeners('close');
|
| 762 |
+
return ret;
|
| 763 |
+
}
|
| 764 |
+
else if (ev === 'error') {
|
| 765 |
+
this[EMITTED_ERROR] = data;
|
| 766 |
+
super.emit(ERROR, data);
|
| 767 |
+
const ret = !this[SIGNAL] || this.listeners('error').length
|
| 768 |
+
? super.emit('error', data)
|
| 769 |
+
: false;
|
| 770 |
+
this[MAYBE_EMIT_END]();
|
| 771 |
+
return ret;
|
| 772 |
+
}
|
| 773 |
+
else if (ev === 'resume') {
|
| 774 |
+
const ret = super.emit('resume');
|
| 775 |
+
this[MAYBE_EMIT_END]();
|
| 776 |
+
return ret;
|
| 777 |
+
}
|
| 778 |
+
else if (ev === 'finish' || ev === 'prefinish') {
|
| 779 |
+
const ret = super.emit(ev);
|
| 780 |
+
this.removeAllListeners(ev);
|
| 781 |
+
return ret;
|
| 782 |
+
}
|
| 783 |
+
// Some other unknown event
|
| 784 |
+
const ret = super.emit(ev, ...args);
|
| 785 |
+
this[MAYBE_EMIT_END]();
|
| 786 |
+
return ret;
|
| 787 |
+
}
|
| 788 |
+
[EMITDATA](data) {
|
| 789 |
+
for (const p of this[PIPES]) {
|
| 790 |
+
if (p.dest.write(data) === false)
|
| 791 |
+
this.pause();
|
| 792 |
+
}
|
| 793 |
+
const ret = this[DISCARDED] ? false : super.emit('data', data);
|
| 794 |
+
this[MAYBE_EMIT_END]();
|
| 795 |
+
return ret;
|
| 796 |
+
}
|
| 797 |
+
[EMITEND]() {
|
| 798 |
+
if (this[EMITTED_END])
|
| 799 |
+
return false;
|
| 800 |
+
this[EMITTED_END] = true;
|
| 801 |
+
this.readable = false;
|
| 802 |
+
return this[ASYNC]
|
| 803 |
+
? (defer(() => this[EMITEND2]()), true)
|
| 804 |
+
: this[EMITEND2]();
|
| 805 |
+
}
|
| 806 |
+
[EMITEND2]() {
|
| 807 |
+
if (this[DECODER]) {
|
| 808 |
+
const data = this[DECODER].end();
|
| 809 |
+
if (data) {
|
| 810 |
+
for (const p of this[PIPES]) {
|
| 811 |
+
p.dest.write(data);
|
| 812 |
+
}
|
| 813 |
+
if (!this[DISCARDED])
|
| 814 |
+
super.emit('data', data);
|
| 815 |
+
}
|
| 816 |
+
}
|
| 817 |
+
for (const p of this[PIPES]) {
|
| 818 |
+
p.end();
|
| 819 |
+
}
|
| 820 |
+
const ret = super.emit('end');
|
| 821 |
+
this.removeAllListeners('end');
|
| 822 |
+
return ret;
|
| 823 |
+
}
|
| 824 |
+
/**
|
| 825 |
+
* Return a Promise that resolves to an array of all emitted data once
|
| 826 |
+
* the stream ends.
|
| 827 |
+
*/
|
| 828 |
+
async collect() {
|
| 829 |
+
const buf = Object.assign([], {
|
| 830 |
+
dataLength: 0,
|
| 831 |
+
});
|
| 832 |
+
if (!this[OBJECTMODE])
|
| 833 |
+
buf.dataLength = 0;
|
| 834 |
+
// set the promise first, in case an error is raised
|
| 835 |
+
// by triggering the flow here.
|
| 836 |
+
const p = this.promise();
|
| 837 |
+
this.on('data', c => {
|
| 838 |
+
buf.push(c);
|
| 839 |
+
if (!this[OBJECTMODE])
|
| 840 |
+
buf.dataLength += c.length;
|
| 841 |
+
});
|
| 842 |
+
await p;
|
| 843 |
+
return buf;
|
| 844 |
+
}
|
| 845 |
+
/**
|
| 846 |
+
* Return a Promise that resolves to the concatenation of all emitted data
|
| 847 |
+
* once the stream ends.
|
| 848 |
+
*
|
| 849 |
+
* Not allowed on objectMode streams.
|
| 850 |
+
*/
|
| 851 |
+
async concat() {
|
| 852 |
+
if (this[OBJECTMODE]) {
|
| 853 |
+
throw new Error('cannot concat in objectMode');
|
| 854 |
+
}
|
| 855 |
+
const buf = await this.collect();
|
| 856 |
+
return (this[ENCODING]
|
| 857 |
+
? buf.join('')
|
| 858 |
+
: Buffer.concat(buf, buf.dataLength));
|
| 859 |
+
}
|
| 860 |
+
/**
|
| 861 |
+
* Return a void Promise that resolves once the stream ends.
|
| 862 |
+
*/
|
| 863 |
+
async promise() {
|
| 864 |
+
return new Promise((resolve, reject) => {
|
| 865 |
+
this.on(DESTROYED, () => reject(new Error('stream destroyed')));
|
| 866 |
+
this.on('error', er => reject(er));
|
| 867 |
+
this.on('end', () => resolve());
|
| 868 |
+
});
|
| 869 |
+
}
|
| 870 |
+
/**
|
| 871 |
+
* Asynchronous `for await of` iteration.
|
| 872 |
+
*
|
| 873 |
+
* This will continue emitting all chunks until the stream terminates.
|
| 874 |
+
*/
|
| 875 |
+
[Symbol.asyncIterator]() {
|
| 876 |
+
// set this up front, in case the consumer doesn't call next()
|
| 877 |
+
// right away.
|
| 878 |
+
this[DISCARDED] = false;
|
| 879 |
+
let stopped = false;
|
| 880 |
+
const stop = async () => {
|
| 881 |
+
this.pause();
|
| 882 |
+
stopped = true;
|
| 883 |
+
return { value: undefined, done: true };
|
| 884 |
+
};
|
| 885 |
+
const next = () => {
|
| 886 |
+
if (stopped)
|
| 887 |
+
return stop();
|
| 888 |
+
const res = this.read();
|
| 889 |
+
if (res !== null)
|
| 890 |
+
return Promise.resolve({ done: false, value: res });
|
| 891 |
+
if (this[EOF])
|
| 892 |
+
return stop();
|
| 893 |
+
let resolve;
|
| 894 |
+
let reject;
|
| 895 |
+
const onerr = (er) => {
|
| 896 |
+
this.off('data', ondata);
|
| 897 |
+
this.off('end', onend);
|
| 898 |
+
this.off(DESTROYED, ondestroy);
|
| 899 |
+
stop();
|
| 900 |
+
reject(er);
|
| 901 |
+
};
|
| 902 |
+
const ondata = (value) => {
|
| 903 |
+
this.off('error', onerr);
|
| 904 |
+
this.off('end', onend);
|
| 905 |
+
this.off(DESTROYED, ondestroy);
|
| 906 |
+
this.pause();
|
| 907 |
+
resolve({ value, done: !!this[EOF] });
|
| 908 |
+
};
|
| 909 |
+
const onend = () => {
|
| 910 |
+
this.off('error', onerr);
|
| 911 |
+
this.off('data', ondata);
|
| 912 |
+
this.off(DESTROYED, ondestroy);
|
| 913 |
+
stop();
|
| 914 |
+
resolve({ done: true, value: undefined });
|
| 915 |
+
};
|
| 916 |
+
const ondestroy = () => onerr(new Error('stream destroyed'));
|
| 917 |
+
return new Promise((res, rej) => {
|
| 918 |
+
reject = rej;
|
| 919 |
+
resolve = res;
|
| 920 |
+
this.once(DESTROYED, ondestroy);
|
| 921 |
+
this.once('error', onerr);
|
| 922 |
+
this.once('end', onend);
|
| 923 |
+
this.once('data', ondata);
|
| 924 |
+
});
|
| 925 |
+
};
|
| 926 |
+
return {
|
| 927 |
+
next,
|
| 928 |
+
throw: stop,
|
| 929 |
+
return: stop,
|
| 930 |
+
[Symbol.asyncIterator]() {
|
| 931 |
+
return this;
|
| 932 |
+
},
|
| 933 |
+
[Symbol.asyncDispose]: async () => { },
|
| 934 |
+
};
|
| 935 |
+
}
|
| 936 |
+
/**
|
| 937 |
+
* Synchronous `for of` iteration.
|
| 938 |
+
*
|
| 939 |
+
* The iteration will terminate when the internal buffer runs out, even
|
| 940 |
+
* if the stream has not yet terminated.
|
| 941 |
+
*/
|
| 942 |
+
[Symbol.iterator]() {
|
| 943 |
+
// set this up front, in case the consumer doesn't call next()
|
| 944 |
+
// right away.
|
| 945 |
+
this[DISCARDED] = false;
|
| 946 |
+
let stopped = false;
|
| 947 |
+
const stop = () => {
|
| 948 |
+
this.pause();
|
| 949 |
+
this.off(ERROR, stop);
|
| 950 |
+
this.off(DESTROYED, stop);
|
| 951 |
+
this.off('end', stop);
|
| 952 |
+
stopped = true;
|
| 953 |
+
return { done: true, value: undefined };
|
| 954 |
+
};
|
| 955 |
+
const next = () => {
|
| 956 |
+
if (stopped)
|
| 957 |
+
return stop();
|
| 958 |
+
const value = this.read();
|
| 959 |
+
return value === null ? stop() : { done: false, value };
|
| 960 |
+
};
|
| 961 |
+
this.once('end', stop);
|
| 962 |
+
this.once(ERROR, stop);
|
| 963 |
+
this.once(DESTROYED, stop);
|
| 964 |
+
return {
|
| 965 |
+
next,
|
| 966 |
+
throw: stop,
|
| 967 |
+
return: stop,
|
| 968 |
+
[Symbol.iterator]() {
|
| 969 |
+
return this;
|
| 970 |
+
},
|
| 971 |
+
[Symbol.dispose]: () => { },
|
| 972 |
+
};
|
| 973 |
+
}
|
| 974 |
+
/**
|
| 975 |
+
* Destroy a stream, preventing it from being used for any further purpose.
|
| 976 |
+
*
|
| 977 |
+
* If the stream has a `close()` method, then it will be called on
|
| 978 |
+
* destruction.
|
| 979 |
+
*
|
| 980 |
+
* After destruction, any attempt to write data, read data, or emit most
|
| 981 |
+
* events will be ignored.
|
| 982 |
+
*
|
| 983 |
+
* If an error argument is provided, then it will be emitted in an
|
| 984 |
+
* 'error' event.
|
| 985 |
+
*/
|
| 986 |
+
destroy(er) {
|
| 987 |
+
if (this[DESTROYED]) {
|
| 988 |
+
if (er)
|
| 989 |
+
this.emit('error', er);
|
| 990 |
+
else
|
| 991 |
+
this.emit(DESTROYED);
|
| 992 |
+
return this;
|
| 993 |
+
}
|
| 994 |
+
this[DESTROYED] = true;
|
| 995 |
+
this[DISCARDED] = true;
|
| 996 |
+
// throw away all buffered data, it's never coming out
|
| 997 |
+
this[BUFFER].length = 0;
|
| 998 |
+
this[BUFFERLENGTH] = 0;
|
| 999 |
+
const wc = this;
|
| 1000 |
+
if (typeof wc.close === 'function' && !this[CLOSED])
|
| 1001 |
+
wc.close();
|
| 1002 |
+
if (er)
|
| 1003 |
+
this.emit('error', er);
|
| 1004 |
+
// if no error to emit, still reject pending promises
|
| 1005 |
+
else
|
| 1006 |
+
this.emit(DESTROYED);
|
| 1007 |
+
return this;
|
| 1008 |
+
}
|
| 1009 |
+
/**
|
| 1010 |
+
* Alias for {@link isStream}
|
| 1011 |
+
*
|
| 1012 |
+
* Former export location, maintained for backwards compatibility.
|
| 1013 |
+
*
|
| 1014 |
+
* @deprecated
|
| 1015 |
+
*/
|
| 1016 |
+
static get isStream() {
|
| 1017 |
+
return isStream;
|
| 1018 |
+
}
|
| 1019 |
+
}
|
| 1020 |
+
//# sourceMappingURL=index.js.map
|
tools/ui/node_modules/minipass/dist/esm/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GACR,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO;IACpC,CAAC,CAAC,OAAO;IACT,CAAC,CAAC;QACE,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;KACb,CAAA;AACP,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AASnD;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,CAAM,EACsC,EAAE,CAC9C,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,CAAC,YAAY,QAAQ;QACpB,CAAC,YAAY,MAAM;QACnB,UAAU,CAAC,CAAC,CAAC;QACb,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;AAElB;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAM,EAA0B,EAAE,CAC3D,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,YAAY,YAAY;IACzB,OAAQ,CAAuB,CAAC,IAAI,KAAK,UAAU;IACnD,iEAAiE;IAChE,CAAuB,CAAC,IAAI,KAAK,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAA;AAElE;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAM,EAA0B,EAAE,CAC3D,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,YAAY,YAAY;IACzB,OAAQ,CAAuB,CAAC,KAAK,KAAK,UAA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AC,CAAA;YACzB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;QACtB,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;QAEtB,sDAAsD;QACtD,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;QACvB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;QAEtB,MAAM,EAAE,GAAG,IAEV,CAAA;QACD,IAAI,OAAO,EAAE,CAAC,KAAK,KAAK,UAAU,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,EAAE,CAAC,KAAK,EAAE,CAAA;QAE/D,IAAI,EAAE;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;QAC9B,qDAAqD;;YAChD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAEzB,OAAO,IAAI,CAAA;IAAA,CACZ;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ,GAAG;QACpB,OAAO,QAAQ,CAAA;IAAA,CAChB;CACF","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe<T extends unknown> {\n src: Minipass<T>\n dest: Minipass<any, T>\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass<T>,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass<any, T>\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors<T> extends Pipe<T> {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass<T>,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = (er: Error) => this.dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass<any, any, any>\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass<any, any, any>\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable<T> = Iterable<T> & AsyncIterable<T>\n\n type EventArguments = Record<string | symbol, unknown[]>\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events<RType extends any = Buffer>\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options<T> =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events<RType> = Minipass.Events<RType>\n >\n extends EventEmitter\n implements Minipass.DualIterable<RType>\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe<RType>[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options<RType>]\n : [Minipass.Options<RType>])\n ) {\n const options: Minipass.Options<RType> = (args[0] ||\n {}) as Minipass.Options<RType>\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe<W extends Minipass.Writable>(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe<RType>(this as Minipass<RType>, dest, opts)\n : new PipeProxyErrors<RType>(this as Minipass<RType>, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe<W extends Minipass.Writable>(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener<Event extends keyof Events>(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on<Event extends keyof Events>(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener<Event extends keyof Events>(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off<Event extends keyof Events>(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners<Event extends keyof Events>(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit<Event extends keyof Events>(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise<RType[] & { dataLength: number }> {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise<RType> {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator<RType, void, void> {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise<IteratorReturnResult<void>> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise<IteratorResult<RType, void>> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult<RType>) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise<IteratorResult<RType>>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n [Symbol.asyncDispose]: async () => {},\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator<RType, void, void> {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult<void> => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult<RType, void> => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n [Symbol.dispose]: () => {},\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass<RType, WType, Events> & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]}
|
tools/ui/node_modules/minipass/dist/esm/package.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"type": "module"
|
| 3 |
+
}
|
tools/ui/node_modules/minipass/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "minipass",
|
| 3 |
+
"version": "7.1.3",
|
| 4 |
+
"description": "minimal implementation of a PassThrough stream",
|
| 5 |
+
"main": "./dist/commonjs/index.js",
|
| 6 |
+
"types": "./dist/commonjs/index.d.ts",
|
| 7 |
+
"module": "./dist/esm/index.js",
|
| 8 |
+
"type": "module",
|
| 9 |
+
"tshy": {
|
| 10 |
+
"selfLink": false,
|
| 11 |
+
"compiler": "tsgo",
|
| 12 |
+
"exports": {
|
| 13 |
+
"./package.json": "./package.json",
|
| 14 |
+
".": "./src/index.ts"
|
| 15 |
+
}
|
| 16 |
+
},
|
| 17 |
+
"exports": {
|
| 18 |
+
"./package.json": "./package.json",
|
| 19 |
+
".": {
|
| 20 |
+
"import": {
|
| 21 |
+
"types": "./dist/esm/index.d.ts",
|
| 22 |
+
"default": "./dist/esm/index.js"
|
| 23 |
+
},
|
| 24 |
+
"require": {
|
| 25 |
+
"types": "./dist/commonjs/index.d.ts",
|
| 26 |
+
"default": "./dist/commonjs/index.js"
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
},
|
| 30 |
+
"files": [
|
| 31 |
+
"dist"
|
| 32 |
+
],
|
| 33 |
+
"scripts": {
|
| 34 |
+
"preversion": "npm test",
|
| 35 |
+
"postversion": "npm publish",
|
| 36 |
+
"prepublishOnly": "git push origin --follow-tags",
|
| 37 |
+
"prepare": "tshy",
|
| 38 |
+
"pretest": "npm run prepare",
|
| 39 |
+
"presnap": "npm run prepare",
|
| 40 |
+
"test": "tap",
|
| 41 |
+
"snap": "tap",
|
| 42 |
+
"format": "prettier --write . --loglevel warn",
|
| 43 |
+
"typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
|
| 44 |
+
},
|
| 45 |
+
"prettier": {
|
| 46 |
+
"semi": false,
|
| 47 |
+
"printWidth": 75,
|
| 48 |
+
"tabWidth": 2,
|
| 49 |
+
"useTabs": false,
|
| 50 |
+
"singleQuote": true,
|
| 51 |
+
"jsxSingleQuote": false,
|
| 52 |
+
"bracketSameLine": true,
|
| 53 |
+
"arrowParens": "avoid",
|
| 54 |
+
"endOfLine": "lf"
|
| 55 |
+
},
|
| 56 |
+
"devDependencies": {
|
| 57 |
+
"@types/end-of-stream": "^1.4.2",
|
| 58 |
+
"@types/node": "^25.2.3",
|
| 59 |
+
"end-of-stream": "^1.4.0",
|
| 60 |
+
"node-abort-controller": "^3.1.1",
|
| 61 |
+
"prettier": "^3.8.1",
|
| 62 |
+
"tap": "^21.6.1",
|
| 63 |
+
"through2": "^2.0.3",
|
| 64 |
+
"tshy": "^3.3.2",
|
| 65 |
+
"typedoc": "^0.28.17"
|
| 66 |
+
},
|
| 67 |
+
"repository": "https://github.com/isaacs/minipass",
|
| 68 |
+
"keywords": [
|
| 69 |
+
"passthrough",
|
| 70 |
+
"stream"
|
| 71 |
+
],
|
| 72 |
+
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
| 73 |
+
"license": "BlueOak-1.0.0",
|
| 74 |
+
"engines": {
|
| 75 |
+
"node": ">=16 || 14 >=14.17"
|
| 76 |
+
}
|
| 77 |
+
}
|
tools/ui/node_modules/minizlib/LICENSE
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Minizlib was created by Isaac Z. Schlueter.
|
| 2 |
+
It is a derivative work of the Node.js project.
|
| 3 |
+
|
| 4 |
+
"""
|
| 5 |
+
Copyright (c) 2017-2023 Isaac Z. Schlueter and Contributors
|
| 6 |
+
Copyright (c) 2017-2023 Node.js contributors. All rights reserved.
|
| 7 |
+
Copyright (c) 2017-2023 Joyent, Inc. and other Node contributors. All rights reserved.
|
| 8 |
+
|
| 9 |
+
Permission is hereby granted, free of charge, to any person obtaining a
|
| 10 |
+
copy of this software and associated documentation files (the "Software"),
|
| 11 |
+
to deal in the Software without restriction, including without limitation
|
| 12 |
+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
| 13 |
+
and/or sell copies of the Software, and to permit persons to whom the
|
| 14 |
+
Software is furnished to do so, subject to the following conditions:
|
| 15 |
+
|
| 16 |
+
The above copyright notice and this permission notice shall be included in
|
| 17 |
+
all copies or substantial portions of the Software.
|
| 18 |
+
|
| 19 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
| 20 |
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 21 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 22 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 23 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 24 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 25 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 26 |
+
"""
|
tools/ui/node_modules/minizlib/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# minizlib
|
| 2 |
+
|
| 3 |
+
A fast zlib stream built on [minipass](http://npm.im/minipass) and
|
| 4 |
+
Node.js's zlib binding.
|
| 5 |
+
|
| 6 |
+
This module was created to serve the needs of
|
| 7 |
+
[node-tar](http://npm.im/tar) and
|
| 8 |
+
[minipass-fetch](http://npm.im/minipass-fetch).
|
| 9 |
+
|
| 10 |
+
Brotli is supported in versions of node with a Brotli binding.
|
| 11 |
+
|
| 12 |
+
## How does this differ from the streams in `'node:zlib'`?
|
| 13 |
+
|
| 14 |
+
First, there are no convenience methods to compress or decompress a
|
| 15 |
+
buffer. If you want those, use the built-in `zlib` module. This is
|
| 16 |
+
only streams. That being said, Minipass streams to make it fairly easy to
|
| 17 |
+
use as one-liners: `new zlib.Deflate().end(data).read()` will return the
|
| 18 |
+
deflate compressed result.
|
| 19 |
+
|
| 20 |
+
This module compresses and decompresses the data as fast as you feed
|
| 21 |
+
it in. It is synchronous, and runs on the main process thread. Zlib
|
| 22 |
+
and Brotli operations can be high CPU, but they're very fast, and doing it
|
| 23 |
+
this way means much less bookkeeping and artificial deferral.
|
| 24 |
+
|
| 25 |
+
Node's built in zlib streams are built on top of `stream.Transform`.
|
| 26 |
+
They do the maximally safe thing with respect to consistent
|
| 27 |
+
asynchrony, buffering, and backpressure.
|
| 28 |
+
|
| 29 |
+
See [Minipass](http://npm.im/minipass) for more on the differences between
|
| 30 |
+
Node.js core streams and Minipass streams, and the convenience methods
|
| 31 |
+
provided by that class.
|
| 32 |
+
|
| 33 |
+
## Classes
|
| 34 |
+
|
| 35 |
+
- Deflate
|
| 36 |
+
- Inflate
|
| 37 |
+
- Gzip
|
| 38 |
+
- Gunzip
|
| 39 |
+
- DeflateRaw
|
| 40 |
+
- InflateRaw
|
| 41 |
+
- Unzip
|
| 42 |
+
- BrotliCompress (Node v10 and higher)
|
| 43 |
+
- BrotliDecompress (Node v10 and higher)
|
| 44 |
+
- ZstdCompress (Node v22.15 and higher)
|
| 45 |
+
- ZstdDecompress (Node v22.15 and higher)
|
| 46 |
+
|
| 47 |
+
## USAGE
|
| 48 |
+
|
| 49 |
+
```js
|
| 50 |
+
import { BrotliDecompress } from 'minizlib'
|
| 51 |
+
// or: const BrotliDecompress = require('minizlib')
|
| 52 |
+
|
| 53 |
+
const input = sourceOfCompressedData()
|
| 54 |
+
const decode = new BrotliDecompress()
|
| 55 |
+
const output = whereToWriteTheDecodedData()
|
| 56 |
+
input.pipe(decode).pipe(output)
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## REPRODUCIBLE BUILDS
|
| 60 |
+
|
| 61 |
+
To create reproducible gzip compressed files across different operating
|
| 62 |
+
systems, set `portable: true` in the options. This causes minizlib to set
|
| 63 |
+
the `OS` indicator in byte 9 of the extended gzip header to `0xFF` for
|
| 64 |
+
'unknown'.
|
tools/ui/node_modules/minizlib/dist/commonjs/constants.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export declare const constants: any;
|
| 2 |
+
//# sourceMappingURL=constants.d.ts.map
|
tools/ui/node_modules/minizlib/dist/commonjs/constants.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,SAAS,KAiHrB,CAAA"}
|
tools/ui/node_modules/minizlib/dist/commonjs/constants.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
| 3 |
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
| 4 |
+
};
|
| 5 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 6 |
+
exports.constants = void 0;
|
| 7 |
+
// Update with any zlib constants that are added or changed in the future.
|
| 8 |
+
// Node v6 didn't export this, so we just hard code the version and rely
|
| 9 |
+
// on all the other hard-coded values from zlib v4736. When node v6
|
| 10 |
+
// support drops, we can just export the realZlibConstants object.
|
| 11 |
+
const zlib_1 = __importDefault(require("zlib"));
|
| 12 |
+
/* c8 ignore start */
|
| 13 |
+
const realZlibConstants = zlib_1.default.constants || { ZLIB_VERNUM: 4736 };
|
| 14 |
+
/* c8 ignore stop */
|
| 15 |
+
exports.constants = Object.freeze(Object.assign(Object.create(null), {
|
| 16 |
+
Z_NO_FLUSH: 0,
|
| 17 |
+
Z_PARTIAL_FLUSH: 1,
|
| 18 |
+
Z_SYNC_FLUSH: 2,
|
| 19 |
+
Z_FULL_FLUSH: 3,
|
| 20 |
+
Z_FINISH: 4,
|
| 21 |
+
Z_BLOCK: 5,
|
| 22 |
+
Z_OK: 0,
|
| 23 |
+
Z_STREAM_END: 1,
|
| 24 |
+
Z_NEED_DICT: 2,
|
| 25 |
+
Z_ERRNO: -1,
|
| 26 |
+
Z_STREAM_ERROR: -2,
|
| 27 |
+
Z_DATA_ERROR: -3,
|
| 28 |
+
Z_MEM_ERROR: -4,
|
| 29 |
+
Z_BUF_ERROR: -5,
|
| 30 |
+
Z_VERSION_ERROR: -6,
|
| 31 |
+
Z_NO_COMPRESSION: 0,
|
| 32 |
+
Z_BEST_SPEED: 1,
|
| 33 |
+
Z_BEST_COMPRESSION: 9,
|
| 34 |
+
Z_DEFAULT_COMPRESSION: -1,
|
| 35 |
+
Z_FILTERED: 1,
|
| 36 |
+
Z_HUFFMAN_ONLY: 2,
|
| 37 |
+
Z_RLE: 3,
|
| 38 |
+
Z_FIXED: 4,
|
| 39 |
+
Z_DEFAULT_STRATEGY: 0,
|
| 40 |
+
DEFLATE: 1,
|
| 41 |
+
INFLATE: 2,
|
| 42 |
+
GZIP: 3,
|
| 43 |
+
GUNZIP: 4,
|
| 44 |
+
DEFLATERAW: 5,
|
| 45 |
+
INFLATERAW: 6,
|
| 46 |
+
UNZIP: 7,
|
| 47 |
+
BROTLI_DECODE: 8,
|
| 48 |
+
BROTLI_ENCODE: 9,
|
| 49 |
+
Z_MIN_WINDOWBITS: 8,
|
| 50 |
+
Z_MAX_WINDOWBITS: 15,
|
| 51 |
+
Z_DEFAULT_WINDOWBITS: 15,
|
| 52 |
+
Z_MIN_CHUNK: 64,
|
| 53 |
+
Z_MAX_CHUNK: Infinity,
|
| 54 |
+
Z_DEFAULT_CHUNK: 16384,
|
| 55 |
+
Z_MIN_MEMLEVEL: 1,
|
| 56 |
+
Z_MAX_MEMLEVEL: 9,
|
| 57 |
+
Z_DEFAULT_MEMLEVEL: 8,
|
| 58 |
+
Z_MIN_LEVEL: -1,
|
| 59 |
+
Z_MAX_LEVEL: 9,
|
| 60 |
+
Z_DEFAULT_LEVEL: -1,
|
| 61 |
+
BROTLI_OPERATION_PROCESS: 0,
|
| 62 |
+
BROTLI_OPERATION_FLUSH: 1,
|
| 63 |
+
BROTLI_OPERATION_FINISH: 2,
|
| 64 |
+
BROTLI_OPERATION_EMIT_METADATA: 3,
|
| 65 |
+
BROTLI_MODE_GENERIC: 0,
|
| 66 |
+
BROTLI_MODE_TEXT: 1,
|
| 67 |
+
BROTLI_MODE_FONT: 2,
|
| 68 |
+
BROTLI_DEFAULT_MODE: 0,
|
| 69 |
+
BROTLI_MIN_QUALITY: 0,
|
| 70 |
+
BROTLI_MAX_QUALITY: 11,
|
| 71 |
+
BROTLI_DEFAULT_QUALITY: 11,
|
| 72 |
+
BROTLI_MIN_WINDOW_BITS: 10,
|
| 73 |
+
BROTLI_MAX_WINDOW_BITS: 24,
|
| 74 |
+
BROTLI_LARGE_MAX_WINDOW_BITS: 30,
|
| 75 |
+
BROTLI_DEFAULT_WINDOW: 22,
|
| 76 |
+
BROTLI_MIN_INPUT_BLOCK_BITS: 16,
|
| 77 |
+
BROTLI_MAX_INPUT_BLOCK_BITS: 24,
|
| 78 |
+
BROTLI_PARAM_MODE: 0,
|
| 79 |
+
BROTLI_PARAM_QUALITY: 1,
|
| 80 |
+
BROTLI_PARAM_LGWIN: 2,
|
| 81 |
+
BROTLI_PARAM_LGBLOCK: 3,
|
| 82 |
+
BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
|
| 83 |
+
BROTLI_PARAM_SIZE_HINT: 5,
|
| 84 |
+
BROTLI_PARAM_LARGE_WINDOW: 6,
|
| 85 |
+
BROTLI_PARAM_NPOSTFIX: 7,
|
| 86 |
+
BROTLI_PARAM_NDIRECT: 8,
|
| 87 |
+
BROTLI_DECODER_RESULT_ERROR: 0,
|
| 88 |
+
BROTLI_DECODER_RESULT_SUCCESS: 1,
|
| 89 |
+
BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
|
| 90 |
+
BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
|
| 91 |
+
BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
|
| 92 |
+
BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
|
| 93 |
+
BROTLI_DECODER_NO_ERROR: 0,
|
| 94 |
+
BROTLI_DECODER_SUCCESS: 1,
|
| 95 |
+
BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
|
| 96 |
+
BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
|
| 97 |
+
BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
|
| 98 |
+
BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
|
| 99 |
+
BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
|
| 100 |
+
BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
|
| 101 |
+
BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
|
| 102 |
+
BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
|
| 103 |
+
BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
|
| 104 |
+
BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
|
| 105 |
+
BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
|
| 106 |
+
BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
|
| 107 |
+
BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
|
| 108 |
+
BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
|
| 109 |
+
BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
|
| 110 |
+
BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
|
| 111 |
+
BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
|
| 112 |
+
BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
|
| 113 |
+
BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
|
| 114 |
+
BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
|
| 115 |
+
BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
|
| 116 |
+
BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
|
| 117 |
+
BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
|
| 118 |
+
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
|
| 119 |
+
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
|
| 120 |
+
BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
|
| 121 |
+
BROTLI_DECODER_ERROR_UNREACHABLE: -31,
|
| 122 |
+
}, realZlibConstants));
|
| 123 |
+
//# sourceMappingURL=constants.js.map
|
tools/ui/node_modules/minizlib/dist/commonjs/constants.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;;;;AAAA,0EAA0E;AAC1E,wEAAwE;AACxE,oEAAoE;AACpE,kEAAkE;AAClE,gDAA2B;AAC3B,qBAAqB;AACrB,MAAM,iBAAiB,GAAG,cAAQ,CAAC,SAAS,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAA;AACrE,oBAAoB;AAEP,QAAA,SAAS,GAAG,MAAM,CAAC,MAAM,CACpC,MAAM,CAAC,MAAM,CACX,MAAM,CA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AAqC,EAAE,CAAC,EAAE;IAC1C,sCAAsC,EAAE,CAAC,EAAE;IAC3C,uCAAuC,EAAE,CAAC,EAAE;IAC5C,qCAAqC,EAAE,CAAC,EAAE;IAC1C,qCAAqC,EAAE,CAAC,EAAE;IAC1C,oCAAoC,EAAE,CAAC,EAAE;IACzC,uCAAuC,EAAE,CAAC,EAAE;IAC5C,sCAAsC,EAAE,CAAC,EAAE;IAC3C,wCAAwC,EAAE,CAAC,EAAE;IAC7C,sCAAsC,EAAE,CAAC,EAAE;IAC3C,sCAAsC,EAAE,CAAC,EAAE;IAC3C,wCAAwC,EAAE,CAAC,EAAE;IAC7C,wCAAwC,EAAE,CAAC,EAAE;IAC7C,2CAA2C,EAAE,CAAC,EAAE;IAChD,gCAAgC,EAAE,CAAC,EAAE;CACtC,EACD,iBAAiB,CAClB,CACF,CAAA","sourcesContent":["// Update with any zlib constants that are added or changed in the future.\n// Node v6 didn't export this, so we just hard code the version and rely\n// on all the other hard-coded values from zlib v4736. When node v6\n// support drops, we can just export the realZlibConstants object.\nimport realZlib from 'zlib'\n/* c8 ignore start */\nconst realZlibConstants = realZlib.constants || { ZLIB_VERNUM: 4736 }\n/* c8 ignore stop */\n\nexport const constants = Object.freeze(\n Object.assign(\n Object.create(null),\n {\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n Z_VERSION_ERROR: -6,\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n DEFLATE: 1,\n INFLATE: 2,\n GZIP: 3,\n GUNZIP: 4,\n DEFLATERAW: 5,\n INFLATERAW: 6,\n UNZIP: 7,\n BROTLI_DECODE: 8,\n BROTLI_ENCODE: 9,\n Z_MIN_WINDOWBITS: 8,\n Z_MAX_WINDOWBITS: 15,\n Z_DEFAULT_WINDOWBITS: 15,\n Z_MIN_CHUNK: 64,\n Z_MAX_CHUNK: Infinity,\n Z_DEFAULT_CHUNK: 16384,\n Z_MIN_MEMLEVEL: 1,\n Z_MAX_MEMLEVEL: 9,\n Z_DEFAULT_MEMLEVEL: 8,\n Z_MIN_LEVEL: -1,\n Z_MAX_LEVEL: 9,\n Z_DEFAULT_LEVEL: -1,\n BROTLI_OPERATION_PROCESS: 0,\n BROTLI_OPERATION_FLUSH: 1,\n BROTLI_OPERATION_FINISH: 2,\n BROTLI_OPERATION_EMIT_METADATA: 3,\n BROTLI_MODE_GENERIC: 0,\n BROTLI_MODE_TEXT: 1,\n BROTLI_MODE_FONT: 2,\n BROTLI_DEFAULT_MODE: 0,\n BROTLI_MIN_QUALITY: 0,\n BROTLI_MAX_QUALITY: 11,\n BROTLI_DEFAULT_QUALITY: 11,\n BROTLI_MIN_WINDOW_BITS: 10,\n BROTLI_MAX_WINDOW_BITS: 24,\n BROTLI_LARGE_MAX_WINDOW_BITS: 30,\n BROTLI_DEFAULT_WINDOW: 22,\n BROTLI_MIN_INPUT_BLOCK_BITS: 16,\n BROTLI_MAX_INPUT_BLOCK_BITS: 24,\n BROTLI_PARAM_MODE: 0,\n BROTLI_PARAM_QUALITY: 1,\n BROTLI_PARAM_LGWIN: 2,\n BROTLI_PARAM_LGBLOCK: 3,\n BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,\n BROTLI_PARAM_SIZE_HINT: 5,\n BROTLI_PARAM_LARGE_WINDOW: 6,\n BROTLI_PARAM_NPOSTFIX: 7,\n BROTLI_PARAM_NDIRECT: 8,\n BROTLI_DECODER_RESULT_ERROR: 0,\n BROTLI_DECODER_RESULT_SUCCESS: 1,\n BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,\n BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,\n BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,\n BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,\n BROTLI_DECODER_NO_ERROR: 0,\n BROTLI_DECODER_SUCCESS: 1,\n BROTLI_DECODER_NEEDS_MORE_INPUT: 2,\n BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,\n BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,\n BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,\n BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,\n BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,\n BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,\n BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,\n BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,\n BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,\n BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,\n BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,\n BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,\n BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,\n BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,\n BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,\n BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,\n BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,\n BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,\n BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,\n BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,\n BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,\n BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,\n BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,\n BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,\n BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,\n BROTLI_DECODER_ERROR_UNREACHABLE: -31,\n },\n realZlibConstants,\n ),\n)\n"]}
|
tools/ui/node_modules/minizlib/dist/commonjs/index.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Buffer } from 'buffer';
|
| 2 |
+
import { Minipass } from 'minipass';
|
| 3 |
+
import * as realZlib from 'zlib';
|
| 4 |
+
export { constants } from './constants.js';
|
| 5 |
+
declare const _superWrite: unique symbol;
|
| 6 |
+
export declare class ZlibError extends Error {
|
| 7 |
+
code?: string;
|
| 8 |
+
errno?: number;
|
| 9 |
+
constructor(err: NodeJS.ErrnoException | Error, origin?: Function);
|
| 10 |
+
get name(): string;
|
| 11 |
+
}
|
| 12 |
+
declare const _flushFlag: unique symbol;
|
| 13 |
+
export type ChunkWithFlushFlag = Minipass.ContiguousData & {
|
| 14 |
+
[_flushFlag]?: number;
|
| 15 |
+
};
|
| 16 |
+
export type ZlibBaseOptions = Minipass.Options<Minipass.ContiguousData> & {
|
| 17 |
+
flush?: number;
|
| 18 |
+
finishFlush?: number;
|
| 19 |
+
fullFlushFlag?: number;
|
| 20 |
+
};
|
| 21 |
+
export type ZlibHandle = realZlib.Gzip | realZlib.Gunzip | realZlib.Deflate | realZlib.Inflate | realZlib.DeflateRaw | realZlib.InflateRaw | realZlib.BrotliCompress | realZlib.BrotliDecompress | realZlib.ZstdCompress | realZlib.ZstdDecompress;
|
| 22 |
+
export type ZlibMode = 'Gzip' | 'Gunzip' | 'Deflate' | 'Inflate' | 'DeflateRaw' | 'InflateRaw' | 'Unzip';
|
| 23 |
+
export type BrotliMode = 'BrotliCompress' | 'BrotliDecompress';
|
| 24 |
+
export type ZstdMode = 'ZstdCompress' | 'ZstdDecompress';
|
| 25 |
+
declare abstract class ZlibBase extends Minipass<Buffer, ChunkWithFlushFlag> {
|
| 26 |
+
#private;
|
| 27 |
+
get sawError(): boolean;
|
| 28 |
+
get handle(): ZlibHandle | undefined;
|
| 29 |
+
get flushFlag(): number;
|
| 30 |
+
constructor(opts: ZlibBaseOptions, mode: ZlibMode | BrotliMode | ZstdMode);
|
| 31 |
+
close(): void;
|
| 32 |
+
reset(): any;
|
| 33 |
+
flush(flushFlag?: number): void;
|
| 34 |
+
end(cb?: () => void): this;
|
| 35 |
+
end(chunk: ChunkWithFlushFlag, cb?: () => void): this;
|
| 36 |
+
end(chunk: ChunkWithFlushFlag, encoding?: Minipass.Encoding, cb?: () => void): this;
|
| 37 |
+
get ended(): boolean;
|
| 38 |
+
[_superWrite](data: Buffer & {
|
| 39 |
+
[_flushFlag]?: number;
|
| 40 |
+
}): boolean;
|
| 41 |
+
write(chunk: ChunkWithFlushFlag, cb?: () => void): boolean;
|
| 42 |
+
write(chunk: ChunkWithFlushFlag, encoding?: Minipass.Encoding, cb?: () => void): boolean;
|
| 43 |
+
}
|
| 44 |
+
export type ZlibOptions = ZlibBaseOptions & {
|
| 45 |
+
level?: number;
|
| 46 |
+
strategy?: number;
|
| 47 |
+
};
|
| 48 |
+
export declare class Zlib extends ZlibBase {
|
| 49 |
+
#private;
|
| 50 |
+
constructor(opts: ZlibOptions, mode: ZlibMode);
|
| 51 |
+
params(level: number, strategy: number): void;
|
| 52 |
+
}
|
| 53 |
+
export declare class Deflate extends Zlib {
|
| 54 |
+
constructor(opts: ZlibOptions);
|
| 55 |
+
}
|
| 56 |
+
export declare class Inflate extends Zlib {
|
| 57 |
+
constructor(opts: ZlibOptions);
|
| 58 |
+
}
|
| 59 |
+
export type GzipOptions = ZlibOptions & {
|
| 60 |
+
portable?: boolean;
|
| 61 |
+
};
|
| 62 |
+
export declare class Gzip extends Zlib {
|
| 63 |
+
#private;
|
| 64 |
+
constructor(opts: GzipOptions);
|
| 65 |
+
[_superWrite](data: Buffer & {
|
| 66 |
+
[_flushFlag]?: number;
|
| 67 |
+
}): boolean;
|
| 68 |
+
}
|
| 69 |
+
export declare class Gunzip extends Zlib {
|
| 70 |
+
constructor(opts: ZlibOptions);
|
| 71 |
+
}
|
| 72 |
+
export declare class DeflateRaw extends Zlib {
|
| 73 |
+
constructor(opts: ZlibOptions);
|
| 74 |
+
}
|
| 75 |
+
export declare class InflateRaw extends Zlib {
|
| 76 |
+
constructor(opts: ZlibOptions);
|
| 77 |
+
}
|
| 78 |
+
export declare class Unzip extends Zlib {
|
| 79 |
+
constructor(opts: ZlibOptions);
|
| 80 |
+
}
|
| 81 |
+
declare class Brotli extends ZlibBase {
|
| 82 |
+
constructor(opts: ZlibOptions, mode: BrotliMode);
|
| 83 |
+
}
|
| 84 |
+
export declare class BrotliCompress extends Brotli {
|
| 85 |
+
constructor(opts: ZlibOptions);
|
| 86 |
+
}
|
| 87 |
+
export declare class BrotliDecompress extends Brotli {
|
| 88 |
+
constructor(opts: ZlibOptions);
|
| 89 |
+
}
|
| 90 |
+
declare class Zstd extends ZlibBase {
|
| 91 |
+
constructor(opts: ZlibOptions, mode: ZstdMode);
|
| 92 |
+
}
|
| 93 |
+
export declare class ZstdCompress extends Zstd {
|
| 94 |
+
constructor(opts: ZlibOptions);
|
| 95 |
+
}
|
| 96 |
+
export declare class ZstdDecompress extends Zstd {
|
| 97 |
+
constructor(opts: ZlibOptions);
|
| 98 |
+
}
|
| 99 |
+
//# sourceMappingURL=index.d.ts.map
|
tools/ui/node_modules/minizlib/dist/commonjs/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 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,EAAE,MAAM,CAAC,EAAE,QAAQ;IAWjE,IAAI,IAAI,WAEP;CACF;AAMD,QAAA,MAAM,UAAU,eAAsB,CAAA;AAEtC,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,cAAc,GAAG;IACz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use strict";
|
| 2 |
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
| 3 |
+
if (k2 === undefined) k2 = k;
|
| 4 |
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
| 5 |
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
| 6 |
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
| 7 |
+
}
|
| 8 |
+
Object.defineProperty(o, k2, desc);
|
| 9 |
+
}) : (function(o, m, k, k2) {
|
| 10 |
+
if (k2 === undefined) k2 = k;
|
| 11 |
+
o[k2] = m[k];
|
| 12 |
+
}));
|
| 13 |
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
| 14 |
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
| 15 |
+
}) : function(o, v) {
|
| 16 |
+
o["default"] = v;
|
| 17 |
+
});
|
| 18 |
+
var __importStar = (this && this.__importStar) || (function () {
|
| 19 |
+
var ownKeys = function(o) {
|
| 20 |
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
| 21 |
+
var ar = [];
|
| 22 |
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
| 23 |
+
return ar;
|
| 24 |
+
};
|
| 25 |
+
return ownKeys(o);
|
| 26 |
+
};
|
| 27 |
+
return function (mod) {
|
| 28 |
+
if (mod && mod.__esModule) return mod;
|
| 29 |
+
var result = {};
|
| 30 |
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
| 31 |
+
__setModuleDefault(result, mod);
|
| 32 |
+
return result;
|
| 33 |
+
};
|
| 34 |
+
})();
|
| 35 |
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
| 36 |
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
| 37 |
+
};
|
| 38 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 39 |
+
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;
|
| 40 |
+
const assert_1 = __importDefault(require("assert"));
|
| 41 |
+
const buffer_1 = require("buffer");
|
| 42 |
+
const minipass_1 = require("minipass");
|
| 43 |
+
const realZlib = __importStar(require("zlib"));
|
| 44 |
+
const constants_js_1 = require("./constants.js");
|
| 45 |
+
var constants_js_2 = require("./constants.js");
|
| 46 |
+
Object.defineProperty(exports, "constants", { enumerable: true, get: function () { return constants_js_2.constants; } });
|
| 47 |
+
const OriginalBufferConcat = buffer_1.Buffer.concat;
|
| 48 |
+
const desc = Object.getOwnPropertyDescriptor(buffer_1.Buffer, 'concat');
|
| 49 |
+
const noop = (args) => args;
|
| 50 |
+
const passthroughBufferConcat = desc?.writable === true || desc?.set !== undefined
|
| 51 |
+
? (makeNoOp) => {
|
| 52 |
+
buffer_1.Buffer.concat = makeNoOp ? noop : OriginalBufferConcat;
|
| 53 |
+
}
|
| 54 |
+
: (_) => { };
|
| 55 |
+
const _superWrite = Symbol('_superWrite');
|
| 56 |
+
class ZlibError extends Error {
|
| 57 |
+
code;
|
| 58 |
+
errno;
|
| 59 |
+
constructor(err, origin) {
|
| 60 |
+
super('zlib: ' + err.message, { cause: err });
|
| 61 |
+
this.code = err.code;
|
| 62 |
+
this.errno = err.errno;
|
| 63 |
+
/* c8 ignore next */
|
| 64 |
+
if (!this.code)
|
| 65 |
+
this.code = 'ZLIB_ERROR';
|
| 66 |
+
this.message = 'zlib: ' + err.message;
|
| 67 |
+
Error.captureStackTrace(this, origin ?? this.constructor);
|
| 68 |
+
}
|
| 69 |
+
get name() {
|
| 70 |
+
return 'ZlibError';
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
exports.ZlibError = ZlibError;
|
| 74 |
+
// the Zlib class they all inherit from
|
| 75 |
+
// This thing manages the queue of requests, and returns
|
| 76 |
+
// true or false if there is anything in the queue when
|
| 77 |
+
// you call the .write() method.
|
| 78 |
+
const _flushFlag = Symbol('flushFlag');
|
| 79 |
+
class ZlibBase extends minipass_1.Minipass {
|
| 80 |
+
#sawError = false;
|
| 81 |
+
#ended = false;
|
| 82 |
+
#flushFlag;
|
| 83 |
+
#finishFlushFlag;
|
| 84 |
+
#fullFlushFlag;
|
| 85 |
+
#handle;
|
| 86 |
+
#onError;
|
| 87 |
+
get sawError() {
|
| 88 |
+
return this.#sawError;
|
| 89 |
+
}
|
| 90 |
+
get handle() {
|
| 91 |
+
return this.#handle;
|
| 92 |
+
}
|
| 93 |
+
/* c8 ignore start */
|
| 94 |
+
get flushFlag() {
|
| 95 |
+
return this.#flushFlag;
|
| 96 |
+
}
|
| 97 |
+
/* c8 ignore stop */
|
| 98 |
+
constructor(opts, mode) {
|
| 99 |
+
if (!opts || typeof opts !== 'object')
|
| 100 |
+
throw new TypeError('invalid options for ZlibBase constructor');
|
| 101 |
+
//@ts-ignore
|
| 102 |
+
super(opts);
|
| 103 |
+
/* c8 ignore start */
|
| 104 |
+
this.#flushFlag = opts.flush ?? 0;
|
| 105 |
+
this.#finishFlushFlag = opts.finishFlush ?? 0;
|
| 106 |
+
this.#fullFlushFlag = opts.fullFlushFlag ?? 0;
|
| 107 |
+
/* c8 ignore stop */
|
| 108 |
+
//@ts-ignore
|
| 109 |
+
if (typeof realZlib[mode] !== 'function') {
|
| 110 |
+
throw new TypeError('Compression method not supported: ' + mode);
|
| 111 |
+
}
|
| 112 |
+
// this will throw if any options are invalid for the class selected
|
| 113 |
+
try {
|
| 114 |
+
// @types/node doesn't know that it exports the classes, but they're there
|
| 115 |
+
//@ts-ignore
|
| 116 |
+
this.#handle = new realZlib[mode](opts);
|
| 117 |
+
}
|
| 118 |
+
catch (er) {
|
| 119 |
+
// make sure that all errors get decorated properly
|
| 120 |
+
throw new ZlibError(er, this.constructor);
|
| 121 |
+
}
|
| 122 |
+
this.#onError = err => {
|
| 123 |
+
// no sense raising multiple errors, since we abort on the first one.
|
| 124 |
+
if (this.#sawError)
|
| 125 |
+
return;
|
| 126 |
+
this.#sawError = true;
|
| 127 |
+
// there is no way to cleanly recover.
|
| 128 |
+
// continuing only obscures problems.
|
| 129 |
+
this.close();
|
| 130 |
+
this.emit('error', err);
|
| 131 |
+
};
|
| 132 |
+
this.#handle?.on('error', er => this.#onError(new ZlibError(er)));
|
| 133 |
+
this.once('end', () => this.close);
|
| 134 |
+
}
|
| 135 |
+
close() {
|
| 136 |
+
if (this.#handle) {
|
| 137 |
+
this.#handle.close();
|
| 138 |
+
this.#handle = undefined;
|
| 139 |
+
this.emit('close');
|
| 140 |
+
}
|
| 141 |
+
}
|
| 142 |
+
reset() {
|
| 143 |
+
if (!this.#sawError) {
|
| 144 |
+
(0, assert_1.default)(this.#handle, 'zlib binding closed');
|
| 145 |
+
//@ts-ignore
|
| 146 |
+
return this.#handle.reset?.();
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
flush(flushFlag) {
|
| 150 |
+
if (this.ended)
|
| 151 |
+
return;
|
| 152 |
+
if (typeof flushFlag !== 'number')
|
| 153 |
+
flushFlag = this.#fullFlushFlag;
|
| 154 |
+
this.write(Object.assign(buffer_1.Buffer.alloc(0), { [_flushFlag]: flushFlag }));
|
| 155 |
+
}
|
| 156 |
+
end(chunk, encoding, cb) {
|
| 157 |
+
/* c8 ignore start */
|
| 158 |
+
if (typeof chunk === 'function') {
|
| 159 |
+
cb = chunk;
|
| 160 |
+
encoding = undefined;
|
| 161 |
+
chunk = undefined;
|
| 162 |
+
}
|
| 163 |
+
if (typeof encoding === 'function') {
|
| 164 |
+
cb = encoding;
|
| 165 |
+
encoding = undefined;
|
| 166 |
+
}
|
| 167 |
+
/* c8 ignore stop */
|
| 168 |
+
if (chunk) {
|
| 169 |
+
if (encoding)
|
| 170 |
+
this.write(chunk, encoding);
|
| 171 |
+
else
|
| 172 |
+
this.write(chunk);
|
| 173 |
+
}
|
| 174 |
+
this.flush(this.#finishFlushFlag);
|
| 175 |
+
this.#ended = true;
|
| 176 |
+
return super.end(cb);
|
| 177 |
+
}
|
| 178 |
+
get ended() {
|
| 179 |
+
return this.#ended;
|
| 180 |
+
}
|
| 181 |
+
// overridden in the gzip classes to do portable writes
|
| 182 |
+
[_superWrite](data) {
|
| 183 |
+
return super.write(data);
|
| 184 |
+
}
|
| 185 |
+
write(chunk, encoding, cb) {
|
| 186 |
+
// process the chunk using the sync process
|
| 187 |
+
// then super.write() all the outputted chunks
|
| 188 |
+
if (typeof encoding === 'function')
|
| 189 |
+
(cb = encoding), (encoding = 'utf8');
|
| 190 |
+
if (typeof chunk === 'string')
|
| 191 |
+
chunk = buffer_1.Buffer.from(chunk, encoding);
|
| 192 |
+
if (this.#sawError)
|
| 193 |
+
return;
|
| 194 |
+
(0, assert_1.default)(this.#handle, 'zlib binding closed');
|
| 195 |
+
// _processChunk tries to .close() the native handle after it's done, so we
|
| 196 |
+
// intercept that by temporarily making it a no-op.
|
| 197 |
+
// diving into the node:zlib internals a bit here
|
| 198 |
+
const nativeHandle = this.#handle
|
| 199 |
+
._handle;
|
| 200 |
+
const originalNativeClose = nativeHandle.close;
|
| 201 |
+
nativeHandle.close = () => { };
|
| 202 |
+
const originalClose = this.#handle.close;
|
| 203 |
+
this.#handle.close = () => { };
|
| 204 |
+
// It also calls `Buffer.concat()` at the end, which may be convenient
|
| 205 |
+
// for some, but which we are not interested in as it slows us down.
|
| 206 |
+
passthroughBufferConcat(true);
|
| 207 |
+
let result = undefined;
|
| 208 |
+
try {
|
| 209 |
+
const flushFlag = typeof chunk[_flushFlag] === 'number'
|
| 210 |
+
? chunk[_flushFlag]
|
| 211 |
+
: this.#flushFlag;
|
| 212 |
+
result = this.#handle._processChunk(chunk, flushFlag);
|
| 213 |
+
// if we don't throw, reset it back how it was
|
| 214 |
+
passthroughBufferConcat(false);
|
| 215 |
+
}
|
| 216 |
+
catch (err) {
|
| 217 |
+
// or if we do, put Buffer.concat() back before we emit error
|
| 218 |
+
// Error events call into user code, which may call Buffer.concat()
|
| 219 |
+
passthroughBufferConcat(false);
|
| 220 |
+
this.#onError(new ZlibError(err, this.write));
|
| 221 |
+
}
|
| 222 |
+
finally {
|
| 223 |
+
if (this.#handle) {
|
| 224 |
+
// Core zlib resets `_handle` to null after attempting to close the
|
| 225 |
+
// native handle. Our no-op handler prevented actual closure, but we
|
| 226 |
+
// need to restore the `._handle` property.
|
| 227 |
+
;
|
| 228 |
+
this.#handle._handle =
|
| 229 |
+
nativeHandle;
|
| 230 |
+
nativeHandle.close = originalNativeClose;
|
| 231 |
+
this.#handle.close = originalClose;
|
| 232 |
+
// `_processChunk()` adds an 'error' listener. If we don't remove it
|
| 233 |
+
// after each call, these handlers start piling up.
|
| 234 |
+
this.#handle.removeAllListeners('error');
|
| 235 |
+
// make sure OUR error listener is still attached tho
|
| 236 |
+
}
|
| 237 |
+
}
|
| 238 |
+
if (this.#handle)
|
| 239 |
+
this.#handle.on('error', er => this.#onError(new ZlibError(er, this.write)));
|
| 240 |
+
let writeReturn;
|
| 241 |
+
if (result) {
|
| 242 |
+
if (Array.isArray(result) && result.length > 0) {
|
| 243 |
+
const r = result[0];
|
| 244 |
+
// The first buffer is always `handle._outBuffer`, which would be
|
| 245 |
+
// re-used for later invocations; so, we always have to copy that one.
|
| 246 |
+
writeReturn = this[_superWrite](buffer_1.Buffer.from(r));
|
| 247 |
+
for (let i = 1; i < result.length; i++) {
|
| 248 |
+
writeReturn = this[_superWrite](result[i]);
|
| 249 |
+
}
|
| 250 |
+
}
|
| 251 |
+
else {
|
| 252 |
+
// either a single Buffer or an empty array
|
| 253 |
+
writeReturn = this[_superWrite](buffer_1.Buffer.from(result));
|
| 254 |
+
}
|
| 255 |
+
}
|
| 256 |
+
if (cb)
|
| 257 |
+
cb();
|
| 258 |
+
return writeReturn;
|
| 259 |
+
}
|
| 260 |
+
}
|
| 261 |
+
class Zlib extends ZlibBase {
|
| 262 |
+
#level;
|
| 263 |
+
#strategy;
|
| 264 |
+
constructor(opts, mode) {
|
| 265 |
+
opts = opts || {};
|
| 266 |
+
opts.flush = opts.flush || constants_js_1.constants.Z_NO_FLUSH;
|
| 267 |
+
opts.finishFlush = opts.finishFlush || constants_js_1.constants.Z_FINISH;
|
| 268 |
+
opts.fullFlushFlag = constants_js_1.constants.Z_FULL_FLUSH;
|
| 269 |
+
super(opts, mode);
|
| 270 |
+
this.#level = opts.level;
|
| 271 |
+
this.#strategy = opts.strategy;
|
| 272 |
+
}
|
| 273 |
+
params(level, strategy) {
|
| 274 |
+
if (this.sawError)
|
| 275 |
+
return;
|
| 276 |
+
if (!this.handle)
|
| 277 |
+
throw new Error('cannot switch params when binding is closed');
|
| 278 |
+
// no way to test this without also not supporting params at all
|
| 279 |
+
/* c8 ignore start */
|
| 280 |
+
if (!this.handle.params)
|
| 281 |
+
throw new Error('not supported in this implementation');
|
| 282 |
+
/* c8 ignore stop */
|
| 283 |
+
if (this.#level !== level || this.#strategy !== strategy) {
|
| 284 |
+
this.flush(constants_js_1.constants.Z_SYNC_FLUSH);
|
| 285 |
+
(0, assert_1.default)(this.handle, 'zlib binding closed');
|
| 286 |
+
// .params() calls .flush(), but the latter is always async in the
|
| 287 |
+
// core zlib. We override .flush() temporarily to intercept that and
|
| 288 |
+
// flush synchronously.
|
| 289 |
+
const origFlush = this.handle.flush;
|
| 290 |
+
this.handle.flush = (flushFlag, cb) => {
|
| 291 |
+
/* c8 ignore start */
|
| 292 |
+
if (typeof flushFlag === 'function') {
|
| 293 |
+
cb = flushFlag;
|
| 294 |
+
flushFlag = this.flushFlag;
|
| 295 |
+
}
|
| 296 |
+
/* c8 ignore stop */
|
| 297 |
+
this.flush(flushFlag);
|
| 298 |
+
cb?.();
|
| 299 |
+
};
|
| 300 |
+
try {
|
| 301 |
+
;
|
| 302 |
+
this.handle.params(level, strategy);
|
| 303 |
+
}
|
| 304 |
+
finally {
|
| 305 |
+
this.handle.flush = origFlush;
|
| 306 |
+
}
|
| 307 |
+
/* c8 ignore start */
|
| 308 |
+
if (this.handle) {
|
| 309 |
+
this.#level = level;
|
| 310 |
+
this.#strategy = strategy;
|
| 311 |
+
}
|
| 312 |
+
/* c8 ignore stop */
|
| 313 |
+
}
|
| 314 |
+
}
|
| 315 |
+
}
|
| 316 |
+
exports.Zlib = Zlib;
|
| 317 |
+
// minimal 2-byte header
|
| 318 |
+
class Deflate extends Zlib {
|
| 319 |
+
constructor(opts) {
|
| 320 |
+
super(opts, 'Deflate');
|
| 321 |
+
}
|
| 322 |
+
}
|
| 323 |
+
exports.Deflate = Deflate;
|
| 324 |
+
class Inflate extends Zlib {
|
| 325 |
+
constructor(opts) {
|
| 326 |
+
super(opts, 'Inflate');
|
| 327 |
+
}
|
| 328 |
+
}
|
| 329 |
+
exports.Inflate = Inflate;
|
| 330 |
+
class Gzip extends Zlib {
|
| 331 |
+
#portable;
|
| 332 |
+
constructor(opts) {
|
| 333 |
+
super(opts, 'Gzip');
|
| 334 |
+
this.#portable = opts && !!opts.portable;
|
| 335 |
+
}
|
| 336 |
+
[_superWrite](data) {
|
| 337 |
+
if (!this.#portable)
|
| 338 |
+
return super[_superWrite](data);
|
| 339 |
+
// we'll always get the header emitted in one first chunk
|
| 340 |
+
// overwrite the OS indicator byte with 0xFF
|
| 341 |
+
this.#portable = false;
|
| 342 |
+
data[9] = 255;
|
| 343 |
+
return super[_superWrite](data);
|
| 344 |
+
}
|
| 345 |
+
}
|
| 346 |
+
exports.Gzip = Gzip;
|
| 347 |
+
class Gunzip extends Zlib {
|
| 348 |
+
constructor(opts) {
|
| 349 |
+
super(opts, 'Gunzip');
|
| 350 |
+
}
|
| 351 |
+
}
|
| 352 |
+
exports.Gunzip = Gunzip;
|
| 353 |
+
// raw - no header
|
| 354 |
+
class DeflateRaw extends Zlib {
|
| 355 |
+
constructor(opts) {
|
| 356 |
+
super(opts, 'DeflateRaw');
|
| 357 |
+
}
|
| 358 |
+
}
|
| 359 |
+
exports.DeflateRaw = DeflateRaw;
|
| 360 |
+
class InflateRaw extends Zlib {
|
| 361 |
+
constructor(opts) {
|
| 362 |
+
super(opts, 'InflateRaw');
|
| 363 |
+
}
|
| 364 |
+
}
|
| 365 |
+
exports.InflateRaw = InflateRaw;
|
| 366 |
+
// auto-detect header.
|
| 367 |
+
class Unzip extends Zlib {
|
| 368 |
+
constructor(opts) {
|
| 369 |
+
super(opts, 'Unzip');
|
| 370 |
+
}
|
| 371 |
+
}
|
| 372 |
+
exports.Unzip = Unzip;
|
| 373 |
+
class Brotli extends ZlibBase {
|
| 374 |
+
constructor(opts, mode) {
|
| 375 |
+
opts = opts || {};
|
| 376 |
+
opts.flush = opts.flush || constants_js_1.constants.BROTLI_OPERATION_PROCESS;
|
| 377 |
+
opts.finishFlush =
|
| 378 |
+
opts.finishFlush || constants_js_1.constants.BROTLI_OPERATION_FINISH;
|
| 379 |
+
opts.fullFlushFlag = constants_js_1.constants.BROTLI_OPERATION_FLUSH;
|
| 380 |
+
super(opts, mode);
|
| 381 |
+
}
|
| 382 |
+
}
|
| 383 |
+
class BrotliCompress extends Brotli {
|
| 384 |
+
constructor(opts) {
|
| 385 |
+
super(opts, 'BrotliCompress');
|
| 386 |
+
}
|
| 387 |
+
}
|
| 388 |
+
exports.BrotliCompress = BrotliCompress;
|
| 389 |
+
class BrotliDecompress extends Brotli {
|
| 390 |
+
constructor(opts) {
|
| 391 |
+
super(opts, 'BrotliDecompress');
|
| 392 |
+
}
|
| 393 |
+
}
|
| 394 |
+
exports.BrotliDecompress = BrotliDecompress;
|
| 395 |
+
class Zstd extends ZlibBase {
|
| 396 |
+
constructor(opts, mode) {
|
| 397 |
+
opts = opts || {};
|
| 398 |
+
opts.flush = opts.flush || constants_js_1.constants.ZSTD_e_continue;
|
| 399 |
+
opts.finishFlush = opts.finishFlush || constants_js_1.constants.ZSTD_e_end;
|
| 400 |
+
opts.fullFlushFlag = constants_js_1.constants.ZSTD_e_flush;
|
| 401 |
+
super(opts, mode);
|
| 402 |
+
}
|
| 403 |
+
}
|
| 404 |
+
class ZstdCompress extends Zstd {
|
| 405 |
+
constructor(opts) {
|
| 406 |
+
super(opts, 'ZstdCompress');
|
| 407 |
+
}
|
| 408 |
+
}
|
| 409 |
+
exports.ZstdCompress = ZstdCompress;
|
| 410 |
+
class ZstdDecompress extends Zstd {
|
| 411 |
+
constructor(opts) {
|
| 412 |
+
super(opts, 'ZstdDecompress');
|
| 413 |
+
}
|
| 414 |
+
}
|
| 415 |
+
exports.ZstdDecompress = ZstdDecompress;
|
| 416 |
+
//# sourceMappingURL=index.js.map
|
tools/ui/node_modules/minizlib/dist/commonjs/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA2B;AAC3B,mCAA+B;AAC/B,uCAAmC;AACnC,+CAAgC;AAChC,iDAA0C;AAC1C,+CAA0C;AAAjC,yGAAA,SAAS,OAAA;AAElB,MAAM,oBAAoB,GAAG,eAAM,CAAC,MAAM,CAAA;AAC1C,MAAM,IAAI,GAAG,MAAM,CAAC,wBAAwB,CAAC,eAAM,EAAE,QAAQ,CAAC,CAAA;AAC9D,MAAM,IAAI,GAAG,CAAC,IAAc,EAAE,EAAE,CAAC,IAAyB,CAAA;AAC1D,MAAM,uBAAuB,GAC3B,IAAI,EAAE,QAAQ,KAAK,IAAI,IAAI,IAAI,EAAE,GAAG,KAAK,SAAS;IAChD,CAAC,CAAC,CAAC,QAAiB,EAAE,EAAE;QACpB,eAAM,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAoB,CAAA;IACxD,CAAC;IACH,CAAC,CAAC,CAAC,CAAU,EAAE,EAAE,GAAE,CAAC,CAAA;AAExB,MAAM,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,C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QAEjB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,wBAAS,CAAC,eAAe,CAAA;QACpD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,wBAAS,CAAC,UAAU,CAAA;QAC3D,IAAI,CAAC,aAAa,GAAG,wBAAS,CAAC,YAAY,CAAA;QAC3C,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IACnB,CAAC;CACF;AAED,MAAa,YAAa,SAAQ,IAAI;IACpC,YAAY,IAAiB;QAC3B,KAAK,CAAC,IAAI,EAAE,cAAc,CAAC,CAAA;IAC7B,CAAC;CACF;AAJD,oCAIC;AAED,MAAa,cAAe,SAAQ,IAAI;IACtC,YAAY,IAAiB;QAC3B,KAAK,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAA;IAC/B,CAAC;CACF;AAJD,wCAIC","sourcesContent":["import assert from 'assert'\nimport { Buffer } from 'buffer'\nimport { Minipass } from 'minipass'\nimport * as realZlib from 'zlib'\nimport { constants } from './constants.js'\nexport { constants } from './constants.js'\n\nconst OriginalBufferConcat = Buffer.concat\nconst desc = Object.getOwnPropertyDescriptor(Buffer, 'concat')\nconst noop = (args: Buffer[]) => args as unknown as Buffer\nconst passthroughBufferConcat =\n desc?.writable === true || desc?.set !== undefined\n ? (makeNoOp: boolean) => {\n Buffer.concat = makeNoOp ? noop : OriginalBufferConcat\n }\n : (_: boolean) => {}\n\nconst _superWrite = Symbol('_superWrite')\n\nexport class ZlibError extends Error {\n code?: string\n errno?: number\n constructor(err: NodeJS.ErrnoException | Error, origin?: Function) {\n super('zlib: ' + err.message, { cause: err })\n this.code = (err as NodeJS.ErrnoException).code\n this.errno = (err as NodeJS.ErrnoException).errno\n /* c8 ignore next */\n if (!this.code) this.code = 'ZLIB_ERROR'\n\n this.message = 'zlib: ' + err.message\n Error.captureStackTrace(this, origin ?? this.constructor)\n }\n\n get name() {\n return 'ZlibError'\n }\n}\n\n// the Zlib class they all inherit from\n// This thing manages the queue of requests, and returns\n// true or false if there is anything in the queue when\n// you call the .write() method.\nconst _flushFlag = Symbol('flushFlag')\n\nexport type ChunkWithFlushFlag = Minipass.ContiguousData & {\n [_flushFlag]?: number\n}\n\nexport type ZlibBaseOptions = Minipass.Options<Minipass.ContiguousData> & {\n flush?: number\n finishFlush?: number\n fullFlushFlag?: number\n}\n\nexport type ZlibHandle =\n | realZlib.Gzip\n | realZlib.Gunzip\n | realZlib.Deflate\n | realZlib.Inflate\n | realZlib.DeflateRaw\n | realZlib.InflateRaw\n | realZlib.BrotliCompress\n | realZlib.BrotliDecompress\n | realZlib.ZstdCompress\n | realZlib.ZstdDecompress\nexport type ZlibMode =\n | 'Gzip'\n | 'Gunzip'\n | 'Deflate'\n | 'Inflate'\n | 'DeflateRaw'\n | 'InflateRaw'\n | 'Unzip'\nexport type BrotliMode = 'BrotliCompress' | 'BrotliDecompress'\nexport type ZstdMode = 'ZstdCompress' | 'ZstdDecompress'\n\nabstract class ZlibBase extends Minipass<Buffer, ChunkWithFlushFlag> {\n #sawError: boolean = false\n #ended: boolean = false\n #flushFlag: number\n #finishFlushFlag: number\n #fullFlushFlag: number\n #handle?: ZlibHandle\n #onError: (err: ZlibError) => any\n\n get sawError() {\n return this.#sawError\n }\n get handle() {\n return this.#handle\n }\n /* c8 ignore start */\n get flushFlag() {\n return this.#flushFlag\n }\n /* c8 ignore stop */\n\n constructor(opts: ZlibBaseOptions, mode: ZlibMode | BrotliMode | ZstdMode) {\n if (!opts || typeof opts !== 'object')\n throw new TypeError('invalid options for ZlibBase constructor')\n\n //@ts-ignore\n super(opts)\n\n /* c8 ignore start */\n this.#flushFlag = opts.flush ?? 0\n this.#finishFlushFlag = opts.finishFlush ?? 0\n this.#fullFlushFlag = opts.fullFlushFlag ?? 0\n /* c8 ignore stop */\n\n //@ts-ignore\n if (typeof realZlib[mode] !== 'function') {\n throw new TypeError('Compression method not supported: ' + mode)\n }\n\n // this will throw if any options are invalid for the class selected\n try {\n // @types/node doesn't know that it exports the classes, but they're there\n //@ts-ignore\n this.#handle = new realZlib[mode](opts)\n } catch (er) {\n // make sure that all errors get decorated properly\n throw new ZlibError(er as NodeJS.ErrnoException, this.constructor)\n }\n\n this.#onError = err => {\n // no sense raising multiple errors, since we abort on the first one.\n if (this.#sawError) return\n\n this.#sawError = true\n\n // there is no way to cleanly recover.\n // continuing only obscures problems.\n this.close()\n this.emit('error', err)\n }\n\n this.#handle?.on('error', er => this.#onError(new ZlibError(er)))\n this.once('end', () => this.close)\n }\n\n close() {\n if (this.#handle) {\n this.#handle.close()\n this.#handle = undefined\n this.emit('close')\n }\n }\n\n reset() {\n if (!this.#sawError) {\n assert(this.#handle, 'zlib binding closed')\n //@ts-ignore\n return this.#handle.reset?.()\n }\n }\n\n flush(flushFlag?: number) {\n if (this.ended) return\n\n if (typeof flushFlag !== 'number') flushFlag = this.#fullFlushFlag\n\n this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag }))\n }\n\n end(cb?: () => void): this\n end(chunk: ChunkWithFlushFlag, cb?: () => void): this\n end(\n chunk: ChunkWithFlushFlag,\n encoding?: Minipass.Encoding,\n cb?: () => void,\n ): this\n end(\n chunk?: ChunkWithFlushFlag | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void,\n ) {\n /* c8 ignore start */\n if (typeof chunk === 'function') {\n cb = chunk\n encoding = undefined\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n /* c8 ignore stop */\n if (chunk) {\n if (encoding) this.write(chunk, encoding)\n else this.write(chunk)\n }\n this.flush(this.#finishFlushFlag)\n this.#ended = true\n return super.end(cb)\n }\n\n get ended() {\n return this.#ended\n }\n\n // overridden in the gzip classes to do portable writes\n [_superWrite](data: Buffer & { [_flushFlag]?: number }) {\n return super.write(data)\n }\n\n write(chunk: ChunkWithFlushFlag, cb?: () => void): boolean\n write(\n chunk: ChunkWithFlushFlag,\n encoding?: Minipass.Encoding,\n cb?: () => void,\n ): boolean\n write(\n chunk: ChunkWithFlushFlag,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void,\n ) {\n // process the chunk using the sync process\n // then super.write() all the outputted chunks\n if (typeof encoding === 'function')\n (cb = encoding), (encoding = 'utf8')\n\n if (typeof chunk === 'string')\n chunk = Buffer.from(chunk as string, encoding as BufferEncoding)\n\n if (this.#sawError) return\n assert(this.#handle, 'zlib binding closed')\n\n // _processChunk tries to .close() the native handle after it's done, so we\n // intercept that by temporarily making it a no-op.\n // diving into the node:zlib internals a bit here\n const nativeHandle = (this.#handle as unknown as { _handle: any })\n ._handle\n const originalNativeClose = nativeHandle.close\n nativeHandle.close = () => {}\n const originalClose = this.#handle.close\n this.#handle.close = () => {}\n // It also calls `Buffer.concat()` at the end, which may be convenient\n // for some, but which we are not interested in as it slows us down.\n passthroughBufferConcat(true)\n let result: undefined | Buffer | Buffer[] = undefined\n try {\n const flushFlag =\n typeof chunk[_flushFlag] === 'number'\n ? chunk[_flushFlag]\n : this.#flushFlag\n result = (\n this.#handle as unknown as {\n _processChunk: (chunk: Buffer, flushFlag: number) => Buffer[]\n }\n )._processChunk(chunk as Buffer, flushFlag)\n // if we don't throw, reset it back how it was\n passthroughBufferConcat(false)\n } catch (err) {\n // or if we do, put Buffer.concat() back before we emit error\n // Error events call into user code, which may call Buffer.concat()\n passthroughBufferConcat(false)\n this.#onError(new ZlibError(err as NodeJS.ErrnoException, this.write))\n } finally {\n if (this.#handle) {\n // Core zlib resets `_handle` to null after attempting to close the\n // native handle. Our no-op handler prevented actual closure, but we\n // need to restore the `._handle` property.\n ;(this.#handle as unknown as { _handle: any })._handle =\n nativeHandle\n nativeHandle.close = originalNativeClose\n this.#handle.close = originalClose\n // `_processChunk()` adds an 'error' listener. If we don't remove it\n // after each call, these handlers start piling up.\n this.#handle.removeAllListeners('error')\n // make sure OUR error listener is still attached tho\n }\n }\n\n if (this.#handle)\n this.#handle.on('error', er => this.#onError(new ZlibError(er, this.write)))\n\n let writeReturn\n if (result) {\n if (Array.isArray(result) && result.length > 0) {\n const r = result[0]\n // The first buffer is always `handle._outBuffer`, which would be\n // re-used for later invocations; so, we always have to copy that one.\n writeReturn = this[_superWrite](Buffer.from(r as Buffer))\n for (let i = 1; i < result.length; i++) {\n writeReturn = this[_superWrite](result[i] as Buffer)\n }\n } else {\n // either a single Buffer or an empty array\n writeReturn = this[_superWrite](Buffer.from(result as Buffer | []))\n }\n }\n\n if (cb) cb()\n return writeReturn\n }\n}\n\nexport type ZlibOptions = ZlibBaseOptions & {\n level?: number\n strategy?: number\n}\n\nexport class Zlib extends ZlibBase {\n #level?: number\n #strategy?: number\n\n constructor(opts: ZlibOptions, mode: ZlibMode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.Z_NO_FLUSH\n opts.finishFlush = opts.finishFlush || constants.Z_FINISH\n opts.fullFlushFlag = constants.Z_FULL_FLUSH\n super(opts, mode)\n\n this.#level = opts.level\n this.#strategy = opts.strategy\n }\n\n params(level: number, strategy: number) {\n if (this.sawError) return\n\n if (!this.handle)\n throw new Error('cannot switch params when binding is closed')\n\n // no way to test this without also not supporting params at all\n /* c8 ignore start */\n if (!(this.handle as { params?: any }).params)\n throw new Error('not supported in this implementation')\n /* c8 ignore stop */\n\n if (this.#level !== level || this.#strategy !== strategy) {\n this.flush(constants.Z_SYNC_FLUSH)\n assert(this.handle, 'zlib binding closed')\n // .params() calls .flush(), but the latter is always async in the\n // core zlib. We override .flush() temporarily to intercept that and\n // flush synchronously.\n const origFlush = this.handle.flush\n this.handle.flush = (\n flushFlag?: (() => void) | number,\n cb?: () => void,\n ) => {\n /* c8 ignore start */\n if (typeof flushFlag === 'function') {\n cb = flushFlag\n flushFlag = this.flushFlag\n }\n /* c8 ignore stop */\n this.flush(flushFlag)\n cb?.()\n }\n try {\n ;(\n this.handle as unknown as {\n params: (level?: number, strategy?: number) => void\n }\n ).params(level, strategy)\n } finally {\n this.handle.flush = origFlush\n }\n /* c8 ignore start */\n if (this.handle) {\n this.#level = level\n this.#strategy = strategy\n }\n /* c8 ignore stop */\n }\n }\n}\n\n// minimal 2-byte header\nexport class Deflate extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Deflate')\n }\n}\n\nexport class Inflate extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Inflate')\n }\n}\n\n// gzip - bigger header, same deflate compression\nexport type GzipOptions = ZlibOptions & { portable?: boolean }\nexport class Gzip extends Zlib {\n #portable: boolean\n constructor(opts: GzipOptions) {\n super(opts, 'Gzip')\n this.#portable = opts && !!opts.portable\n }\n\n [_superWrite](data: Buffer & { [_flushFlag]?: number }) {\n if (!this.#portable) return super[_superWrite](data)\n\n // we'll always get the header emitted in one first chunk\n // overwrite the OS indicator byte with 0xFF\n this.#portable = false\n data[9] = 255\n return super[_superWrite](data)\n }\n}\n\nexport class Gunzip extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Gunzip')\n }\n}\n\n// raw - no header\nexport class DeflateRaw extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'DeflateRaw')\n }\n}\n\nexport class InflateRaw extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'InflateRaw')\n }\n}\n\n// auto-detect header.\nexport class Unzip extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Unzip')\n }\n}\n\nclass Brotli extends ZlibBase {\n constructor(opts: ZlibOptions, mode: BrotliMode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS\n opts.finishFlush =\n opts.finishFlush || constants.BROTLI_OPERATION_FINISH\n opts.fullFlushFlag = constants.BROTLI_OPERATION_FLUSH\n super(opts, mode)\n }\n}\n\nexport class BrotliCompress extends Brotli {\n constructor(opts: ZlibOptions) {\n super(opts, 'BrotliCompress')\n }\n}\n\nexport class BrotliDecompress extends Brotli {\n constructor(opts: ZlibOptions) {\n super(opts, 'BrotliDecompress')\n }\n}\n\nclass Zstd extends ZlibBase {\n constructor(opts: ZlibOptions, mode: ZstdMode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.ZSTD_e_continue\n opts.finishFlush = opts.finishFlush || constants.ZSTD_e_end\n opts.fullFlushFlag = constants.ZSTD_e_flush\n super(opts, mode)\n }\n}\n\nexport class ZstdCompress extends Zstd {\n constructor(opts: ZlibOptions) {\n super(opts, 'ZstdCompress')\n }\n}\n\nexport class ZstdDecompress extends Zstd {\n constructor(opts: ZlibOptions) {\n super(opts, 'ZstdDecompress')\n }\n}\n"]}
|
tools/ui/node_modules/minizlib/dist/commonjs/package.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"type": "commonjs"
|
| 3 |
+
}
|
tools/ui/node_modules/minizlib/dist/esm/constants.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export declare const constants: any;
|
| 2 |
+
//# sourceMappingURL=constants.d.ts.map
|
tools/ui/node_modules/minizlib/dist/esm/constants.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,SAAS,KAiHrB,CAAA"}
|
tools/ui/node_modules/minizlib/dist/esm/constants.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Update with any zlib constants that are added or changed in the future.
|
| 2 |
+
// Node v6 didn't export this, so we just hard code the version and rely
|
| 3 |
+
// on all the other hard-coded values from zlib v4736. When node v6
|
| 4 |
+
// support drops, we can just export the realZlibConstants object.
|
| 5 |
+
import realZlib from 'zlib';
|
| 6 |
+
/* c8 ignore start */
|
| 7 |
+
const realZlibConstants = realZlib.constants || { ZLIB_VERNUM: 4736 };
|
| 8 |
+
/* c8 ignore stop */
|
| 9 |
+
export const constants = Object.freeze(Object.assign(Object.create(null), {
|
| 10 |
+
Z_NO_FLUSH: 0,
|
| 11 |
+
Z_PARTIAL_FLUSH: 1,
|
| 12 |
+
Z_SYNC_FLUSH: 2,
|
| 13 |
+
Z_FULL_FLUSH: 3,
|
| 14 |
+
Z_FINISH: 4,
|
| 15 |
+
Z_BLOCK: 5,
|
| 16 |
+
Z_OK: 0,
|
| 17 |
+
Z_STREAM_END: 1,
|
| 18 |
+
Z_NEED_DICT: 2,
|
| 19 |
+
Z_ERRNO: -1,
|
| 20 |
+
Z_STREAM_ERROR: -2,
|
| 21 |
+
Z_DATA_ERROR: -3,
|
| 22 |
+
Z_MEM_ERROR: -4,
|
| 23 |
+
Z_BUF_ERROR: -5,
|
| 24 |
+
Z_VERSION_ERROR: -6,
|
| 25 |
+
Z_NO_COMPRESSION: 0,
|
| 26 |
+
Z_BEST_SPEED: 1,
|
| 27 |
+
Z_BEST_COMPRESSION: 9,
|
| 28 |
+
Z_DEFAULT_COMPRESSION: -1,
|
| 29 |
+
Z_FILTERED: 1,
|
| 30 |
+
Z_HUFFMAN_ONLY: 2,
|
| 31 |
+
Z_RLE: 3,
|
| 32 |
+
Z_FIXED: 4,
|
| 33 |
+
Z_DEFAULT_STRATEGY: 0,
|
| 34 |
+
DEFLATE: 1,
|
| 35 |
+
INFLATE: 2,
|
| 36 |
+
GZIP: 3,
|
| 37 |
+
GUNZIP: 4,
|
| 38 |
+
DEFLATERAW: 5,
|
| 39 |
+
INFLATERAW: 6,
|
| 40 |
+
UNZIP: 7,
|
| 41 |
+
BROTLI_DECODE: 8,
|
| 42 |
+
BROTLI_ENCODE: 9,
|
| 43 |
+
Z_MIN_WINDOWBITS: 8,
|
| 44 |
+
Z_MAX_WINDOWBITS: 15,
|
| 45 |
+
Z_DEFAULT_WINDOWBITS: 15,
|
| 46 |
+
Z_MIN_CHUNK: 64,
|
| 47 |
+
Z_MAX_CHUNK: Infinity,
|
| 48 |
+
Z_DEFAULT_CHUNK: 16384,
|
| 49 |
+
Z_MIN_MEMLEVEL: 1,
|
| 50 |
+
Z_MAX_MEMLEVEL: 9,
|
| 51 |
+
Z_DEFAULT_MEMLEVEL: 8,
|
| 52 |
+
Z_MIN_LEVEL: -1,
|
| 53 |
+
Z_MAX_LEVEL: 9,
|
| 54 |
+
Z_DEFAULT_LEVEL: -1,
|
| 55 |
+
BROTLI_OPERATION_PROCESS: 0,
|
| 56 |
+
BROTLI_OPERATION_FLUSH: 1,
|
| 57 |
+
BROTLI_OPERATION_FINISH: 2,
|
| 58 |
+
BROTLI_OPERATION_EMIT_METADATA: 3,
|
| 59 |
+
BROTLI_MODE_GENERIC: 0,
|
| 60 |
+
BROTLI_MODE_TEXT: 1,
|
| 61 |
+
BROTLI_MODE_FONT: 2,
|
| 62 |
+
BROTLI_DEFAULT_MODE: 0,
|
| 63 |
+
BROTLI_MIN_QUALITY: 0,
|
| 64 |
+
BROTLI_MAX_QUALITY: 11,
|
| 65 |
+
BROTLI_DEFAULT_QUALITY: 11,
|
| 66 |
+
BROTLI_MIN_WINDOW_BITS: 10,
|
| 67 |
+
BROTLI_MAX_WINDOW_BITS: 24,
|
| 68 |
+
BROTLI_LARGE_MAX_WINDOW_BITS: 30,
|
| 69 |
+
BROTLI_DEFAULT_WINDOW: 22,
|
| 70 |
+
BROTLI_MIN_INPUT_BLOCK_BITS: 16,
|
| 71 |
+
BROTLI_MAX_INPUT_BLOCK_BITS: 24,
|
| 72 |
+
BROTLI_PARAM_MODE: 0,
|
| 73 |
+
BROTLI_PARAM_QUALITY: 1,
|
| 74 |
+
BROTLI_PARAM_LGWIN: 2,
|
| 75 |
+
BROTLI_PARAM_LGBLOCK: 3,
|
| 76 |
+
BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
|
| 77 |
+
BROTLI_PARAM_SIZE_HINT: 5,
|
| 78 |
+
BROTLI_PARAM_LARGE_WINDOW: 6,
|
| 79 |
+
BROTLI_PARAM_NPOSTFIX: 7,
|
| 80 |
+
BROTLI_PARAM_NDIRECT: 8,
|
| 81 |
+
BROTLI_DECODER_RESULT_ERROR: 0,
|
| 82 |
+
BROTLI_DECODER_RESULT_SUCCESS: 1,
|
| 83 |
+
BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
|
| 84 |
+
BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
|
| 85 |
+
BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
|
| 86 |
+
BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
|
| 87 |
+
BROTLI_DECODER_NO_ERROR: 0,
|
| 88 |
+
BROTLI_DECODER_SUCCESS: 1,
|
| 89 |
+
BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
|
| 90 |
+
BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
|
| 91 |
+
BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
|
| 92 |
+
BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
|
| 93 |
+
BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
|
| 94 |
+
BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
|
| 95 |
+
BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
|
| 96 |
+
BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
|
| 97 |
+
BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
|
| 98 |
+
BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
|
| 99 |
+
BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
|
| 100 |
+
BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
|
| 101 |
+
BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
|
| 102 |
+
BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
|
| 103 |
+
BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
|
| 104 |
+
BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
|
| 105 |
+
BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
|
| 106 |
+
BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
|
| 107 |
+
BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
|
| 108 |
+
BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
|
| 109 |
+
BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
|
| 110 |
+
BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
|
| 111 |
+
BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
|
| 112 |
+
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
|
| 113 |
+
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
|
| 114 |
+
BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
|
| 115 |
+
BROTLI_DECODER_ERROR_UNREACHABLE: -31,
|
| 116 |
+
}, realZlibConstants));
|
| 117 |
+
//# sourceMappingURL=constants.js.map
|
tools/ui/node_modules/minizlib/dist/esm/constants.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,wEAAwE;AACxE,oEAAoE;AACpE,kEAAkE;AAClE,OAAO,QAAQ,MAAM,MAAM,CAAA;AAC3B,qBAAqB;AACrB,MAAM,iBAAiB,GAAG,QAAQ,CAAC,SAAS,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAA;AACrE,oBAAoB;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CACpC,MAAM,CAAC,MAAM,CACX,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EACnB;IACE,UAAU,EAAE,CAAC;IACb,eAAe,EAAE,CAAC;IAClB,YAAY,EAAE,CAAC;IACf,YAAY,EAAE,CAAC;IACf,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC;IACP,YAAY,EAAE,CAAC;IACf,WAAW,EAAE,CAAC;IACd,OAAO,EAAE,CAAC,CAAC;IACX,cAAc,EAAE,CAAC,CAAC;IAClB,YAAY,EAAE,CAAC,CAAC;IAChB,WAAW,EAAE,CAAC,CAAC;IACf,WAAW,EAAE,CAAC,CAAC;IACf,eAAe,EAAE,CAAC,CAAC;IACnB,gBAAgB,EAAE,CAAC;IACnB,YAAY,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AAE;IAChD,gCAAgC,EAAE,CAAC,EAAE;CACtC,EACD,iBAAiB,CAClB,CACF,CAAA","sourcesContent":["// Update with any zlib constants that are added or changed in the future.\n// Node v6 didn't export this, so we just hard code the version and rely\n// on all the other hard-coded values from zlib v4736. When node v6\n// support drops, we can just export the realZlibConstants object.\nimport realZlib from 'zlib'\n/* c8 ignore start */\nconst realZlibConstants = realZlib.constants || { ZLIB_VERNUM: 4736 }\n/* c8 ignore stop */\n\nexport const constants = Object.freeze(\n Object.assign(\n Object.create(null),\n {\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n Z_VERSION_ERROR: -6,\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n DEFLATE: 1,\n INFLATE: 2,\n GZIP: 3,\n GUNZIP: 4,\n DEFLATERAW: 5,\n INFLATERAW: 6,\n UNZIP: 7,\n BROTLI_DECODE: 8,\n BROTLI_ENCODE: 9,\n Z_MIN_WINDOWBITS: 8,\n Z_MAX_WINDOWBITS: 15,\n Z_DEFAULT_WINDOWBITS: 15,\n Z_MIN_CHUNK: 64,\n Z_MAX_CHUNK: Infinity,\n Z_DEFAULT_CHUNK: 16384,\n Z_MIN_MEMLEVEL: 1,\n Z_MAX_MEMLEVEL: 9,\n Z_DEFAULT_MEMLEVEL: 8,\n Z_MIN_LEVEL: -1,\n Z_MAX_LEVEL: 9,\n Z_DEFAULT_LEVEL: -1,\n BROTLI_OPERATION_PROCESS: 0,\n BROTLI_OPERATION_FLUSH: 1,\n BROTLI_OPERATION_FINISH: 2,\n BROTLI_OPERATION_EMIT_METADATA: 3,\n BROTLI_MODE_GENERIC: 0,\n BROTLI_MODE_TEXT: 1,\n BROTLI_MODE_FONT: 2,\n BROTLI_DEFAULT_MODE: 0,\n BROTLI_MIN_QUALITY: 0,\n BROTLI_MAX_QUALITY: 11,\n BROTLI_DEFAULT_QUALITY: 11,\n BROTLI_MIN_WINDOW_BITS: 10,\n BROTLI_MAX_WINDOW_BITS: 24,\n BROTLI_LARGE_MAX_WINDOW_BITS: 30,\n BROTLI_DEFAULT_WINDOW: 22,\n BROTLI_MIN_INPUT_BLOCK_BITS: 16,\n BROTLI_MAX_INPUT_BLOCK_BITS: 24,\n BROTLI_PARAM_MODE: 0,\n BROTLI_PARAM_QUALITY: 1,\n BROTLI_PARAM_LGWIN: 2,\n BROTLI_PARAM_LGBLOCK: 3,\n BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,\n BROTLI_PARAM_SIZE_HINT: 5,\n BROTLI_PARAM_LARGE_WINDOW: 6,\n BROTLI_PARAM_NPOSTFIX: 7,\n BROTLI_PARAM_NDIRECT: 8,\n BROTLI_DECODER_RESULT_ERROR: 0,\n BROTLI_DECODER_RESULT_SUCCESS: 1,\n BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,\n BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,\n BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,\n BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,\n BROTLI_DECODER_NO_ERROR: 0,\n BROTLI_DECODER_SUCCESS: 1,\n BROTLI_DECODER_NEEDS_MORE_INPUT: 2,\n BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,\n BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,\n BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,\n BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,\n BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,\n BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,\n BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,\n BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,\n BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,\n BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,\n BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,\n BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,\n BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,\n BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,\n BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,\n BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,\n BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,\n BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,\n BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,\n BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,\n BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,\n BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,\n BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,\n BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,\n BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,\n BROTLI_DECODER_ERROR_UNREACHABLE: -31,\n },\n realZlibConstants,\n ),\n)\n"]}
|
tools/ui/node_modules/minizlib/dist/esm/index.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Buffer } from 'buffer';
|
| 2 |
+
import { Minipass } from 'minipass';
|
| 3 |
+
import * as realZlib from 'zlib';
|
| 4 |
+
export { constants } from './constants.js';
|
| 5 |
+
declare const _superWrite: unique symbol;
|
| 6 |
+
export declare class ZlibError extends Error {
|
| 7 |
+
code?: string;
|
| 8 |
+
errno?: number;
|
| 9 |
+
constructor(err: NodeJS.ErrnoException | Error, origin?: Function);
|
| 10 |
+
get name(): string;
|
| 11 |
+
}
|
| 12 |
+
declare const _flushFlag: unique symbol;
|
| 13 |
+
export type ChunkWithFlushFlag = Minipass.ContiguousData & {
|
| 14 |
+
[_flushFlag]?: number;
|
| 15 |
+
};
|
| 16 |
+
export type ZlibBaseOptions = Minipass.Options<Minipass.ContiguousData> & {
|
| 17 |
+
flush?: number;
|
| 18 |
+
finishFlush?: number;
|
| 19 |
+
fullFlushFlag?: number;
|
| 20 |
+
};
|
| 21 |
+
export type ZlibHandle = realZlib.Gzip | realZlib.Gunzip | realZlib.Deflate | realZlib.Inflate | realZlib.DeflateRaw | realZlib.InflateRaw | realZlib.BrotliCompress | realZlib.BrotliDecompress | realZlib.ZstdCompress | realZlib.ZstdDecompress;
|
| 22 |
+
export type ZlibMode = 'Gzip' | 'Gunzip' | 'Deflate' | 'Inflate' | 'DeflateRaw' | 'InflateRaw' | 'Unzip';
|
| 23 |
+
export type BrotliMode = 'BrotliCompress' | 'BrotliDecompress';
|
| 24 |
+
export type ZstdMode = 'ZstdCompress' | 'ZstdDecompress';
|
| 25 |
+
declare abstract class ZlibBase extends Minipass<Buffer, ChunkWithFlushFlag> {
|
| 26 |
+
#private;
|
| 27 |
+
get sawError(): boolean;
|
| 28 |
+
get handle(): ZlibHandle | undefined;
|
| 29 |
+
get flushFlag(): number;
|
| 30 |
+
constructor(opts: ZlibBaseOptions, mode: ZlibMode | BrotliMode | ZstdMode);
|
| 31 |
+
close(): void;
|
| 32 |
+
reset(): any;
|
| 33 |
+
flush(flushFlag?: number): void;
|
| 34 |
+
end(cb?: () => void): this;
|
| 35 |
+
end(chunk: ChunkWithFlushFlag, cb?: () => void): this;
|
| 36 |
+
end(chunk: ChunkWithFlushFlag, encoding?: Minipass.Encoding, cb?: () => void): this;
|
| 37 |
+
get ended(): boolean;
|
| 38 |
+
[_superWrite](data: Buffer & {
|
| 39 |
+
[_flushFlag]?: number;
|
| 40 |
+
}): boolean;
|
| 41 |
+
write(chunk: ChunkWithFlushFlag, cb?: () => void): boolean;
|
| 42 |
+
write(chunk: ChunkWithFlushFlag, encoding?: Minipass.Encoding, cb?: () => void): boolean;
|
| 43 |
+
}
|
| 44 |
+
export type ZlibOptions = ZlibBaseOptions & {
|
| 45 |
+
level?: number;
|
| 46 |
+
strategy?: number;
|
| 47 |
+
};
|
| 48 |
+
export declare class Zlib extends ZlibBase {
|
| 49 |
+
#private;
|
| 50 |
+
constructor(opts: ZlibOptions, mode: ZlibMode);
|
| 51 |
+
params(level: number, strategy: number): void;
|
| 52 |
+
}
|
| 53 |
+
export declare class Deflate extends Zlib {
|
| 54 |
+
constructor(opts: ZlibOptions);
|
| 55 |
+
}
|
| 56 |
+
export declare class Inflate extends Zlib {
|
| 57 |
+
constructor(opts: ZlibOptions);
|
| 58 |
+
}
|
| 59 |
+
export type GzipOptions = ZlibOptions & {
|
| 60 |
+
portable?: boolean;
|
| 61 |
+
};
|
| 62 |
+
export declare class Gzip extends Zlib {
|
| 63 |
+
#private;
|
| 64 |
+
constructor(opts: GzipOptions);
|
| 65 |
+
[_superWrite](data: Buffer & {
|
| 66 |
+
[_flushFlag]?: number;
|
| 67 |
+
}): boolean;
|
| 68 |
+
}
|
| 69 |
+
export declare class Gunzip extends Zlib {
|
| 70 |
+
constructor(opts: ZlibOptions);
|
| 71 |
+
}
|
| 72 |
+
export declare class DeflateRaw extends Zlib {
|
| 73 |
+
constructor(opts: ZlibOptions);
|
| 74 |
+
}
|
| 75 |
+
export declare class InflateRaw extends Zlib {
|
| 76 |
+
constructor(opts: ZlibOptions);
|
| 77 |
+
}
|
| 78 |
+
export declare class Unzip extends Zlib {
|
| 79 |
+
constructor(opts: ZlibOptions);
|
| 80 |
+
}
|
| 81 |
+
declare class Brotli extends ZlibBase {
|
| 82 |
+
constructor(opts: ZlibOptions, mode: BrotliMode);
|
| 83 |
+
}
|
| 84 |
+
export declare class BrotliCompress extends Brotli {
|
| 85 |
+
constructor(opts: ZlibOptions);
|
| 86 |
+
}
|
| 87 |
+
export declare class BrotliDecompress extends Brotli {
|
| 88 |
+
constructor(opts: ZlibOptions);
|
| 89 |
+
}
|
| 90 |
+
declare class Zstd extends ZlibBase {
|
| 91 |
+
constructor(opts: ZlibOptions, mode: ZstdMode);
|
| 92 |
+
}
|
| 93 |
+
export declare class ZstdCompress extends Zstd {
|
| 94 |
+
constructor(opts: ZlibOptions);
|
| 95 |
+
}
|
| 96 |
+
export declare class ZstdDecompress extends Zstd {
|
| 97 |
+
constructor(opts: ZlibOptions);
|
| 98 |
+
}
|
| 99 |
+
//# sourceMappingURL=index.d.ts.map
|
tools/ui/node_modules/minizlib/dist/esm/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 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,EAAE,MAAM,CAAC,EAAE,QAAQ;IAWjE,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,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,UAAU,GAClB,QAAQ,CAAC,IAAI,GACb,QAAQ,CAAC,MAAM,GACf,QAAQ,CAAC,OAAO,GAChB,QAAQ,CAAC,OAAO,GAChB,QAAQ,CAAC,UAAU,GACnB,QAAQ,CAAC,UAAU,GACnB,QAAQ,CAAC,cAAc,GAC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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import assert from 'assert';
|
| 2 |
+
import { Buffer } from 'buffer';
|
| 3 |
+
import { Minipass } from 'minipass';
|
| 4 |
+
import * as realZlib from 'zlib';
|
| 5 |
+
import { constants } from './constants.js';
|
| 6 |
+
export { constants } from './constants.js';
|
| 7 |
+
const OriginalBufferConcat = Buffer.concat;
|
| 8 |
+
const desc = Object.getOwnPropertyDescriptor(Buffer, 'concat');
|
| 9 |
+
const noop = (args) => args;
|
| 10 |
+
const passthroughBufferConcat = desc?.writable === true || desc?.set !== undefined
|
| 11 |
+
? (makeNoOp) => {
|
| 12 |
+
Buffer.concat = makeNoOp ? noop : OriginalBufferConcat;
|
| 13 |
+
}
|
| 14 |
+
: (_) => { };
|
| 15 |
+
const _superWrite = Symbol('_superWrite');
|
| 16 |
+
export class ZlibError extends Error {
|
| 17 |
+
code;
|
| 18 |
+
errno;
|
| 19 |
+
constructor(err, origin) {
|
| 20 |
+
super('zlib: ' + err.message, { cause: err });
|
| 21 |
+
this.code = err.code;
|
| 22 |
+
this.errno = err.errno;
|
| 23 |
+
/* c8 ignore next */
|
| 24 |
+
if (!this.code)
|
| 25 |
+
this.code = 'ZLIB_ERROR';
|
| 26 |
+
this.message = 'zlib: ' + err.message;
|
| 27 |
+
Error.captureStackTrace(this, origin ?? this.constructor);
|
| 28 |
+
}
|
| 29 |
+
get name() {
|
| 30 |
+
return 'ZlibError';
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
// the Zlib class they all inherit from
|
| 34 |
+
// This thing manages the queue of requests, and returns
|
| 35 |
+
// true or false if there is anything in the queue when
|
| 36 |
+
// you call the .write() method.
|
| 37 |
+
const _flushFlag = Symbol('flushFlag');
|
| 38 |
+
class ZlibBase extends Minipass {
|
| 39 |
+
#sawError = false;
|
| 40 |
+
#ended = false;
|
| 41 |
+
#flushFlag;
|
| 42 |
+
#finishFlushFlag;
|
| 43 |
+
#fullFlushFlag;
|
| 44 |
+
#handle;
|
| 45 |
+
#onError;
|
| 46 |
+
get sawError() {
|
| 47 |
+
return this.#sawError;
|
| 48 |
+
}
|
| 49 |
+
get handle() {
|
| 50 |
+
return this.#handle;
|
| 51 |
+
}
|
| 52 |
+
/* c8 ignore start */
|
| 53 |
+
get flushFlag() {
|
| 54 |
+
return this.#flushFlag;
|
| 55 |
+
}
|
| 56 |
+
/* c8 ignore stop */
|
| 57 |
+
constructor(opts, mode) {
|
| 58 |
+
if (!opts || typeof opts !== 'object')
|
| 59 |
+
throw new TypeError('invalid options for ZlibBase constructor');
|
| 60 |
+
//@ts-ignore
|
| 61 |
+
super(opts);
|
| 62 |
+
/* c8 ignore start */
|
| 63 |
+
this.#flushFlag = opts.flush ?? 0;
|
| 64 |
+
this.#finishFlushFlag = opts.finishFlush ?? 0;
|
| 65 |
+
this.#fullFlushFlag = opts.fullFlushFlag ?? 0;
|
| 66 |
+
/* c8 ignore stop */
|
| 67 |
+
//@ts-ignore
|
| 68 |
+
if (typeof realZlib[mode] !== 'function') {
|
| 69 |
+
throw new TypeError('Compression method not supported: ' + mode);
|
| 70 |
+
}
|
| 71 |
+
// this will throw if any options are invalid for the class selected
|
| 72 |
+
try {
|
| 73 |
+
// @types/node doesn't know that it exports the classes, but they're there
|
| 74 |
+
//@ts-ignore
|
| 75 |
+
this.#handle = new realZlib[mode](opts);
|
| 76 |
+
}
|
| 77 |
+
catch (er) {
|
| 78 |
+
// make sure that all errors get decorated properly
|
| 79 |
+
throw new ZlibError(er, this.constructor);
|
| 80 |
+
}
|
| 81 |
+
this.#onError = err => {
|
| 82 |
+
// no sense raising multiple errors, since we abort on the first one.
|
| 83 |
+
if (this.#sawError)
|
| 84 |
+
return;
|
| 85 |
+
this.#sawError = true;
|
| 86 |
+
// there is no way to cleanly recover.
|
| 87 |
+
// continuing only obscures problems.
|
| 88 |
+
this.close();
|
| 89 |
+
this.emit('error', err);
|
| 90 |
+
};
|
| 91 |
+
this.#handle?.on('error', er => this.#onError(new ZlibError(er)));
|
| 92 |
+
this.once('end', () => this.close);
|
| 93 |
+
}
|
| 94 |
+
close() {
|
| 95 |
+
if (this.#handle) {
|
| 96 |
+
this.#handle.close();
|
| 97 |
+
this.#handle = undefined;
|
| 98 |
+
this.emit('close');
|
| 99 |
+
}
|
| 100 |
+
}
|
| 101 |
+
reset() {
|
| 102 |
+
if (!this.#sawError) {
|
| 103 |
+
assert(this.#handle, 'zlib binding closed');
|
| 104 |
+
//@ts-ignore
|
| 105 |
+
return this.#handle.reset?.();
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
flush(flushFlag) {
|
| 109 |
+
if (this.ended)
|
| 110 |
+
return;
|
| 111 |
+
if (typeof flushFlag !== 'number')
|
| 112 |
+
flushFlag = this.#fullFlushFlag;
|
| 113 |
+
this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag }));
|
| 114 |
+
}
|
| 115 |
+
end(chunk, encoding, cb) {
|
| 116 |
+
/* c8 ignore start */
|
| 117 |
+
if (typeof chunk === 'function') {
|
| 118 |
+
cb = chunk;
|
| 119 |
+
encoding = undefined;
|
| 120 |
+
chunk = undefined;
|
| 121 |
+
}
|
| 122 |
+
if (typeof encoding === 'function') {
|
| 123 |
+
cb = encoding;
|
| 124 |
+
encoding = undefined;
|
| 125 |
+
}
|
| 126 |
+
/* c8 ignore stop */
|
| 127 |
+
if (chunk) {
|
| 128 |
+
if (encoding)
|
| 129 |
+
this.write(chunk, encoding);
|
| 130 |
+
else
|
| 131 |
+
this.write(chunk);
|
| 132 |
+
}
|
| 133 |
+
this.flush(this.#finishFlushFlag);
|
| 134 |
+
this.#ended = true;
|
| 135 |
+
return super.end(cb);
|
| 136 |
+
}
|
| 137 |
+
get ended() {
|
| 138 |
+
return this.#ended;
|
| 139 |
+
}
|
| 140 |
+
// overridden in the gzip classes to do portable writes
|
| 141 |
+
[_superWrite](data) {
|
| 142 |
+
return super.write(data);
|
| 143 |
+
}
|
| 144 |
+
write(chunk, encoding, cb) {
|
| 145 |
+
// process the chunk using the sync process
|
| 146 |
+
// then super.write() all the outputted chunks
|
| 147 |
+
if (typeof encoding === 'function')
|
| 148 |
+
(cb = encoding), (encoding = 'utf8');
|
| 149 |
+
if (typeof chunk === 'string')
|
| 150 |
+
chunk = Buffer.from(chunk, encoding);
|
| 151 |
+
if (this.#sawError)
|
| 152 |
+
return;
|
| 153 |
+
assert(this.#handle, 'zlib binding closed');
|
| 154 |
+
// _processChunk tries to .close() the native handle after it's done, so we
|
| 155 |
+
// intercept that by temporarily making it a no-op.
|
| 156 |
+
// diving into the node:zlib internals a bit here
|
| 157 |
+
const nativeHandle = this.#handle
|
| 158 |
+
._handle;
|
| 159 |
+
const originalNativeClose = nativeHandle.close;
|
| 160 |
+
nativeHandle.close = () => { };
|
| 161 |
+
const originalClose = this.#handle.close;
|
| 162 |
+
this.#handle.close = () => { };
|
| 163 |
+
// It also calls `Buffer.concat()` at the end, which may be convenient
|
| 164 |
+
// for some, but which we are not interested in as it slows us down.
|
| 165 |
+
passthroughBufferConcat(true);
|
| 166 |
+
let result = undefined;
|
| 167 |
+
try {
|
| 168 |
+
const flushFlag = typeof chunk[_flushFlag] === 'number'
|
| 169 |
+
? chunk[_flushFlag]
|
| 170 |
+
: this.#flushFlag;
|
| 171 |
+
result = this.#handle._processChunk(chunk, flushFlag);
|
| 172 |
+
// if we don't throw, reset it back how it was
|
| 173 |
+
passthroughBufferConcat(false);
|
| 174 |
+
}
|
| 175 |
+
catch (err) {
|
| 176 |
+
// or if we do, put Buffer.concat() back before we emit error
|
| 177 |
+
// Error events call into user code, which may call Buffer.concat()
|
| 178 |
+
passthroughBufferConcat(false);
|
| 179 |
+
this.#onError(new ZlibError(err, this.write));
|
| 180 |
+
}
|
| 181 |
+
finally {
|
| 182 |
+
if (this.#handle) {
|
| 183 |
+
// Core zlib resets `_handle` to null after attempting to close the
|
| 184 |
+
// native handle. Our no-op handler prevented actual closure, but we
|
| 185 |
+
// need to restore the `._handle` property.
|
| 186 |
+
;
|
| 187 |
+
this.#handle._handle =
|
| 188 |
+
nativeHandle;
|
| 189 |
+
nativeHandle.close = originalNativeClose;
|
| 190 |
+
this.#handle.close = originalClose;
|
| 191 |
+
// `_processChunk()` adds an 'error' listener. If we don't remove it
|
| 192 |
+
// after each call, these handlers start piling up.
|
| 193 |
+
this.#handle.removeAllListeners('error');
|
| 194 |
+
// make sure OUR error listener is still attached tho
|
| 195 |
+
}
|
| 196 |
+
}
|
| 197 |
+
if (this.#handle)
|
| 198 |
+
this.#handle.on('error', er => this.#onError(new ZlibError(er, this.write)));
|
| 199 |
+
let writeReturn;
|
| 200 |
+
if (result) {
|
| 201 |
+
if (Array.isArray(result) && result.length > 0) {
|
| 202 |
+
const r = result[0];
|
| 203 |
+
// The first buffer is always `handle._outBuffer`, which would be
|
| 204 |
+
// re-used for later invocations; so, we always have to copy that one.
|
| 205 |
+
writeReturn = this[_superWrite](Buffer.from(r));
|
| 206 |
+
for (let i = 1; i < result.length; i++) {
|
| 207 |
+
writeReturn = this[_superWrite](result[i]);
|
| 208 |
+
}
|
| 209 |
+
}
|
| 210 |
+
else {
|
| 211 |
+
// either a single Buffer or an empty array
|
| 212 |
+
writeReturn = this[_superWrite](Buffer.from(result));
|
| 213 |
+
}
|
| 214 |
+
}
|
| 215 |
+
if (cb)
|
| 216 |
+
cb();
|
| 217 |
+
return writeReturn;
|
| 218 |
+
}
|
| 219 |
+
}
|
| 220 |
+
export class Zlib extends ZlibBase {
|
| 221 |
+
#level;
|
| 222 |
+
#strategy;
|
| 223 |
+
constructor(opts, mode) {
|
| 224 |
+
opts = opts || {};
|
| 225 |
+
opts.flush = opts.flush || constants.Z_NO_FLUSH;
|
| 226 |
+
opts.finishFlush = opts.finishFlush || constants.Z_FINISH;
|
| 227 |
+
opts.fullFlushFlag = constants.Z_FULL_FLUSH;
|
| 228 |
+
super(opts, mode);
|
| 229 |
+
this.#level = opts.level;
|
| 230 |
+
this.#strategy = opts.strategy;
|
| 231 |
+
}
|
| 232 |
+
params(level, strategy) {
|
| 233 |
+
if (this.sawError)
|
| 234 |
+
return;
|
| 235 |
+
if (!this.handle)
|
| 236 |
+
throw new Error('cannot switch params when binding is closed');
|
| 237 |
+
// no way to test this without also not supporting params at all
|
| 238 |
+
/* c8 ignore start */
|
| 239 |
+
if (!this.handle.params)
|
| 240 |
+
throw new Error('not supported in this implementation');
|
| 241 |
+
/* c8 ignore stop */
|
| 242 |
+
if (this.#level !== level || this.#strategy !== strategy) {
|
| 243 |
+
this.flush(constants.Z_SYNC_FLUSH);
|
| 244 |
+
assert(this.handle, 'zlib binding closed');
|
| 245 |
+
// .params() calls .flush(), but the latter is always async in the
|
| 246 |
+
// core zlib. We override .flush() temporarily to intercept that and
|
| 247 |
+
// flush synchronously.
|
| 248 |
+
const origFlush = this.handle.flush;
|
| 249 |
+
this.handle.flush = (flushFlag, cb) => {
|
| 250 |
+
/* c8 ignore start */
|
| 251 |
+
if (typeof flushFlag === 'function') {
|
| 252 |
+
cb = flushFlag;
|
| 253 |
+
flushFlag = this.flushFlag;
|
| 254 |
+
}
|
| 255 |
+
/* c8 ignore stop */
|
| 256 |
+
this.flush(flushFlag);
|
| 257 |
+
cb?.();
|
| 258 |
+
};
|
| 259 |
+
try {
|
| 260 |
+
;
|
| 261 |
+
this.handle.params(level, strategy);
|
| 262 |
+
}
|
| 263 |
+
finally {
|
| 264 |
+
this.handle.flush = origFlush;
|
| 265 |
+
}
|
| 266 |
+
/* c8 ignore start */
|
| 267 |
+
if (this.handle) {
|
| 268 |
+
this.#level = level;
|
| 269 |
+
this.#strategy = strategy;
|
| 270 |
+
}
|
| 271 |
+
/* c8 ignore stop */
|
| 272 |
+
}
|
| 273 |
+
}
|
| 274 |
+
}
|
| 275 |
+
// minimal 2-byte header
|
| 276 |
+
export class Deflate extends Zlib {
|
| 277 |
+
constructor(opts) {
|
| 278 |
+
super(opts, 'Deflate');
|
| 279 |
+
}
|
| 280 |
+
}
|
| 281 |
+
export class Inflate extends Zlib {
|
| 282 |
+
constructor(opts) {
|
| 283 |
+
super(opts, 'Inflate');
|
| 284 |
+
}
|
| 285 |
+
}
|
| 286 |
+
export class Gzip extends Zlib {
|
| 287 |
+
#portable;
|
| 288 |
+
constructor(opts) {
|
| 289 |
+
super(opts, 'Gzip');
|
| 290 |
+
this.#portable = opts && !!opts.portable;
|
| 291 |
+
}
|
| 292 |
+
[_superWrite](data) {
|
| 293 |
+
if (!this.#portable)
|
| 294 |
+
return super[_superWrite](data);
|
| 295 |
+
// we'll always get the header emitted in one first chunk
|
| 296 |
+
// overwrite the OS indicator byte with 0xFF
|
| 297 |
+
this.#portable = false;
|
| 298 |
+
data[9] = 255;
|
| 299 |
+
return super[_superWrite](data);
|
| 300 |
+
}
|
| 301 |
+
}
|
| 302 |
+
export class Gunzip extends Zlib {
|
| 303 |
+
constructor(opts) {
|
| 304 |
+
super(opts, 'Gunzip');
|
| 305 |
+
}
|
| 306 |
+
}
|
| 307 |
+
// raw - no header
|
| 308 |
+
export class DeflateRaw extends Zlib {
|
| 309 |
+
constructor(opts) {
|
| 310 |
+
super(opts, 'DeflateRaw');
|
| 311 |
+
}
|
| 312 |
+
}
|
| 313 |
+
export class InflateRaw extends Zlib {
|
| 314 |
+
constructor(opts) {
|
| 315 |
+
super(opts, 'InflateRaw');
|
| 316 |
+
}
|
| 317 |
+
}
|
| 318 |
+
// auto-detect header.
|
| 319 |
+
export class Unzip extends Zlib {
|
| 320 |
+
constructor(opts) {
|
| 321 |
+
super(opts, 'Unzip');
|
| 322 |
+
}
|
| 323 |
+
}
|
| 324 |
+
class Brotli extends ZlibBase {
|
| 325 |
+
constructor(opts, mode) {
|
| 326 |
+
opts = opts || {};
|
| 327 |
+
opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS;
|
| 328 |
+
opts.finishFlush =
|
| 329 |
+
opts.finishFlush || constants.BROTLI_OPERATION_FINISH;
|
| 330 |
+
opts.fullFlushFlag = constants.BROTLI_OPERATION_FLUSH;
|
| 331 |
+
super(opts, mode);
|
| 332 |
+
}
|
| 333 |
+
}
|
| 334 |
+
export class BrotliCompress extends Brotli {
|
| 335 |
+
constructor(opts) {
|
| 336 |
+
super(opts, 'BrotliCompress');
|
| 337 |
+
}
|
| 338 |
+
}
|
| 339 |
+
export class BrotliDecompress extends Brotli {
|
| 340 |
+
constructor(opts) {
|
| 341 |
+
super(opts, 'BrotliDecompress');
|
| 342 |
+
}
|
| 343 |
+
}
|
| 344 |
+
class Zstd extends ZlibBase {
|
| 345 |
+
constructor(opts, mode) {
|
| 346 |
+
opts = opts || {};
|
| 347 |
+
opts.flush = opts.flush || constants.ZSTD_e_continue;
|
| 348 |
+
opts.finishFlush = opts.finishFlush || constants.ZSTD_e_end;
|
| 349 |
+
opts.fullFlushFlag = constants.ZSTD_e_flush;
|
| 350 |
+
super(opts, mode);
|
| 351 |
+
}
|
| 352 |
+
}
|
| 353 |
+
export class ZstdCompress extends Zstd {
|
| 354 |
+
constructor(opts) {
|
| 355 |
+
super(opts, 'ZstdCompress');
|
| 356 |
+
}
|
| 357 |
+
}
|
| 358 |
+
export class ZstdDecompress extends Zstd {
|
| 359 |
+
constructor(opts) {
|
| 360 |
+
super(opts, 'ZstdDecompress');
|
| 361 |
+
}
|
| 362 |
+
}
|
| 363 |
+
//# sourceMappingURL=index.js.map
|
tools/ui/node_modules/minizlib/dist/esm/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version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iB;QAC3B,KAAK,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAA;IAC/B,CAAC;CACF","sourcesContent":["import assert from 'assert'\nimport { Buffer } from 'buffer'\nimport { Minipass } from 'minipass'\nimport * as realZlib from 'zlib'\nimport { constants } from './constants.js'\nexport { constants } from './constants.js'\n\nconst OriginalBufferConcat = Buffer.concat\nconst desc = Object.getOwnPropertyDescriptor(Buffer, 'concat')\nconst noop = (args: Buffer[]) => args as unknown as Buffer\nconst passthroughBufferConcat =\n desc?.writable === true || desc?.set !== undefined\n ? (makeNoOp: boolean) => {\n Buffer.concat = makeNoOp ? noop : OriginalBufferConcat\n }\n : (_: boolean) => {}\n\nconst _superWrite = Symbol('_superWrite')\n\nexport class ZlibError extends Error {\n code?: string\n errno?: number\n constructor(err: NodeJS.ErrnoException | Error, origin?: Function) {\n super('zlib: ' + err.message, { cause: err })\n this.code = (err as NodeJS.ErrnoException).code\n this.errno = (err as NodeJS.ErrnoException).errno\n /* c8 ignore next */\n if (!this.code) this.code = 'ZLIB_ERROR'\n\n this.message = 'zlib: ' + err.message\n Error.captureStackTrace(this, origin ?? this.constructor)\n }\n\n get name() {\n return 'ZlibError'\n }\n}\n\n// the Zlib class they all inherit from\n// This thing manages the queue of requests, and returns\n// true or false if there is anything in the queue when\n// you call the .write() method.\nconst _flushFlag = Symbol('flushFlag')\n\nexport type ChunkWithFlushFlag = Minipass.ContiguousData & {\n [_flushFlag]?: number\n}\n\nexport type ZlibBaseOptions = Minipass.Options<Minipass.ContiguousData> & {\n flush?: number\n finishFlush?: number\n fullFlushFlag?: number\n}\n\nexport type ZlibHandle =\n | realZlib.Gzip\n | realZlib.Gunzip\n | realZlib.Deflate\n | realZlib.Inflate\n | realZlib.DeflateRaw\n | realZlib.InflateRaw\n | realZlib.BrotliCompress\n | realZlib.BrotliDecompress\n | realZlib.ZstdCompress\n | realZlib.ZstdDecompress\nexport type ZlibMode =\n | 'Gzip'\n | 'Gunzip'\n | 'Deflate'\n | 'Inflate'\n | 'DeflateRaw'\n | 'InflateRaw'\n | 'Unzip'\nexport type BrotliMode = 'BrotliCompress' | 'BrotliDecompress'\nexport type ZstdMode = 'ZstdCompress' | 'ZstdDecompress'\n\nabstract class ZlibBase extends Minipass<Buffer, ChunkWithFlushFlag> {\n #sawError: boolean = false\n #ended: boolean = false\n #flushFlag: number\n #finishFlushFlag: number\n #fullFlushFlag: number\n #handle?: ZlibHandle\n #onError: (err: ZlibError) => any\n\n get sawError() {\n return this.#sawError\n }\n get handle() {\n return this.#handle\n }\n /* c8 ignore start */\n get flushFlag() {\n return this.#flushFlag\n }\n /* c8 ignore stop */\n\n constructor(opts: ZlibBaseOptions, mode: ZlibMode | BrotliMode | ZstdMode) {\n if (!opts || typeof opts !== 'object')\n throw new TypeError('invalid options for ZlibBase constructor')\n\n //@ts-ignore\n super(opts)\n\n /* c8 ignore start */\n this.#flushFlag = opts.flush ?? 0\n this.#finishFlushFlag = opts.finishFlush ?? 0\n this.#fullFlushFlag = opts.fullFlushFlag ?? 0\n /* c8 ignore stop */\n\n //@ts-ignore\n if (typeof realZlib[mode] !== 'function') {\n throw new TypeError('Compression method not supported: ' + mode)\n }\n\n // this will throw if any options are invalid for the class selected\n try {\n // @types/node doesn't know that it exports the classes, but they're there\n //@ts-ignore\n this.#handle = new realZlib[mode](opts)\n } catch (er) {\n // make sure that all errors get decorated properly\n throw new ZlibError(er as NodeJS.ErrnoException, this.constructor)\n }\n\n this.#onError = err => {\n // no sense raising multiple errors, since we abort on the first one.\n if (this.#sawError) return\n\n this.#sawError = true\n\n // there is no way to cleanly recover.\n // continuing only obscures problems.\n this.close()\n this.emit('error', err)\n }\n\n this.#handle?.on('error', er => this.#onError(new ZlibError(er)))\n this.once('end', () => this.close)\n }\n\n close() {\n if (this.#handle) {\n this.#handle.close()\n this.#handle = undefined\n this.emit('close')\n }\n }\n\n reset() {\n if (!this.#sawError) {\n assert(this.#handle, 'zlib binding closed')\n //@ts-ignore\n return this.#handle.reset?.()\n }\n }\n\n flush(flushFlag?: number) {\n if (this.ended) return\n\n if (typeof flushFlag !== 'number') flushFlag = this.#fullFlushFlag\n\n this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag }))\n }\n\n end(cb?: () => void): this\n end(chunk: ChunkWithFlushFlag, cb?: () => void): this\n end(\n chunk: ChunkWithFlushFlag,\n encoding?: Minipass.Encoding,\n cb?: () => void,\n ): this\n end(\n chunk?: ChunkWithFlushFlag | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void,\n ) {\n /* c8 ignore start */\n if (typeof chunk === 'function') {\n cb = chunk\n encoding = undefined\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = undefined\n }\n /* c8 ignore stop */\n if (chunk) {\n if (encoding) this.write(chunk, encoding)\n else this.write(chunk)\n }\n this.flush(this.#finishFlushFlag)\n this.#ended = true\n return super.end(cb)\n }\n\n get ended() {\n return this.#ended\n }\n\n // overridden in the gzip classes to do portable writes\n [_superWrite](data: Buffer & { [_flushFlag]?: number }) {\n return super.write(data)\n }\n\n write(chunk: ChunkWithFlushFlag, cb?: () => void): boolean\n write(\n chunk: ChunkWithFlushFlag,\n encoding?: Minipass.Encoding,\n cb?: () => void,\n ): boolean\n write(\n chunk: ChunkWithFlushFlag,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void,\n ) {\n // process the chunk using the sync process\n // then super.write() all the outputted chunks\n if (typeof encoding === 'function')\n (cb = encoding), (encoding = 'utf8')\n\n if (typeof chunk === 'string')\n chunk = Buffer.from(chunk as string, encoding as BufferEncoding)\n\n if (this.#sawError) return\n assert(this.#handle, 'zlib binding closed')\n\n // _processChunk tries to .close() the native handle after it's done, so we\n // intercept that by temporarily making it a no-op.\n // diving into the node:zlib internals a bit here\n const nativeHandle = (this.#handle as unknown as { _handle: any })\n ._handle\n const originalNativeClose = nativeHandle.close\n nativeHandle.close = () => {}\n const originalClose = this.#handle.close\n this.#handle.close = () => {}\n // It also calls `Buffer.concat()` at the end, which may be convenient\n // for some, but which we are not interested in as it slows us down.\n passthroughBufferConcat(true)\n let result: undefined | Buffer | Buffer[] = undefined\n try {\n const flushFlag =\n typeof chunk[_flushFlag] === 'number'\n ? chunk[_flushFlag]\n : this.#flushFlag\n result = (\n this.#handle as unknown as {\n _processChunk: (chunk: Buffer, flushFlag: number) => Buffer[]\n }\n )._processChunk(chunk as Buffer, flushFlag)\n // if we don't throw, reset it back how it was\n passthroughBufferConcat(false)\n } catch (err) {\n // or if we do, put Buffer.concat() back before we emit error\n // Error events call into user code, which may call Buffer.concat()\n passthroughBufferConcat(false)\n this.#onError(new ZlibError(err as NodeJS.ErrnoException, this.write))\n } finally {\n if (this.#handle) {\n // Core zlib resets `_handle` to null after attempting to close the\n // native handle. Our no-op handler prevented actual closure, but we\n // need to restore the `._handle` property.\n ;(this.#handle as unknown as { _handle: any })._handle =\n nativeHandle\n nativeHandle.close = originalNativeClose\n this.#handle.close = originalClose\n // `_processChunk()` adds an 'error' listener. If we don't remove it\n // after each call, these handlers start piling up.\n this.#handle.removeAllListeners('error')\n // make sure OUR error listener is still attached tho\n }\n }\n\n if (this.#handle)\n this.#handle.on('error', er => this.#onError(new ZlibError(er, this.write)))\n\n let writeReturn\n if (result) {\n if (Array.isArray(result) && result.length > 0) {\n const r = result[0]\n // The first buffer is always `handle._outBuffer`, which would be\n // re-used for later invocations; so, we always have to copy that one.\n writeReturn = this[_superWrite](Buffer.from(r as Buffer))\n for (let i = 1; i < result.length; i++) {\n writeReturn = this[_superWrite](result[i] as Buffer)\n }\n } else {\n // either a single Buffer or an empty array\n writeReturn = this[_superWrite](Buffer.from(result as Buffer | []))\n }\n }\n\n if (cb) cb()\n return writeReturn\n }\n}\n\nexport type ZlibOptions = ZlibBaseOptions & {\n level?: number\n strategy?: number\n}\n\nexport class Zlib extends ZlibBase {\n #level?: number\n #strategy?: number\n\n constructor(opts: ZlibOptions, mode: ZlibMode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.Z_NO_FLUSH\n opts.finishFlush = opts.finishFlush || constants.Z_FINISH\n opts.fullFlushFlag = constants.Z_FULL_FLUSH\n super(opts, mode)\n\n this.#level = opts.level\n this.#strategy = opts.strategy\n }\n\n params(level: number, strategy: number) {\n if (this.sawError) return\n\n if (!this.handle)\n throw new Error('cannot switch params when binding is closed')\n\n // no way to test this without also not supporting params at all\n /* c8 ignore start */\n if (!(this.handle as { params?: any }).params)\n throw new Error('not supported in this implementation')\n /* c8 ignore stop */\n\n if (this.#level !== level || this.#strategy !== strategy) {\n this.flush(constants.Z_SYNC_FLUSH)\n assert(this.handle, 'zlib binding closed')\n // .params() calls .flush(), but the latter is always async in the\n // core zlib. We override .flush() temporarily to intercept that and\n // flush synchronously.\n const origFlush = this.handle.flush\n this.handle.flush = (\n flushFlag?: (() => void) | number,\n cb?: () => void,\n ) => {\n /* c8 ignore start */\n if (typeof flushFlag === 'function') {\n cb = flushFlag\n flushFlag = this.flushFlag\n }\n /* c8 ignore stop */\n this.flush(flushFlag)\n cb?.()\n }\n try {\n ;(\n this.handle as unknown as {\n params: (level?: number, strategy?: number) => void\n }\n ).params(level, strategy)\n } finally {\n this.handle.flush = origFlush\n }\n /* c8 ignore start */\n if (this.handle) {\n this.#level = level\n this.#strategy = strategy\n }\n /* c8 ignore stop */\n }\n }\n}\n\n// minimal 2-byte header\nexport class Deflate extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Deflate')\n }\n}\n\nexport class Inflate extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Inflate')\n }\n}\n\n// gzip - bigger header, same deflate compression\nexport type GzipOptions = ZlibOptions & { portable?: boolean }\nexport class Gzip extends Zlib {\n #portable: boolean\n constructor(opts: GzipOptions) {\n super(opts, 'Gzip')\n this.#portable = opts && !!opts.portable\n }\n\n [_superWrite](data: Buffer & { [_flushFlag]?: number }) {\n if (!this.#portable) return super[_superWrite](data)\n\n // we'll always get the header emitted in one first chunk\n // overwrite the OS indicator byte with 0xFF\n this.#portable = false\n data[9] = 255\n return super[_superWrite](data)\n }\n}\n\nexport class Gunzip extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Gunzip')\n }\n}\n\n// raw - no header\nexport class DeflateRaw extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'DeflateRaw')\n }\n}\n\nexport class InflateRaw extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'InflateRaw')\n }\n}\n\n// auto-detect header.\nexport class Unzip extends Zlib {\n constructor(opts: ZlibOptions) {\n super(opts, 'Unzip')\n }\n}\n\nclass Brotli extends ZlibBase {\n constructor(opts: ZlibOptions, mode: BrotliMode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS\n opts.finishFlush =\n opts.finishFlush || constants.BROTLI_OPERATION_FINISH\n opts.fullFlushFlag = constants.BROTLI_OPERATION_FLUSH\n super(opts, mode)\n }\n}\n\nexport class BrotliCompress extends Brotli {\n constructor(opts: ZlibOptions) {\n super(opts, 'BrotliCompress')\n }\n}\n\nexport class BrotliDecompress extends Brotli {\n constructor(opts: ZlibOptions) {\n super(opts, 'BrotliDecompress')\n }\n}\n\nclass Zstd extends ZlibBase {\n constructor(opts: ZlibOptions, mode: ZstdMode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.ZSTD_e_continue\n opts.finishFlush = opts.finishFlush || constants.ZSTD_e_end\n opts.fullFlushFlag = constants.ZSTD_e_flush\n super(opts, mode)\n }\n}\n\nexport class ZstdCompress extends Zstd {\n constructor(opts: ZlibOptions) {\n super(opts, 'ZstdCompress')\n }\n}\n\nexport class ZstdDecompress extends Zstd {\n constructor(opts: ZlibOptions) {\n super(opts, 'ZstdDecompress')\n }\n}\n"]}
|
tools/ui/node_modules/minizlib/dist/esm/package.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"type": "module"
|
| 3 |
+
}
|
tools/ui/node_modules/minizlib/package.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "minizlib",
|
| 3 |
+
"version": "3.1.0",
|
| 4 |
+
"description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.",
|
| 5 |
+
"main": "./dist/commonjs/index.js",
|
| 6 |
+
"dependencies": {
|
| 7 |
+
"minipass": "^7.1.2"
|
| 8 |
+
},
|
| 9 |
+
"scripts": {
|
| 10 |
+
"prepare": "tshy",
|
| 11 |
+
"pretest": "npm run prepare",
|
| 12 |
+
"test": "tap",
|
| 13 |
+
"preversion": "npm test",
|
| 14 |
+
"postversion": "npm publish",
|
| 15 |
+
"prepublishOnly": "git push origin --follow-tags",
|
| 16 |
+
"format": "prettier --write . --loglevel warn",
|
| 17 |
+
"typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
|
| 18 |
+
},
|
| 19 |
+
"repository": {
|
| 20 |
+
"type": "git",
|
| 21 |
+
"url": "git+https://github.com/isaacs/minizlib.git"
|
| 22 |
+
},
|
| 23 |
+
"keywords": [
|
| 24 |
+
"zlib",
|
| 25 |
+
"gzip",
|
| 26 |
+
"gunzip",
|
| 27 |
+
"deflate",
|
| 28 |
+
"inflate",
|
| 29 |
+
"compression",
|
| 30 |
+
"zip",
|
| 31 |
+
"unzip"
|
| 32 |
+
],
|
| 33 |
+
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
| 34 |
+
"license": "MIT",
|
| 35 |
+
"devDependencies": {
|
| 36 |
+
"@types/node": "^24.5.2",
|
| 37 |
+
"tap": "^21.1.0",
|
| 38 |
+
"tshy": "^3.0.2",
|
| 39 |
+
"typedoc": "^0.28.1"
|
| 40 |
+
},
|
| 41 |
+
"files": [
|
| 42 |
+
"dist"
|
| 43 |
+
],
|
| 44 |
+
"engines": {
|
| 45 |
+
"node": ">= 18"
|
| 46 |
+
},
|
| 47 |
+
"tshy": {
|
| 48 |
+
"exports": {
|
| 49 |
+
"./package.json": "./package.json",
|
| 50 |
+
".": "./src/index.ts"
|
| 51 |
+
}
|
| 52 |
+
},
|
| 53 |
+
"exports": {
|
| 54 |
+
"./package.json": "./package.json",
|
| 55 |
+
".": {
|
| 56 |
+
"import": {
|
| 57 |
+
"types": "./dist/esm/index.d.ts",
|
| 58 |
+
"default": "./dist/esm/index.js"
|
| 59 |
+
},
|
| 60 |
+
"require": {
|
| 61 |
+
"types": "./dist/commonjs/index.d.ts",
|
| 62 |
+
"default": "./dist/commonjs/index.js"
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
},
|
| 66 |
+
"types": "./dist/commonjs/index.d.ts",
|
| 67 |
+
"type": "module",
|
| 68 |
+
"prettier": {
|
| 69 |
+
"semi": false,
|
| 70 |
+
"printWidth": 75,
|
| 71 |
+
"tabWidth": 2,
|
| 72 |
+
"useTabs": false,
|
| 73 |
+
"singleQuote": true,
|
| 74 |
+
"jsxSingleQuote": false,
|
| 75 |
+
"bracketSameLine": true,
|
| 76 |
+
"arrowParens": "avoid",
|
| 77 |
+
"endOfLine": "lf"
|
| 78 |
+
},
|
| 79 |
+
"module": "./dist/esm/index.js"
|
| 80 |
+
}
|
tools/ui/node_modules/mode-watcher/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2024 Hunter Johnston <https://github.com/huntabyte>
|
| 4 |
+
Copyright (c) 2024 Svecosystem <https://github.com/svecosystem>
|
| 5 |
+
|
| 6 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 7 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 8 |
+
in the Software without restriction, including without limitation the rights
|
| 9 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 10 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 11 |
+
furnished to do so, subject to the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be included in all
|
| 14 |
+
copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 17 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 18 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 19 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 20 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 21 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 22 |
+
SOF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
|
|
|
|
| 1 |
+
# Mode Watcher
|
| 2 |
+
|
| 3 |
+
Simple utilities to manage light & dark mode in your SvelteKit app.
|
| 4 |
+
|
| 5 |
+
<!-- automd:badges license name="mode-watcher" color="yellow" github="svecosystem/mode-watcher" -->
|
| 6 |
+
|
| 7 |
+
[](https://npmjs.com/package/mode-watcher)
|
| 8 |
+
[](https://npmjs.com/package/mode-watcher)
|
| 9 |
+
[](https://github.com/svecosystem/mode-watcher/blob/main/LICENSE)
|
| 10 |
+
|
| 11 |
+
<!-- /automd -->
|
| 12 |
+
|
| 13 |
+
[](https://discord.gg/fdXy3Sk8Gq)
|
| 14 |
+
|
| 15 |
+
## Installation
|
| 16 |
+
|
| 17 |
+
```bash
|
| 18 |
+
npm install mode-watcher
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
## Usage
|
| 22 |
+
|
| 23 |
+
Add the `ModeWatcher` component to your root `+layout.svelte` file.
|
| 24 |
+
|
| 25 |
+
```svelte
|
| 26 |
+
<script lang="ts">
|
| 27 |
+
import { ModeWatcher } from "mode-watcher";
|
| 28 |
+
let { children } = $props();
|
| 29 |
+
</script>
|
| 30 |
+
|
| 31 |
+
<ModeWatcher />
|
| 32 |
+
{@render children()}
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
The `ModeWatcher` component will automatically detect the user's preferences and apply/remove the `"dark"` class, along with the corresponding `color-scheme` style attribute to the `html` element.
|
| 36 |
+
|
| 37 |
+
`ModeWatcher` will automatically track operating system preferences and apply these if no user preference is set. If you wish to disable this behavior, set the `track` prop to `false`:
|
| 38 |
+
|
| 39 |
+
```svelte
|
| 40 |
+
<ModeWatcher track={false} />
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
`ModeWatcher` can also be configured with a default mode instead of automatically detecting the user's preference.
|
| 44 |
+
|
| 45 |
+
To set a default mode, use the `defaultMode` prop:
|
| 46 |
+
|
| 47 |
+
```svelte
|
| 48 |
+
<ModeWatcher defaultMode={"dark"}>
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
`ModeWatcher` can manage the `theme-color` meta tag for you.
|
| 52 |
+
|
| 53 |
+
To enable this, set the `themeColors` prop to your preferred colors:
|
| 54 |
+
|
| 55 |
+
```svelte
|
| 56 |
+
<ModeWatcher themeColors={{ dark: "black", light: "white" }}>
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## API
|
| 60 |
+
|
| 61 |
+
### toggleMode
|
| 62 |
+
|
| 63 |
+
A function that toggles the current mode.
|
| 64 |
+
|
| 65 |
+
```svelte
|
| 66 |
+
<script lang="ts">
|
| 67 |
+
import { toggleMode } from "mode-watcher";
|
| 68 |
+
</script>
|
| 69 |
+
|
| 70 |
+
<button onclick={toggleMode}>Toggle Mode</button>
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
### setMode
|
| 74 |
+
|
| 75 |
+
A function that sets the current mode. It accepts a string with the value `"light"`, `"dark"` or `"system"`.
|
| 76 |
+
|
| 77 |
+
```svelte
|
| 78 |
+
<script lang="ts">
|
| 79 |
+
import { setMode } from "mode-watcher";
|
| 80 |
+
</script>
|
| 81 |
+
|
| 82 |
+
<button onclick={() => setMode("light")}>Set Light Mode</button>
|
| 83 |
+
<button onclick={() => setMode("dark")}>Set Dark Mode</button>
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
### resetMode
|
| 87 |
+
|
| 88 |
+
A function that resets the mode to system preferences.
|
| 89 |
+
|
| 90 |
+
```svelte
|
| 91 |
+
<script lang="ts">
|
| 92 |
+
import { resetMode } from "mode-watcher";
|
| 93 |
+
</script>
|
| 94 |
+
|
| 95 |
+
<button onclick={resetMode}>System</button>
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
### mode
|
| 99 |
+
|
| 100 |
+
A readable store that contains the current mode. It can be `"light"` or `"dark"` or `undefined` if evaluated on the server.
|
| 101 |
+
|
| 102 |
+
```svelte
|
| 103 |
+
<script lang="ts">
|
| 104 |
+
import { setMode, mode } from "mode-watcher";
|
| 105 |
+
|
| 106 |
+
function handleModeChange() {
|
| 107 |
+
if (mode.current === "light") {
|
| 108 |
+
setMode("dark");
|
| 109 |
+
} else {
|
| 110 |
+
setMode("light");
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
</script>
|
| 114 |
+
|
| 115 |
+
<button onclick={handleModeChange}>{mode.current}</button>
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
### userPrefersMode
|
| 119 |
+
|
| 120 |
+
A writeable store that represents the user's mode preference. It can be `"light"`, `"dark"` or `"system"`.
|
| 121 |
+
|
| 122 |
+
### systemPrefersMode
|
| 123 |
+
|
| 124 |
+
A readable store that represents the operating system's mode preference. It can be `"light"`, `"dark"` or `undefined` if evaluated on the server. Will automatically track changes to the operating system's mode preference unless this is disabled with the `tracking()` method which takes a boolean. Normally this is disabled by setting the `track` prop to false in the `<ModeWatcher>` component.
|
| 125 |
+
|
| 126 |
+
## Demo / Reproduction Template
|
| 127 |
+
|
| 128 |
+
[](https://stackblitz.com/github/svecosystem/mode-watcher-reproduction)
|
| 129 |
+
|
| 130 |
+
## Sponsors
|
| 131 |
+
|
| 132 |
+
This project is supported by the following beautiful people/organizations:
|
| 133 |
+
|
| 134 |
+
<p align="center">
|
| 135 |
+
<a href="https://github.com/sponsors/huntabyte">
|
| 136 |
+
<img src='https://github.com/huntabyte/static/blob/main/sponsors.svg?raw=true' alt="Logos from Sponsors" />
|
| 137 |
+
</a>
|
| 138 |
+
</p>
|
| 139 |
+
|
| 140 |
+
## License
|
| 141 |
+
|
| 142 |
+
<!-- automd:contributors license=MIT author="huntabyte" github="svecosystem/mode-watcher" -->
|
| 143 |
+
|
| 144 |
+
Published under the [MIT](https://github.com/svecosystem/mode-watcher/blob/main/LICENSE) license.
|
| 145 |
+
Made by [@huntabyte](https://github.com/huntabyte), [@ollema](https://github.com/ollema), and [community](https://github.com/svecosystem/mode-watcher/graphs/contributors) 💛
|
| 146 |
+
<br><br>
|
| 147 |
+
<a href="https://github.com/svecosystem/mode-watcher/graphs/contributors">
|
| 148 |
+
<img src="https://contrib.rocks/image?repo=svecosystem/mode-watcher" />
|
| 149 |
+
</a>
|
| 150 |
+
|
| 151 |
+
<!-- /automd -->
|
| 152 |
+
|
| 153 |
+
## Community
|
| 154 |
+
|
| 155 |
+
Join the Discord server to ask questions, find collaborators, or just say hi!
|
| 156 |
+
|
| 157 |
+
<a href="https://discord.gg/fdXy3Sk8Gq" alt="Svecosystem Discord community">
|
| 158 |
+
<picture>
|
| 159 |
+
<source media="(prefers-color-scheme: dark)" srcset="https://invidget.switchblade.xyz/fdXy3Sk8Gq">
|
| 160 |
+
<img alt="Svecosystem Discord community" src="https://invidget.switchblade.xyz/fdXy3Sk8Gq?theme=light">
|
| 161 |
+
</picture>
|
| 162 |
+
</a>
|
tools/ui/node_modules/mode-watcher/dist/components/mode-watcher-full.svelte
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import { setInitialMode } from "../mode.js";
|
| 3 |
+
import type { ThemeColors } from "../types.js";
|
| 4 |
+
|
| 5 |
+
let {
|
| 6 |
+
trueNonce = "",
|
| 7 |
+
initConfig,
|
| 8 |
+
themeColors,
|
| 9 |
+
}: {
|
| 10 |
+
trueNonce: string;
|
| 11 |
+
initConfig: Parameters<typeof setInitialMode>[0];
|
| 12 |
+
themeColors: ThemeColors;
|
| 13 |
+
} = $props();
|
| 14 |
+
</script>
|
| 15 |
+
|
| 16 |
+
<svelte:head>
|
| 17 |
+
{#if themeColors}
|
| 18 |
+
<!-- default to dark mode for to allow testing -->
|
| 19 |
+
<!-- this will be overwritten by FOUC prevention snippet below -->
|
| 20 |
+
<!-- but that snippet does not run in vitest -->
|
| 21 |
+
<meta name="theme-color" content={themeColors.dark} />
|
| 22 |
+
{/if}
|
| 23 |
+
<!-- eslint-disable-next-line svelte/no-at-html-tags, prefer-template, svelte/no-unused-svelte-ignore --><!-- svelte-ignore hydration_html_changed -->
|
| 24 |
+
{@html `<script${trueNonce ? ` nonce=${trueNonce}` : ""}>(` +
|
| 25 |
+
setInitialMode.toString() +
|
| 26 |
+
`)(` +
|
| 27 |
+
JSON.stringify(initConfig) +
|
| 28 |
+
`);</script>`}
|
| 29 |
+
</svelte:head>
|
tools/ui/node_modules/mode-watcher/dist/components/mode-watcher-full.svelte.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { setInitialMode } from "../mode.js";
|
| 2 |
+
import type { ThemeColors } from "../types.js";
|
| 3 |
+
type $$ComponentProps = {
|
| 4 |
+
trueNonce: string;
|
| 5 |
+
initConfig: Parameters<typeof setInitialMode>[0];
|
| 6 |
+
themeColors: ThemeColors;
|
| 7 |
+
};
|
| 8 |
+
declare const ModeWatcherFull: import("svelte").Component<$$ComponentProps, {}, "">;
|
| 9 |
+
type ModeWatcherFull = ReturnType<typeof ModeWatcherFull>;
|
| 10 |
+
export default ModeWatcherFull;
|
tools/ui/node_modules/mode-watcher/dist/components/mode-watcher-lite.svelte
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import type { ThemeColors } from "../types.js";
|
| 3 |
+
|
| 4 |
+
let { themeColors }: { themeColors: ThemeColors } = $props();
|
| 5 |
+
</script>
|
| 6 |
+
|
| 7 |
+
{#if themeColors}
|
| 8 |
+
<!-- default to dark mode for to allow testing -->
|
| 9 |
+
<!-- this will be overwritten by FOUC prevention snippet below -->
|
| 10 |
+
<!-- but that snippet does not run in vitest -->
|
| 11 |
+
<meta name="theme-color" content={themeColors.dark} />
|
| 12 |
+
{/if}
|
tools/ui/node_modules/mode-watcher/dist/components/mode-watcher-lite.svelte.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ThemeColors } from "../types.js";
|
| 2 |
+
type $$ComponentProps = {
|
| 3 |
+
themeColors: ThemeColors;
|
| 4 |
+
};
|
| 5 |
+
declare const ModeWatcherLite: import("svelte").Component<$$ComponentProps, {}, "">;
|
| 6 |
+
type ModeWatcherLite = ReturnType<typeof ModeWatcherLite>;
|
| 7 |
+
export default ModeWatcherLite;
|
tools/ui/node_modules/mode-watcher/dist/components/mode-watcher.svelte
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import { onMount } from "svelte";
|
| 3 |
+
import ModeWatcherLite from "./mode-watcher-lite.svelte";
|
| 4 |
+
import ModeWatcherFull from "./mode-watcher-full.svelte";
|
| 5 |
+
import { modeStorageKey, themeStorageKey } from "../storage-keys.svelte.js";
|
| 6 |
+
import {
|
| 7 |
+
darkClassNames,
|
| 8 |
+
disableTransitions,
|
| 9 |
+
lightClassNames,
|
| 10 |
+
mode,
|
| 11 |
+
synchronousModeChanges,
|
| 12 |
+
theme,
|
| 13 |
+
themeColors,
|
| 14 |
+
} from "../states.svelte.js";
|
| 15 |
+
import type { ModeWatcherProps } from "../types.js";
|
| 16 |
+
import { isValidMode } from "../modes.js";
|
| 17 |
+
import { defineConfig, setMode, setTheme } from "../mode.js";
|
| 18 |
+
import { systemPrefersMode } from "../mode-states.svelte.js";
|
| 19 |
+
|
| 20 |
+
let {
|
| 21 |
+
track = true,
|
| 22 |
+
defaultMode = "system",
|
| 23 |
+
themeColors: themeColorsProp,
|
| 24 |
+
disableTransitions: disableTransitionsProp = true,
|
| 25 |
+
darkClassNames: darkClassNamesProp = ["dark"],
|
| 26 |
+
lightClassNames: lightClassNamesProp = [],
|
| 27 |
+
defaultTheme = "",
|
| 28 |
+
nonce = "",
|
| 29 |
+
themeStorageKey: themeStorageKeyProp = "mode-watcher-theme",
|
| 30 |
+
modeStorageKey: modeStorageKeyProp = "mode-watcher-mode",
|
| 31 |
+
disableHeadScriptInjection = false,
|
| 32 |
+
synchronousModeChanges: synchronousModeChangesProp = false,
|
| 33 |
+
}: ModeWatcherProps = $props();
|
| 34 |
+
|
| 35 |
+
modeStorageKey.current = modeStorageKeyProp;
|
| 36 |
+
themeStorageKey.current = themeStorageKeyProp;
|
| 37 |
+
darkClassNames.current = darkClassNamesProp;
|
| 38 |
+
lightClassNames.current = lightClassNamesProp;
|
| 39 |
+
disableTransitions.current = disableTransitionsProp;
|
| 40 |
+
themeColors.current = themeColorsProp;
|
| 41 |
+
synchronousModeChanges.current = synchronousModeChangesProp;
|
| 42 |
+
|
| 43 |
+
$effect.pre(() => {
|
| 44 |
+
synchronousModeChanges.current = synchronousModeChangesProp;
|
| 45 |
+
});
|
| 46 |
+
|
| 47 |
+
$effect.pre(() => {
|
| 48 |
+
disableTransitions.current = disableTransitionsProp;
|
| 49 |
+
});
|
| 50 |
+
|
| 51 |
+
$effect.pre(() => {
|
| 52 |
+
themeColors.current = themeColorsProp;
|
| 53 |
+
});
|
| 54 |
+
|
| 55 |
+
$effect.pre(() => {
|
| 56 |
+
darkClassNames.current = darkClassNamesProp;
|
| 57 |
+
});
|
| 58 |
+
|
| 59 |
+
$effect.pre(() => {
|
| 60 |
+
lightClassNames.current = lightClassNamesProp;
|
| 61 |
+
});
|
| 62 |
+
|
| 63 |
+
$effect.pre(() => {
|
| 64 |
+
modeStorageKey.current = modeStorageKeyProp;
|
| 65 |
+
});
|
| 66 |
+
|
| 67 |
+
$effect.pre(() => {
|
| 68 |
+
themeStorageKey.current = themeStorageKeyProp;
|
| 69 |
+
});
|
| 70 |
+
|
| 71 |
+
$effect.pre(() => {
|
| 72 |
+
mode.current;
|
| 73 |
+
modeStorageKey.current;
|
| 74 |
+
themeStorageKey.current;
|
| 75 |
+
theme.current;
|
| 76 |
+
});
|
| 77 |
+
|
| 78 |
+
onMount(() => {
|
| 79 |
+
systemPrefersMode.tracking(track);
|
| 80 |
+
systemPrefersMode.query();
|
| 81 |
+
const localStorageMode = localStorage.getItem(modeStorageKey.current);
|
| 82 |
+
setMode(isValidMode(localStorageMode) ? localStorageMode : defaultMode);
|
| 83 |
+
const localStorageTheme = localStorage.getItem(themeStorageKey.current);
|
| 84 |
+
setTheme(localStorageTheme || defaultTheme);
|
| 85 |
+
});
|
| 86 |
+
|
| 87 |
+
const initConfig = defineConfig({
|
| 88 |
+
defaultMode,
|
| 89 |
+
themeColors: themeColorsProp,
|
| 90 |
+
darkClassNames: darkClassNamesProp,
|
| 91 |
+
lightClassNames: lightClassNamesProp,
|
| 92 |
+
defaultTheme,
|
| 93 |
+
modeStorageKey: modeStorageKeyProp,
|
| 94 |
+
themeStorageKey: themeStorageKeyProp,
|
| 95 |
+
});
|
| 96 |
+
|
| 97 |
+
const trueNonce = $derived(typeof window === "undefined" ? nonce : "");
|
| 98 |
+
</script>
|
| 99 |
+
|
| 100 |
+
{#if disableHeadScriptInjection}
|
| 101 |
+
<ModeWatcherLite themeColors={themeColors.current} />
|
| 102 |
+
{:else}
|
| 103 |
+
<ModeWatcherFull {trueNonce} {initConfig} themeColors={themeColors.current} />
|
| 104 |
+
{/if}
|
tools/ui/node_modules/mode-watcher/dist/components/mode-watcher.svelte.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ModeWatcherProps } from "../types.js";
|
| 2 |
+
declare const ModeWatcher: import("svelte").Component<ModeWatcherProps, {}, "">;
|
| 3 |
+
type ModeWatcher = ReturnType<typeof ModeWatcher>;
|
| 4 |
+
export default ModeWatcher;
|
tools/ui/node_modules/mode-watcher/dist/components/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export {};
|
tools/ui/node_modules/mode-watcher/dist/components/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
tools/ui/node_modules/mode-watcher/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { generateSetInitialModeExpression, createInitialModeExpression, resetMode, setMode, setTheme, toggleMode } from "./mode.js";
|
| 2 |
+
import { modeStorageKey, themeStorageKey } from "./storage-keys.svelte.js";
|
| 3 |
+
import { mode, theme } from "./states.svelte.js";
|
| 4 |
+
import { userPrefersMode, systemPrefersMode } from "./mode-states.svelte.js";
|
| 5 |
+
export { generateSetInitialModeExpression, createInitialModeExpression, setMode, toggleMode, resetMode, modeStorageKey, userPrefersMode, systemPrefersMode, mode, theme, setTheme, themeStorageKey, };
|
| 6 |
+
export type { SystemModeValue, UserPrefersMode, SystemPrefersMode } from "./mode-states.svelte.js";
|
| 7 |
+
export { default as ModeWatcher } from "./components/mode-watcher.svelte";
|
tools/ui/node_modules/mode-watcher/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { generateSetInitialModeExpression, createInitialModeExpression, resetMode, setMode, setTheme, toggleMode, } from "./mode.js";
|
| 2 |
+
import { modeStorageKey, themeStorageKey } from "./storage-keys.svelte.js";
|
| 3 |
+
import { mode, theme } from "./states.svelte.js";
|
| 4 |
+
import { userPrefersMode, systemPrefersMode } from "./mode-states.svelte.js";
|
| 5 |
+
export { generateSetInitialModeExpression, createInitialModeExpression, setMode, toggleMode, resetMode, modeStorageKey, userPrefersMode, systemPrefersMode, mode, theme, setTheme, themeStorageKey, };
|
| 6 |
+
export { default as ModeWatcher } from "./components/mode-watcher.svelte";
|
tools/ui/node_modules/mode-watcher/dist/mode-states.svelte.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { Mode } from "./types.js";
|
| 2 |
+
export declare class UserPrefersMode {
|
| 3 |
+
#private;
|
| 4 |
+
constructor();
|
| 5 |
+
get current(): Mode;
|
| 6 |
+
set current(newValue: Mode);
|
| 7 |
+
}
|
| 8 |
+
export type SystemModeValue = "light" | "dark" | undefined;
|
| 9 |
+
export declare class SystemPrefersMode {
|
| 10 |
+
#private;
|
| 11 |
+
query(): void;
|
| 12 |
+
tracking(active: boolean): void;
|
| 13 |
+
constructor();
|
| 14 |
+
get current(): SystemModeValue;
|
| 15 |
+
}
|
| 16 |
+
/**
|
| 17 |
+
* Writable state that represents the user's preferred mode
|
| 18 |
+
* (`"dark"`, `"light"` or `"system"`)
|
| 19 |
+
*/
|
| 20 |
+
export declare const userPrefersMode: UserPrefersMode;
|
| 21 |
+
/**
|
| 22 |
+
* Readable store that represents the system's preferred mode (`"dark"`, `"light"` or `undefined`)
|
| 23 |
+
*/
|
| 24 |
+
export declare const systemPrefersMode: SystemPrefersMode;
|
tools/ui/node_modules/mode-watcher/dist/mode-states.svelte.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { PersistedState, watch } from "runed";
|
| 2 |
+
import { isBrowser, noopStorage } from "./utils.js";
|
| 3 |
+
import { modeStorageKey } from "./storage-keys.svelte.js";
|
| 4 |
+
import { isValidMode } from "./modes.js";
|
| 5 |
+
import { MediaQuery } from "svelte/reactivity";
|
| 6 |
+
export class UserPrefersMode {
|
| 7 |
+
#defaultValue = "system";
|
| 8 |
+
#storage = isBrowser ? localStorage : noopStorage;
|
| 9 |
+
#initialValue = this.#storage.getItem(modeStorageKey.current);
|
| 10 |
+
#value = isValidMode(this.#initialValue) ? this.#initialValue : this.#defaultValue;
|
| 11 |
+
#persisted = $state(this.#makePersisted());
|
| 12 |
+
#makePersisted(value = this.#value) {
|
| 13 |
+
return new PersistedState(modeStorageKey.current, value, {
|
| 14 |
+
serializer: {
|
| 15 |
+
serialize: (v) => v,
|
| 16 |
+
deserialize: (v) => {
|
| 17 |
+
if (isValidMode(v))
|
| 18 |
+
return v;
|
| 19 |
+
return this.#defaultValue;
|
| 20 |
+
},
|
| 21 |
+
},
|
| 22 |
+
});
|
| 23 |
+
}
|
| 24 |
+
constructor() {
|
| 25 |
+
$effect.root(() => {
|
| 26 |
+
return watch.pre(() => modeStorageKey.current, (_, prevStorageKey) => {
|
| 27 |
+
const currModeValue = this.#persisted.current;
|
| 28 |
+
this.#persisted = this.#makePersisted(currModeValue);
|
| 29 |
+
if (prevStorageKey) {
|
| 30 |
+
localStorage.removeItem(prevStorageKey);
|
| 31 |
+
}
|
| 32 |
+
});
|
| 33 |
+
});
|
| 34 |
+
}
|
| 35 |
+
get current() {
|
| 36 |
+
return this.#persisted.current;
|
| 37 |
+
}
|
| 38 |
+
set current(newValue) {
|
| 39 |
+
this.#persisted.current = newValue;
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
export class SystemPrefersMode {
|
| 43 |
+
#defaultValue = undefined;
|
| 44 |
+
#track = true;
|
| 45 |
+
#current = $state(this.#defaultValue);
|
| 46 |
+
#mediaQueryState = typeof window !== "undefined" && typeof window.matchMedia === "function"
|
| 47 |
+
? new MediaQuery("prefers-color-scheme: light")
|
| 48 |
+
: { current: false };
|
| 49 |
+
query() {
|
| 50 |
+
if (!isBrowser)
|
| 51 |
+
return;
|
| 52 |
+
this.#current = this.#mediaQueryState.current ? "light" : "dark";
|
| 53 |
+
}
|
| 54 |
+
tracking(active) {
|
| 55 |
+
this.#track = active;
|
| 56 |
+
}
|
| 57 |
+
constructor() {
|
| 58 |
+
$effect.root(() => {
|
| 59 |
+
$effect.pre(() => {
|
| 60 |
+
if (!this.#track)
|
| 61 |
+
return;
|
| 62 |
+
this.query();
|
| 63 |
+
});
|
| 64 |
+
});
|
| 65 |
+
this.query = this.query.bind(this);
|
| 66 |
+
this.tracking = this.tracking.bind(this);
|
| 67 |
+
}
|
| 68 |
+
get current() {
|
| 69 |
+
return this.#current;
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
/**
|
| 73 |
+
* Writable state that represents the user's preferred mode
|
| 74 |
+
* (`"dark"`, `"light"` or `"system"`)
|
| 75 |
+
*/
|
| 76 |
+
export const userPrefersMode = new UserPrefersMode();
|
| 77 |
+
/**
|
| 78 |
+
* Readable store that represents the system's preferred mode (`"dark"`, `"light"` or `undefined`)
|
| 79 |
+
*/
|
| 80 |
+
export const systemPrefersMode = new SystemPrefersMode();
|
tools/ui/node_modules/mode-watcher/dist/mode.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { Mode, ThemeColors } from "./types.js";
|
| 2 |
+
/** Toggle between light and dark mode */
|
| 3 |
+
export declare function toggleMode(): void;
|
| 4 |
+
/** Set the mode to light or dark */
|
| 5 |
+
export declare function setMode(mode: Mode): void;
|
| 6 |
+
/** Reset the mode to operating system preference */
|
| 7 |
+
export declare function resetMode(): void;
|
| 8 |
+
/** Set the theme to a custom value */
|
| 9 |
+
export declare function setTheme(newTheme: string): void;
|
| 10 |
+
export declare function defineConfig(config: SetInitialModeArgs): SetInitialModeArgs;
|
| 11 |
+
type SetInitialModeArgs = {
|
| 12 |
+
defaultMode?: Mode;
|
| 13 |
+
themeColors?: ThemeColors;
|
| 14 |
+
darkClassNames?: string[];
|
| 15 |
+
lightClassNames?: string[];
|
| 16 |
+
defaultTheme?: string;
|
| 17 |
+
modeStorageKey?: string;
|
| 18 |
+
themeStorageKey?: string;
|
| 19 |
+
};
|
| 20 |
+
/** Used to set the mode on initial page load to prevent FOUC */
|
| 21 |
+
export declare function setInitialMode({ defaultMode, themeColors, darkClassNames, lightClassNames, defaultTheme, modeStorageKey, themeStorageKey, }: SetInitialModeArgs): void;
|
| 22 |
+
/**
|
| 23 |
+
* A type-safe way to generate the source expression used to set the initial mode and avoid FOUC.
|
| 24 |
+
*/
|
| 25 |
+
export declare function createInitialModeExpression(config?: SetInitialModeArgs): string;
|
| 26 |
+
/**
|
| 27 |
+
* A type-safe way to generate the source expression used to set the initial mode and avoid FOUC.
|
| 28 |
+
*
|
| 29 |
+
* @deprecated Use `createInitialModeExpression` instead.
|
| 30 |
+
*/
|
| 31 |
+
export declare const generateSetInitialModeExpression: typeof createInitialModeExpression;
|
| 32 |
+
export {};
|
tools/ui/node_modules/mode-watcher/dist/mode.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { userPrefersMode } from "./mode-states.svelte.js";
|
| 2 |
+
import { customTheme } from "./theme-state.svelte.js";
|
| 3 |
+
import { derivedMode } from "./states.svelte.js";
|
| 4 |
+
/** Toggle between light and dark mode */
|
| 5 |
+
export function toggleMode() {
|
| 6 |
+
userPrefersMode.current = derivedMode.current === "dark" ? "light" : "dark";
|
| 7 |
+
}
|
| 8 |
+
/** Set the mode to light or dark */
|
| 9 |
+
export function setMode(mode) {
|
| 10 |
+
userPrefersMode.current = mode;
|
| 11 |
+
}
|
| 12 |
+
/** Reset the mode to operating system preference */
|
| 13 |
+
export function resetMode() {
|
| 14 |
+
userPrefersMode.current = "system";
|
| 15 |
+
}
|
| 16 |
+
/** Set the theme to a custom value */
|
| 17 |
+
export function setTheme(newTheme) {
|
| 18 |
+
customTheme.current = newTheme;
|
| 19 |
+
}
|
| 20 |
+
export function defineConfig(config) {
|
| 21 |
+
return config;
|
| 22 |
+
}
|
| 23 |
+
/** Used to set the mode on initial page load to prevent FOUC */
|
| 24 |
+
export function setInitialMode({ defaultMode = "system", themeColors, darkClassNames = ["dark"], lightClassNames = [], defaultTheme = "", modeStorageKey = "mode-watcher-mode", themeStorageKey = "mode-watcher-theme", }) {
|
| 25 |
+
const rootEl = document.documentElement;
|
| 26 |
+
const mode = localStorage.getItem(modeStorageKey) ?? defaultMode;
|
| 27 |
+
const theme = localStorage.getItem(themeStorageKey) ?? defaultTheme;
|
| 28 |
+
const light = mode === "light" ||
|
| 29 |
+
(mode === "system" && window.matchMedia("(prefers-color-scheme: light)").matches);
|
| 30 |
+
if (light) {
|
| 31 |
+
if (darkClassNames.length)
|
| 32 |
+
rootEl.classList.remove(...darkClassNames.filter(Boolean));
|
| 33 |
+
if (lightClassNames.length)
|
| 34 |
+
rootEl.classList.add(...lightClassNames.filter(Boolean));
|
| 35 |
+
}
|
| 36 |
+
else {
|
| 37 |
+
if (lightClassNames.length)
|
| 38 |
+
rootEl.classList.remove(...lightClassNames.filter(Boolean));
|
| 39 |
+
if (darkClassNames.length)
|
| 40 |
+
rootEl.classList.add(...darkClassNames.filter(Boolean));
|
| 41 |
+
}
|
| 42 |
+
rootEl.style.colorScheme = light ? "light" : "dark";
|
| 43 |
+
if (themeColors) {
|
| 44 |
+
const themeMetaEl = document.querySelector('meta[name="theme-color"]');
|
| 45 |
+
if (themeMetaEl) {
|
| 46 |
+
themeMetaEl.setAttribute("content", mode === "light" ? themeColors.light : themeColors.dark);
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
if (theme) {
|
| 50 |
+
rootEl.setAttribute("data-theme", theme);
|
| 51 |
+
localStorage.setItem(themeStorageKey, theme);
|
| 52 |
+
}
|
| 53 |
+
localStorage.setItem(modeStorageKey, mode);
|
| 54 |
+
}
|
| 55 |
+
/**
|
| 56 |
+
* A type-safe way to generate the source expression used to set the initial mode and avoid FOUC.
|
| 57 |
+
*/
|
| 58 |
+
export function createInitialModeExpression(config = {}) {
|
| 59 |
+
return `(${setInitialMode.toString()})(${JSON.stringify(config)});`;
|
| 60 |
+
}
|
| 61 |
+
/**
|
| 62 |
+
* A type-safe way to generate the source expression used to set the initial mode and avoid FOUC.
|
| 63 |
+
*
|
| 64 |
+
* @deprecated Use `createInitialModeExpression` instead.
|
| 65 |
+
*/
|
| 66 |
+
export const generateSetInitialModeExpression = createInitialModeExpression;
|
tools/ui/node_modules/mode-watcher/dist/modes.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { Mode } from "./types.js";
|
| 2 |
+
/**
|
| 3 |
+
* the modes that are supported, used for validation & type
|
| 4 |
+
* derivation
|
| 5 |
+
*/
|
| 6 |
+
export declare const modes: readonly ["dark", "light", "system"];
|
| 7 |
+
export declare function isValidMode(value: unknown): value is Mode;
|
tools/ui/node_modules/mode-watcher/dist/modes.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* the modes that are supported, used for validation & type
|
| 3 |
+
* derivation
|
| 4 |
+
*/
|
| 5 |
+
export const modes = ["dark", "light", "system"];
|
| 6 |
+
export function isValidMode(value) {
|
| 7 |
+
if (typeof value !== "string")
|
| 8 |
+
return false;
|
| 9 |
+
return modes.includes(value);
|
| 10 |
+
}
|
tools/ui/node_modules/mode-watcher/dist/states.svelte.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ThemeColors } from "./types.js";
|
| 2 |
+
/**
|
| 3 |
+
* Theme colors for light and dark modes.
|
| 4 |
+
*/
|
| 5 |
+
export declare const themeColors: import("svelte-toolbelt").WritableBox<ThemeColors>;
|
| 6 |
+
/**
|
| 7 |
+
* Whether to disable transitions when changing the mode.
|
| 8 |
+
*/
|
| 9 |
+
export declare const disableTransitions: import("svelte-toolbelt").WritableBox<boolean>;
|
| 10 |
+
/**
|
| 11 |
+
* Whether to run the mode changes synchronously instead of using
|
| 12 |
+
* an animation frame. If true, will have an impact on blocking performance
|
| 13 |
+
* due to blocking the main thread.
|
| 14 |
+
*/
|
| 15 |
+
export declare const synchronousModeChanges: import("svelte-toolbelt").WritableBox<boolean>;
|
| 16 |
+
/**
|
| 17 |
+
* The classnames to add to the root `html` element when the mode is dark.
|
| 18 |
+
*/
|
| 19 |
+
export declare const darkClassNames: import("svelte-toolbelt").WritableBox<string[]>;
|
| 20 |
+
/**
|
| 21 |
+
* The classnames to add to the root `html` element when the mode is light.
|
| 22 |
+
*/
|
| 23 |
+
export declare const lightClassNames: import("svelte-toolbelt").WritableBox<string[]>;
|
| 24 |
+
/**
|
| 25 |
+
* Derived store that represents the current mode (`"dark"`, `"light"` or `undefined`)
|
| 26 |
+
*/
|
| 27 |
+
export declare const derivedMode: {
|
| 28 |
+
readonly current: import("./mode-states.svelte.js").SystemModeValue;
|
| 29 |
+
};
|
| 30 |
+
/**
|
| 31 |
+
* Derived store that represents the current custom theme
|
| 32 |
+
*/
|
| 33 |
+
export declare const derivedTheme: {
|
| 34 |
+
readonly current: string | undefined;
|
| 35 |
+
};
|
| 36 |
+
export { derivedMode as mode, derivedTheme as theme };
|
tools/ui/node_modules/mode-watcher/dist/states.svelte.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { box } from "svelte-toolbelt";
|
| 2 |
+
import { isBrowser, sanitizeClassNames } from "./utils.js";
|
| 3 |
+
import { withoutTransition } from "./without-transition.js";
|
| 4 |
+
import { systemPrefersMode, userPrefersMode } from "./mode-states.svelte.js";
|
| 5 |
+
import { customTheme } from "./theme-state.svelte.js";
|
| 6 |
+
import { untrack } from "svelte";
|
| 7 |
+
/**
|
| 8 |
+
* Theme colors for light and dark modes.
|
| 9 |
+
*/
|
| 10 |
+
export const themeColors = box(undefined);
|
| 11 |
+
/**
|
| 12 |
+
* Whether to disable transitions when changing the mode.
|
| 13 |
+
*/
|
| 14 |
+
export const disableTransitions = box(true);
|
| 15 |
+
/**
|
| 16 |
+
* Whether to run the mode changes synchronously instead of using
|
| 17 |
+
* an animation frame. If true, will have an impact on blocking performance
|
| 18 |
+
* due to blocking the main thread.
|
| 19 |
+
*/
|
| 20 |
+
export const synchronousModeChanges = box(false);
|
| 21 |
+
/**
|
| 22 |
+
* The classnames to add to the root `html` element when the mode is dark.
|
| 23 |
+
*/
|
| 24 |
+
export const darkClassNames = box([]);
|
| 25 |
+
/**
|
| 26 |
+
* The classnames to add to the root `html` element when the mode is light.
|
| 27 |
+
*/
|
| 28 |
+
export const lightClassNames = box([]);
|
| 29 |
+
function createDerivedMode() {
|
| 30 |
+
const current = $derived.by(() => {
|
| 31 |
+
if (!isBrowser)
|
| 32 |
+
return undefined;
|
| 33 |
+
const derivedMode = userPrefersMode.current === "system"
|
| 34 |
+
? systemPrefersMode.current
|
| 35 |
+
: userPrefersMode.current;
|
| 36 |
+
const sanitizedDarkClassNames = sanitizeClassNames(darkClassNames.current);
|
| 37 |
+
const sanitizedLightClassNames = sanitizeClassNames(lightClassNames.current);
|
| 38 |
+
function update() {
|
| 39 |
+
const htmlEl = document.documentElement;
|
| 40 |
+
const themeColorEl = document.querySelector('meta[name="theme-color"]');
|
| 41 |
+
if (derivedMode === "light") {
|
| 42 |
+
if (sanitizedDarkClassNames.length)
|
| 43 |
+
htmlEl.classList.remove(...sanitizedDarkClassNames);
|
| 44 |
+
if (sanitizedLightClassNames.length)
|
| 45 |
+
htmlEl.classList.add(...sanitizedLightClassNames);
|
| 46 |
+
htmlEl.style.colorScheme = "light";
|
| 47 |
+
if (themeColorEl && themeColors.current) {
|
| 48 |
+
themeColorEl.setAttribute("content", themeColors.current.light);
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
else {
|
| 52 |
+
if (sanitizedLightClassNames.length)
|
| 53 |
+
htmlEl.classList.remove(...sanitizedLightClassNames);
|
| 54 |
+
if (sanitizedDarkClassNames.length)
|
| 55 |
+
htmlEl.classList.add(...sanitizedDarkClassNames);
|
| 56 |
+
htmlEl.style.colorScheme = "dark";
|
| 57 |
+
if (themeColorEl && themeColors.current) {
|
| 58 |
+
themeColorEl.setAttribute("content", themeColors.current.dark);
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
if (disableTransitions.current) {
|
| 63 |
+
withoutTransition(update, synchronousModeChanges.current);
|
| 64 |
+
}
|
| 65 |
+
else {
|
| 66 |
+
update();
|
| 67 |
+
}
|
| 68 |
+
return derivedMode;
|
| 69 |
+
});
|
| 70 |
+
return {
|
| 71 |
+
get current() {
|
| 72 |
+
return current;
|
| 73 |
+
},
|
| 74 |
+
};
|
| 75 |
+
}
|
| 76 |
+
function createDerivedTheme() {
|
| 77 |
+
const current = $derived.by(() => {
|
| 78 |
+
customTheme.current;
|
| 79 |
+
if (!isBrowser)
|
| 80 |
+
return undefined;
|
| 81 |
+
function update() {
|
| 82 |
+
const htmlEl = document.documentElement;
|
| 83 |
+
htmlEl.setAttribute("data-theme", customTheme.current);
|
| 84 |
+
}
|
| 85 |
+
if (disableTransitions.current) {
|
| 86 |
+
withoutTransition(update, untrack(() => synchronousModeChanges.current));
|
| 87 |
+
}
|
| 88 |
+
else {
|
| 89 |
+
update();
|
| 90 |
+
}
|
| 91 |
+
return customTheme.current;
|
| 92 |
+
});
|
| 93 |
+
return {
|
| 94 |
+
get current() {
|
| 95 |
+
return current;
|
| 96 |
+
},
|
| 97 |
+
};
|
| 98 |
+
}
|
| 99 |
+
/**
|
| 100 |
+
* Derived store that represents the current mode (`"dark"`, `"light"` or `undefined`)
|
| 101 |
+
*/
|
| 102 |
+
export const derivedMode = createDerivedMode();
|
| 103 |
+
/**
|
| 104 |
+
* Derived store that represents the current custom theme
|
| 105 |
+
*/
|
| 106 |
+
export const derivedTheme = createDerivedTheme();
|
| 107 |
+
export { derivedMode as mode, derivedTheme as theme };
|
tools/ui/node_modules/mode-watcher/dist/storage-keys.svelte.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* The key used to store the `mode` in localStorage.
|
| 3 |
+
*/
|
| 4 |
+
export declare const modeStorageKey: import("svelte-toolbelt").WritableBox<string>;
|
| 5 |
+
/**
|
| 6 |
+
* The key used to store the `theme` in localStorage.
|
| 7 |
+
*/
|
| 8 |
+
export declare const themeStorageKey: import("svelte-toolbelt").WritableBox<string>;
|
tools/ui/node_modules/mode-watcher/dist/storage-keys.svelte.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { box } from "svelte-toolbelt";
|
| 2 |
+
/**
|
| 3 |
+
* The key used to store the `mode` in localStorage.
|
| 4 |
+
*/
|
| 5 |
+
export const modeStorageKey = box("mode-watcher-mode");
|
| 6 |
+
/**
|
| 7 |
+
* The key used to store the `theme` in localStorage.
|
| 8 |
+
*/
|
| 9 |
+
export const themeStorageKey = box("mode-watcher-theme");
|