aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/@isaacs/fs-minipass
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/@isaacs/fs-minipass')
-rw-r--r--node_modules/@isaacs/fs-minipass/LICENSE15
-rw-r--r--node_modules/@isaacs/fs-minipass/README.md71
-rw-r--r--node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts118
-rw-r--r--node_modules/@isaacs/fs-minipass/dist/commonjs/index.js430
-rw-r--r--node_modules/@isaacs/fs-minipass/dist/commonjs/package.json3
-rw-r--r--node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts118
-rw-r--r--node_modules/@isaacs/fs-minipass/dist/esm/index.js420
-rw-r--r--node_modules/@isaacs/fs-minipass/dist/esm/package.json3
-rw-r--r--node_modules/@isaacs/fs-minipass/package.json72
9 files changed, 1250 insertions, 0 deletions
diff --git a/node_modules/@isaacs/fs-minipass/LICENSE b/node_modules/@isaacs/fs-minipass/LICENSE
new file mode 100644
index 0000000..19129e3
--- /dev/null
+++ b/node_modules/@isaacs/fs-minipass/LICENSE
@@ -0,0 +1,15 @@
+The ISC License
+
+Copyright (c) Isaac Z. Schlueter and Contributors
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/@isaacs/fs-minipass/README.md b/node_modules/@isaacs/fs-minipass/README.md
new file mode 100644
index 0000000..dac96e7
--- /dev/null
+++ b/node_modules/@isaacs/fs-minipass/README.md
@@ -0,0 +1,71 @@
+# fs-minipass
+
+Filesystem streams based on [minipass](http://npm.im/minipass).
+
+4 classes are exported:
+
+- ReadStream
+- ReadStreamSync
+- WriteStream
+- WriteStreamSync
+
+When using `ReadStreamSync`, all of the data is made available
+immediately upon consuming the stream. Nothing is buffered in memory
+when the stream is constructed. If the stream is piped to a writer,
+then it will synchronously `read()` and emit data into the writer as
+fast as the writer can consume it. (That is, it will respect
+backpressure.) If you call `stream.read()` then it will read the
+entire file and return the contents.
+
+When using `WriteStreamSync`, every write is flushed to the file
+synchronously. If your writes all come in a single tick, then it'll
+write it all out in a single tick. It's as synchronous as you are.
+
+The async versions work much like their node builtin counterparts,
+with the exception of introducing significantly less Stream machinery
+overhead.
+
+## USAGE
+
+It's just streams, you pipe them or read() them or write() to them.
+
+```js
+import { ReadStream, WriteStream } from 'fs-minipass'
+// or: const { ReadStream, WriteStream } = require('fs-minipass')
+const readStream = new ReadStream('file.txt')
+const writeStream = new WriteStream('output.txt')
+writeStream.write('some file header or whatever\n')
+readStream.pipe(writeStream)
+```
+
+## ReadStream(path, options)
+
+Path string is required, but somewhat irrelevant if an open file
+descriptor is passed in as an option.
+
+Options:
+
+- `fd` Pass in a numeric file descriptor, if the file is already open.
+- `readSize` The size of reads to do, defaults to 16MB
+- `size` The size of the file, if known. Prevents zero-byte read()
+ call at the end.
+- `autoClose` Set to `false` to prevent the file descriptor from being
+ closed when the file is done being read.
+
+## WriteStream(path, options)
+
+Path string is required, but somewhat irrelevant if an open file
+descriptor is passed in as an option.
+
+Options:
+
+- `fd` Pass in a numeric file descriptor, if the file is already open.
+- `mode` The mode to create the file with. Defaults to `0o666`.
+- `start` The position in the file to start reading. If not
+ specified, then the file will start writing at position zero, and be
+ truncated by default.
+- `autoClose` Set to `false` to prevent the file descriptor from being
+ closed when the stream is ended.
+- `flags` Flags to use when opening the file. Irrelevant if `fd` is
+ passed in, since file won't be opened in that case. Defaults to
+ `'a'` if a `pos` is specified, or `'w'` otherwise.
diff --git a/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts
new file mode 100644
index 0000000..38e8ccd
--- /dev/null
+++ b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts
@@ -0,0 +1,118 @@
+/// <reference types="node" />
+/// <reference types="node" />
+/// <reference types="node" />
+import EE from 'events';
+import { Minipass } from 'minipass';
+declare const _autoClose: unique symbol;
+declare const _close: unique symbol;
+declare const _ended: unique symbol;
+declare const _fd: unique symbol;
+declare const _finished: unique symbol;
+declare const _flags: unique symbol;
+declare const _flush: unique symbol;
+declare const _handleChunk: unique symbol;
+declare const _makeBuf: unique symbol;
+declare const _mode: unique symbol;
+declare const _needDrain: unique symbol;
+declare const _onerror: unique symbol;
+declare const _onopen: unique symbol;
+declare const _onread: unique symbol;
+declare const _onwrite: unique symbol;
+declare const _open: unique symbol;
+declare const _path: unique symbol;
+declare const _pos: unique symbol;
+declare const _queue: unique symbol;
+declare const _read: unique symbol;
+declare const _readSize: unique symbol;
+declare const _reading: unique symbol;
+declare const _remain: unique symbol;
+declare const _size: unique symbol;
+declare const _write: unique symbol;
+declare const _writing: unique symbol;
+declare const _defaultFlag: unique symbol;
+declare const _errored: unique symbol;
+export type ReadStreamOptions = Minipass.Options<Minipass.ContiguousData> & {
+ fd?: number;
+ readSize?: number;
+ size?: number;
+ autoClose?: boolean;
+};
+export type ReadStreamEvents = Minipass.Events<Minipass.ContiguousData> & {
+ open: [fd: number];
+};
+export declare class ReadStream extends Minipass<Minipass.ContiguousData, Buffer, ReadStreamEvents> {
+ [_errored]: boolean;
+ [_fd]?: number;
+ [_path]: string;
+ [_readSize]: number;
+ [_reading]: boolean;
+ [_size]: number;
+ [_remain]: number;
+ [_autoClose]: boolean;
+ constructor(path: string, opt: ReadStreamOptions);
+ get fd(): number | undefined;
+ get path(): string;
+ write(): void;
+ end(): void;
+ [_open](): void;
+ [_onopen](er?: NodeJS.ErrnoException | null, fd?: number): void;
+ [_makeBuf](): Buffer;
+ [_read](): void;
+ [_onread](er?: NodeJS.ErrnoException | null, br?: number, buf?: Buffer): void;
+ [_close](): void;
+ [_onerror](er: NodeJS.ErrnoException): void;
+ [_handleChunk](br: number, buf: Buffer): boolean;
+ emit<Event extends keyof ReadStreamEvents>(ev: Event, ...args: ReadStreamEvents[Event]): boolean;
+}
+export declare class ReadStreamSync extends ReadStream {
+ [_open](): void;
+ [_read](): void;
+ [_close](): void;
+}
+export type WriteStreamOptions = {
+ fd?: number;
+ autoClose?: boolean;
+ mode?: number;
+ captureRejections?: boolean;
+ start?: number;
+ flags?: string;
+};
+export declare class WriteStream extends EE {
+ readable: false;
+ writable: boolean;
+ [_errored]: boolean;
+ [_writing]: boolean;
+ [_ended]: boolean;
+ [_queue]: Buffer[];
+ [_needDrain]: boolean;
+ [_path]: string;
+ [_mode]: number;
+ [_autoClose]: boolean;
+ [_fd]?: number;
+ [_defaultFlag]: boolean;
+ [_flags]: string;
+ [_finished]: boolean;
+ [_pos]?: number;
+ constructor(path: string, opt: WriteStreamOptions);
+ emit(ev: string, ...args: any[]): boolean;
+ get fd(): number | undefined;
+ get path(): string;
+ [_onerror](er: NodeJS.ErrnoException): void;
+ [_open](): void;
+ [_onopen](er?: null | NodeJS.ErrnoException, fd?: number): void;
+ end(buf: string, enc?: BufferEncoding): this;
+ end(buf?: Buffer, enc?: undefined): this;
+ write(buf: string, enc?: BufferEncoding): boolean;
+ write(buf: Buffer, enc?: undefined): boolean;
+ [_write](buf: Buffer): void;
+ [_onwrite](er?: null | NodeJS.ErrnoException, bw?: number): void;
+ [_flush](): void;
+ [_close](): void;
+}
+export declare class WriteStreamSync extends WriteStream {
+ [_open](): void;
+ [_close](): void;
+ [_write](buf: Buffer): void;
+}
+export {};
+//# sourceMappingURL=index.d.ts.map \ No newline at end of file
diff --git a/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js
new file mode 100644
index 0000000..2b3178c
--- /dev/null
+++ b/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js
@@ -0,0 +1,430 @@
+"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.WriteStreamSync = exports.WriteStream = exports.ReadStreamSync = exports.ReadStream = void 0;
+const events_1 = __importDefault(require("events"));
+const fs_1 = __importDefault(require("fs"));
+const minipass_1 = require("minipass");
+const writev = fs_1.default.writev;
+const _autoClose = Symbol('_autoClose');
+const _close = Symbol('_close');
+const _ended = Symbol('_ended');
+const _fd = Symbol('_fd');
+const _finished = Symbol('_finished');
+const _flags = Symbol('_flags');
+const _flush = Symbol('_flush');
+const _handleChunk = Symbol('_handleChunk');
+const _makeBuf = Symbol('_makeBuf');
+const _mode = Symbol('_mode');
+const _needDrain = Symbol('_needDrain');
+const _onerror = Symbol('_onerror');
+const _onopen = Symbol('_onopen');
+const _onread = Symbol('_onread');
+const _onwrite = Symbol('_onwrite');
+const _open = Symbol('_open');
+const _path = Symbol('_path');
+const _pos = Symbol('_pos');
+const _queue = Symbol('_queue');
+const _read = Symbol('_read');
+const _readSize = Symbol('_readSize');
+const _reading = Symbol('_reading');
+const _remain = Symbol('_remain');
+const _size = Symbol('_size');
+const _write = Symbol('_write');
+const _writing = Symbol('_writing');
+const _defaultFlag = Symbol('_defaultFlag');
+const _errored = Symbol('_errored');
+class ReadStream extends minipass_1.Minipass {
+ [_errored] = false;
+ [_fd];
+ [_path];
+ [_readSize];
+ [_reading] = false;
+ [_size];
+ [_remain];
+ [_autoClose];
+ constructor(path, opt) {
+ opt = opt || {};
+ super(opt);
+ this.readable = true;
+ this.writable = false;
+ if (typeof path !== 'string') {
+ throw new TypeError('path must be a string');
+ }
+ this[_errored] = false;
+ this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined;
+ this[_path] = path;
+ this[_readSize] = opt.readSize || 16 * 1024 * 1024;
+ this[_reading] = false;
+ this[_size] = typeof opt.size === 'number' ? opt.size : Infinity;
+ this[_remain] = this[_size];
+ this[_autoClose] =
+ typeof opt.autoClose === 'boolean' ? opt.autoClose : true;
+ if (typeof this[_fd] === 'number') {
+ this[_read]();
+ }
+ else {
+ this[_open]();
+ }
+ }
+ get fd() {
+ return this[_fd];
+ }
+ get path() {
+ return this[_path];
+ }
+ //@ts-ignore
+ write() {
+ throw new TypeError('this is a readable stream');
+ }
+ //@ts-ignore
+ end() {
+ throw new TypeError('this is a readable stream');
+ }
+ [_open]() {
+ fs_1.default.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd));
+ }
+ [_onopen](er, fd) {
+ if (er) {
+ this[_onerror](er);
+ }
+ else {
+ this[_fd] = fd;
+ this.emit('open', fd);
+ this[_read]();
+ }
+ }
+ [_makeBuf]() {
+ return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain]));
+ }
+ [_read]() {
+ if (!this[_reading]) {
+ this[_reading] = true;
+ const buf = this[_makeBuf]();
+ /* c8 ignore start */
+ if (buf.length === 0) {
+ return process.nextTick(() => this[_onread](null, 0, buf));
+ }
+ /* c8 ignore stop */
+ fs_1.default.read(this[_fd], buf, 0, buf.length, null, (er, br, b) => this[_onread](er, br, b));
+ }
+ }
+ [_onread](er, br, buf) {
+ this[_reading] = false;
+ if (er) {
+ this[_onerror](er);
+ }
+ else if (this[_handleChunk](br, buf)) {
+ this[_read]();
+ }
+ }
+ [_close]() {
+ if (this[_autoClose] && typeof this[_fd] === 'number') {
+ const fd = this[_fd];
+ this[_fd] = undefined;
+ fs_1.default.close(fd, er => er ? this.emit('error', er) : this.emit('close'));
+ }
+ }
+ [_onerror](er) {
+ this[_reading] = true;
+ this[_close]();
+ this.emit('error', er);
+ }
+ [_handleChunk](br, buf) {
+ let ret = false;
+ // no effect if infinite
+ this[_remain] -= br;
+ if (br > 0) {
+ ret = super.write(br < buf.length ? buf.subarray(0, br) : buf);
+ }
+ if (br === 0 || this[_remain] <= 0) {
+ ret = false;
+ this[_close]();
+ super.end();
+ }
+ return ret;
+ }
+ emit(ev, ...args) {
+ switch (ev) {
+ case 'prefinish':
+ case 'finish':
+ return false;
+ case 'drain':
+ if (typeof this[_fd] === 'number') {
+ this[_read]();
+ }
+ return false;
+ case 'error':
+ if (this[_errored]) {
+ return false;
+ }
+ this[_errored] = true;
+ return super.emit(ev, ...args);
+ default:
+ return super.emit(ev, ...args);
+ }
+ }
+}
+exports.ReadStream = ReadStream;
+class ReadStreamSync extends ReadStream {
+ [_open]() {
+ let threw = true;
+ try {
+ this[_onopen](null, fs_1.default.openSync(this[_path], 'r'));
+ threw = false;
+ }
+ finally {
+ if (threw) {
+ this[_close]();
+ }
+ }
+ }
+ [_read]() {
+ let threw = true;
+ try {
+ if (!this[_reading]) {
+ this[_reading] = true;
+ do {
+ const buf = this[_makeBuf]();
+ /* c8 ignore start */
+ const br = buf.length === 0
+ ? 0
+ : fs_1.default.readSync(this[_fd], buf, 0, buf.length, null);
+ /* c8 ignore stop */
+ if (!this[_handleChunk](br, buf)) {
+ break;
+ }
+ } while (true);
+ this[_reading] = false;
+ }
+ threw = false;
+ }
+ finally {
+ if (threw) {
+ this[_close]();
+ }
+ }
+ }
+ [_close]() {
+ if (this[_autoClose] && typeof this[_fd] === 'number') {
+ const fd = this[_fd];
+ this[_fd] = undefined;
+ fs_1.default.closeSync(fd);
+ this.emit('close');
+ }
+ }
+}
+exports.ReadStreamSync = ReadStreamSync;
+class WriteStream extends events_1.default {
+ readable = false;
+ writable = true;
+ [_errored] = false;
+ [_writing] = false;
+ [_ended] = false;
+ [_queue] = [];
+ [_needDrain] = false;
+ [_path];
+ [_mode];
+ [_autoClose];
+ [_fd];
+ [_defaultFlag];
+ [_flags];
+ [_finished] = false;
+ [_pos];
+ constructor(path, opt) {
+ opt = opt || {};
+ super(opt);
+ this[_path] = path;
+ this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined;
+ this[_mode] = opt.mode === undefined ? 0o666 : opt.mode;
+ this[_pos] = typeof opt.start === 'number' ? opt.start : undefined;
+ this[_autoClose] =
+ typeof opt.autoClose === 'boolean' ? opt.autoClose : true;
+ // truncating makes no sense when writing into the middle
+ const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w';
+ this[_defaultFlag] = opt.flags === undefined;
+ this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags;
+ if (this[_fd] === undefined) {
+ this[_open]();
+ }
+ }
+ emit(ev, ...args) {
+ if (ev === 'error') {
+ if (this[_errored]) {
+ return false;
+ }
+ this[_errored] = true;
+ }
+ return super.emit(ev, ...args);
+ }
+ get fd() {
+ return this[_fd];
+ }
+ get path() {
+ return this[_path];
+ }
+ [_onerror](er) {
+ this[_close]();
+ this[_writing] = true;
+ this.emit('error', er);
+ }
+ [_open]() {
+ fs_1.default.open(this[_path], this[_flags], this[_mode], (er, fd) => this[_onopen](er, fd));
+ }
+ [_onopen](er, fd) {
+ if (this[_defaultFlag] &&
+ this[_flags] === 'r+' &&
+ er &&
+ er.code === 'ENOENT') {
+ this[_flags] = 'w';
+ this[_open]();
+ }
+ else if (er) {
+ this[_onerror](er);
+ }
+ else {
+ this[_fd] = fd;
+ this.emit('open', fd);
+ if (!this[_writing]) {
+ this[_flush]();
+ }
+ }
+ }
+ end(buf, enc) {
+ if (buf) {
+ //@ts-ignore
+ this.write(buf, enc);
+ }
+ this[_ended] = true;
+ // synthetic after-write logic, where drain/finish live
+ if (!this[_writing] &&
+ !this[_queue].length &&
+ typeof this[_fd] === 'number') {
+ this[_onwrite](null, 0);
+ }
+ return this;
+ }
+ write(buf, enc) {
+ if (typeof buf === 'string') {
+ buf = Buffer.from(buf, enc);
+ }
+ if (this[_ended]) {
+ this.emit('error', new Error('write() after end()'));
+ return false;
+ }
+ if (this[_fd] === undefined || this[_writing] || this[_queue].length) {
+ this[_queue].push(buf);
+ this[_needDrain] = true;
+ return false;
+ }
+ this[_writing] = true;
+ this[_write](buf);
+ return true;
+ }
+ [_write](buf) {
+ fs_1.default.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) => this[_onwrite](er, bw));
+ }
+ [_onwrite](er, bw) {
+ if (er) {
+ this[_onerror](er);
+ }
+ else {
+ if (this[_pos] !== undefined && typeof bw === 'number') {
+ this[_pos] += bw;
+ }
+ if (this[_queue].length) {
+ this[_flush]();
+ }
+ else {
+ this[_writing] = false;
+ if (this[_ended] && !this[_finished]) {
+ this[_finished] = true;
+ this[_close]();
+ this.emit('finish');
+ }
+ else if (this[_needDrain]) {
+ this[_needDrain] = false;
+ this.emit('drain');
+ }
+ }
+ }
+ }
+ [_flush]() {
+ if (this[_queue].length === 0) {
+ if (this[_ended]) {
+ this[_onwrite](null, 0);
+ }
+ }
+ else if (this[_queue].length === 1) {
+ this[_write](this[_queue].pop());
+ }
+ else {
+ const iovec = this[_queue];
+ this[_queue] = [];
+ writev(this[_fd], iovec, this[_pos], (er, bw) => this[_onwrite](er, bw));
+ }
+ }
+ [_close]() {
+ if (this[_autoClose] && typeof this[_fd] === 'number') {
+ const fd = this[_fd];
+ this[_fd] = undefined;
+ fs_1.default.close(fd, er => er ? this.emit('error', er) : this.emit('close'));
+ }
+ }
+}
+exports.WriteStream = WriteStream;
+class WriteStreamSync extends WriteStream {
+ [_open]() {
+ let fd;
+ // only wrap in a try{} block if we know we'll retry, to avoid
+ // the rethrow obscuring the error's source frame in most cases.
+ if (this[_defaultFlag] && this[_flags] === 'r+') {
+ try {
+ fd = fs_1.default.openSync(this[_path], this[_flags], this[_mode]);
+ }
+ catch (er) {
+ if (er?.code === 'ENOENT') {
+ this[_flags] = 'w';
+ return this[_open]();
+ }
+ else {
+ throw er;
+ }
+ }
+ }
+ else {
+ fd = fs_1.default.openSync(this[_path], this[_flags], this[_mode]);
+ }
+ this[_onopen](null, fd);
+ }
+ [_close]() {
+ if (this[_autoClose] && typeof this[_fd] === 'number') {
+ const fd = this[_fd];
+ this[_fd] = undefined;
+ fs_1.default.closeSync(fd);
+ this.emit('close');
+ }
+ }
+ [_write](buf) {
+ // throw the original, but try to close if it fails
+ let threw = true;
+ try {
+ this[_onwrite](null, fs_1.default.writeSync(this[_fd], buf, 0, buf.length, this[_pos]));
+ threw = false;
+ }
+ finally {
+ if (threw) {
+ try {
+ this[_close]();
+ }
+ catch {
+ // ok error
+ }
+ }
+ }
+ }
+}
+exports.WriteStreamSync = WriteStreamSync;
+//# sourceMappingURL=index.js.map \ No newline at end of file
diff --git a/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json b/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json
new file mode 100644
index 0000000..5bbefff
--- /dev/null
+++ b/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json
@@ -0,0 +1,3 @@
+{
+ "type": "commonjs"
+}
diff --git a/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts b/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts
new file mode 100644
index 0000000..54aebe1
--- /dev/null
+++ b/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts
@@ -0,0 +1,118 @@
+/// <reference types="node" resolution-mode="require"/>
+/// <reference types="node" resolution-mode="require"/>
+/// <reference types="node" resolution-mode="require"/>
+import EE from 'events';
+import { Minipass } from 'minipass';
+declare const _autoClose: unique symbol;
+declare const _close: unique symbol;
+declare const _ended: unique symbol;
+declare const _fd: unique symbol;
+declare const _finished: unique symbol;
+declare const _flags: unique symbol;
+declare const _flush: unique symbol;
+declare const _handleChunk: unique symbol;
+declare const _makeBuf: unique symbol;
+declare const _mode: unique symbol;
+declare const _needDrain: unique symbol;
+declare const _onerror: unique symbol;
+declare const _onopen: unique symbol;
+declare const _onread: unique symbol;
+declare const _onwrite: unique symbol;
+declare const _open: unique symbol;
+declare const _path: unique symbol;
+declare const _pos: unique symbol;
+declare const _queue: unique symbol;
+declare const _read: unique symbol;
+declare const _readSize: unique symbol;
+declare const _reading: unique symbol;
+declare const _remain: unique symbol;
+declare const _size: unique symbol;
+declare const _write: unique symbol;
+declare const _writing: unique symbol;
+declare const _defaultFlag: unique symbol;
+declare const _errored: unique symbol;
+export type ReadStreamOptions = Minipass.Options<Minipass.ContiguousData> & {
+ fd?: number;
+ readSize?: number;
+ size?: number;
+ autoClose?: boolean;
+};
+export type ReadStreamEvents = Minipass.Events<Minipass.ContiguousData> & {
+ open: [fd: number];
+};
+export declare class ReadStream extends Minipass<Minipass.ContiguousData, Buffer, ReadStreamEvents> {
+ [_errored]: boolean;
+ [_fd]?: number;
+ [_path]: string;
+ [_readSize]: number;
+ [_reading]: boolean;
+ [_size]: number;
+ [_remain]: number;
+ [_autoClose]: boolean;
+ constructor(path: string, opt: ReadStreamOptions);
+ get fd(): number | undefined;
+ get path(): string;
+ write(): void;
+ end(): void;
+ [_open](): void;
+ [_onopen](er?: NodeJS.ErrnoException | null, fd?: number): void;
+ [_makeBuf](): Buffer;
+ [_read](): void;
+ [_onread](er?: NodeJS.ErrnoException | null, br?: number, buf?: Buffer): void;
+ [_close](): void;
+ [_onerror](er: NodeJS.ErrnoException): void;
+ [_handleChunk](br: number, buf: Buffer): boolean;
+ emit<Event extends keyof ReadStreamEvents>(ev: Event, ...args: ReadStreamEvents[Event]): boolean;
+}
+export declare class ReadStreamSync extends ReadStream {
+ [_open](): void;
+ [_read](): void;
+ [_close](): void;
+}
+export type WriteStreamOptions = {
+ fd?: number;
+ autoClose?: boolean;
+ mode?: number;
+ captureRejections?: boolean;
+ start?: number;
+ flags?: string;
+};
+export declare class WriteStream extends EE {
+ readable: false;
+ writable: boolean;
+ [_errored]: boolean;
+ [_writing]: boolean;
+ [_ended]: boolean;
+ [_queue]: Buffer[];
+ [_needDrain]: boolean;
+ [_path]: string;
+ [_mode]: number;
+ [_autoClose]: boolean;
+ [_fd]?: number;
+ [_defaultFlag]: boolean;
+ [_flags]: string;
+ [_finished]: boolean;
+ [_pos]?: number;
+ constructor(path: string, opt: WriteStreamOptions);
+ emit(ev: string, ...args: any[]): boolean;
+ get fd(): number | undefined;
+ get path(): string;
+ [_onerror](er: NodeJS.ErrnoException): void;
+ [_open](): void;
+ [_onopen](er?: null | NodeJS.ErrnoException, fd?: number): void;
+ end(buf: string, enc?: BufferEncoding): this;
+ end(buf?: Buffer, enc?: undefined): this;
+ write(buf: string, enc?: BufferEncoding): boolean;
+ write(buf: Buffer, enc?: undefined): boolean;
+ [_write](buf: Buffer): void;
+ [_onwrite](er?: null | NodeJS.ErrnoException, bw?: number): void;
+ [_flush](): void;
+ [_close](): void;
+}
+export declare class WriteStreamSync extends WriteStream {
+ [_open](): void;
+ [_close](): void;
+ [_write](buf: Buffer): void;
+}
+export {};
+//# sourceMappingURL=index.d.ts.map \ No newline at end of file
diff --git a/node_modules/@isaacs/fs-minipass/dist/esm/index.js b/node_modules/@isaacs/fs-minipass/dist/esm/index.js
new file mode 100644
index 0000000..287a0f6
--- /dev/null
+++ b/node_modules/@isaacs/fs-minipass/dist/esm/index.js
@@ -0,0 +1,420 @@
+import EE from 'events';
+import fs from 'fs';
+import { Minipass } from 'minipass';
+const writev = fs.writev;
+const _autoClose = Symbol('_autoClose');
+const _close = Symbol('_close');
+const _ended = Symbol('_ended');
+const _fd = Symbol('_fd');
+const _finished = Symbol('_finished');
+const _flags = Symbol('_flags');
+const _flush = Symbol('_flush');
+const _handleChunk = Symbol('_handleChunk');
+const _makeBuf = Symbol('_makeBuf');
+const _mode = Symbol('_mode');
+const _needDrain = Symbol('_needDrain');
+const _onerror = Symbol('_onerror');
+const _onopen = Symbol('_onopen');
+const _onread = Symbol('_onread');
+const _onwrite = Symbol('_onwrite');
+const _open = Symbol('_open');
+const _path = Symbol('_path');
+const _pos = Symbol('_pos');
+const _queue = Symbol('_queue');
+const _read = Symbol('_read');
+const _readSize = Symbol('_readSize');
+const _reading = Symbol('_reading');
+const _remain = Symbol('_remain');
+const _size = Symbol('_size');
+const _write = Symbol('_write');
+const _writing = Symbol('_writing');
+const _defaultFlag = Symbol('_defaultFlag');
+const _errored = Symbol('_errored');
+export class ReadStream extends Minipass {
+ [_errored] = false;
+ [_fd];
+ [_path];
+ [_readSize];
+ [_reading] = false;
+ [_size];
+ [_remain];
+ [_autoClose];
+ constructor(path, opt) {
+ opt = opt || {};
+ super(opt);
+ this.readable = true;
+ this.writable = false;
+ if (typeof path !== 'string') {
+ throw new TypeError('path must be a string');
+ }
+ this[_errored] = false;
+ this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined;
+ this[_path] = path;
+ this[_readSize] = opt.readSize || 16 * 1024 * 1024;
+ this[_reading] = false;
+ this[_size] = typeof opt.size === 'number' ? opt.size : Infinity;
+ this[_remain] = this[_size];
+ this[_autoClose] =
+ typeof opt.autoClose === 'boolean' ? opt.autoClose : true;
+ if (typeof this[_fd] === 'number') {
+ this[_read]();
+ }
+ else {
+ this[_open]();
+ }
+ }
+ get fd() {
+ return this[_fd];
+ }
+ get path() {
+ return this[_path];
+ }
+ //@ts-ignore
+ write() {
+ throw new TypeError('this is a readable stream');
+ }
+ //@ts-ignore
+ end() {
+ throw new TypeError('this is a readable stream');
+ }
+ [_open]() {
+ fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd));
+ }
+ [_onopen](er, fd) {
+ if (er) {
+ this[_onerror](er);
+ }
+ else {
+ this[_fd] = fd;
+ this.emit('open', fd);
+ this[_read]();
+ }
+ }
+ [_makeBuf]() {
+ return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain]));
+ }
+ [_read]() {
+ if (!this[_reading]) {
+ this[_reading] = true;
+ const buf = this[_makeBuf]();
+ /* c8 ignore start */
+ if (buf.length === 0) {
+ return process.nextTick(() => this[_onread](null, 0, buf));
+ }
+ /* c8 ignore stop */
+ fs.read(this[_fd], buf, 0, buf.length, null, (er, br, b) => this[_onread](er, br, b));
+ }
+ }
+ [_onread](er, br, buf) {
+ this[_reading] = false;
+ if (er) {
+ this[_onerror](er);
+ }
+ else if (this[_handleChunk](br, buf)) {
+ this[_read]();
+ }
+ }
+ [_close]() {
+ if (this[_autoClose] && typeof this[_fd] === 'number') {
+ const fd = this[_fd];
+ this[_fd] = undefined;
+ fs.close(fd, er => er ? this.emit('error', er) : this.emit('close'));
+ }
+ }
+ [_onerror](er) {
+ this[_reading] = true;
+ this[_close]();
+ this.emit('error', er);
+ }
+ [_handleChunk](br, buf) {
+ let ret = false;
+ // no effect if infinite
+ this[_remain] -= br;
+ if (br > 0) {
+ ret = super.write(br < buf.length ? buf.subarray(0, br) : buf);
+ }
+ if (br === 0 || this[_remain] <= 0) {
+ ret = false;
+ this[_close]();
+ super.end();
+ }
+ return ret;
+ }
+ emit(ev, ...args) {
+ switch (ev) {
+ case 'prefinish':
+ case 'finish':
+ return false;
+ case 'drain':
+ if (typeof this[_fd] === 'number') {
+ this[_read]();
+ }
+ return false;
+ case 'error':
+ if (this[_errored]) {
+ return false;
+ }
+ this[_errored] = true;
+ return super.emit(ev, ...args);
+ default:
+ return super.emit(ev, ...args);
+ }
+ }
+}
+export class ReadStreamSync extends ReadStream {
+ [_open]() {
+ let threw = true;
+ try {
+ this[_onopen](null, fs.openSync(this[_path], 'r'));
+ threw = false;
+ }
+ finally {
+ if (threw) {
+ this[_close]();
+ }
+ }
+ }
+ [_read]() {
+ let threw = true;
+ try {
+ if (!this[_reading]) {
+ this[_reading] = true;
+ do {
+ const buf = this[_makeBuf]();
+ /* c8 ignore start */
+ const br = buf.length === 0
+ ? 0
+ : fs.readSync(this[_fd], buf, 0, buf.length, null);
+ /* c8 ignore stop */
+ if (!this[_handleChunk](br, buf)) {
+ break;
+ }
+ } while (true);
+ this[_reading] = false;
+ }
+ threw = false;
+ }
+ finally {
+ if (threw) {
+ this[_close]();
+ }
+ }
+ }
+ [_close]() {
+ if (this[_autoClose] && typeof this[_fd] === 'number') {
+ const fd = this[_fd];
+ this[_fd] = undefined;
+ fs.closeSync(fd);
+ this.emit('close');
+ }
+ }
+}
+export class WriteStream extends EE {
+ readable = false;
+ writable = true;
+ [_errored] = false;
+ [_writing] = false;
+ [_ended] = false;
+ [_queue] = [];
+ [_needDrain] = false;
+ [_path];
+ [_mode];
+ [_autoClose];
+ [_fd];
+ [_defaultFlag];
+ [_flags];
+ [_finished] = false;
+ [_pos];
+ constructor(path, opt) {
+ opt = opt || {};
+ super(opt);
+ this[_path] = path;
+ this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined;
+ this[_mode] = opt.mode === undefined ? 0o666 : opt.mode;
+ this[_pos] = typeof opt.start === 'number' ? opt.start : undefined;
+ this[_autoClose] =
+ typeof opt.autoClose === 'boolean' ? opt.autoClose : true;
+ // truncating makes no sense when writing into the middle
+ const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w';
+ this[_defaultFlag] = opt.flags === undefined;
+ this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags;
+ if (this[_fd] === undefined) {
+ this[_open]();
+ }
+ }
+ emit(ev, ...args) {
+ if (ev === 'error') {
+ if (this[_errored]) {
+ return false;
+ }
+ this[_errored] = true;
+ }
+ return super.emit(ev, ...args);
+ }
+ get fd() {
+ return this[_fd];
+ }
+ get path() {
+ return this[_path];
+ }
+ [_onerror](er) {
+ this[_close]();
+ this[_writing] = true;
+ this.emit('error', er);
+ }
+ [_open]() {
+ fs.open(this[_path], this[_flags], this[_mode], (er, fd) => this[_onopen](er, fd));
+ }
+ [_onopen](er, fd) {
+ if (this[_defaultFlag] &&
+ this[_flags] === 'r+' &&
+ er &&
+ er.code === 'ENOENT') {
+ this[_flags] = 'w';
+ this[_open]();
+ }
+ else if (er) {
+ this[_onerror](er);
+ }
+ else {
+ this[_fd] = fd;
+ this.emit('open', fd);
+ if (!this[_writing]) {
+ this[_flush]();
+ }
+ }
+ }
+ end(buf, enc) {
+ if (buf) {
+ //@ts-ignore
+ this.write(buf, enc);
+ }
+ this[_ended] = true;
+ // synthetic after-write logic, where drain/finish live
+ if (!this[_writing] &&
+ !this[_queue].length &&
+ typeof this[_fd] === 'number') {
+ this[_onwrite](null, 0);
+ }
+ return this;
+ }
+ write(buf, enc) {
+ if (typeof buf === 'string') {
+ buf = Buffer.from(buf, enc);
+ }
+ if (this[_ended]) {
+ this.emit('error', new Error('write() after end()'));
+ return false;
+ }
+ if (this[_fd] === undefined || this[_writing] || this[_queue].length) {
+ this[_queue].push(buf);
+ this[_needDrain] = true;
+ return false;
+ }
+ this[_writing] = true;
+ this[_write](buf);
+ return true;
+ }
+ [_write](buf) {
+ fs.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) => this[_onwrite](er, bw));
+ }
+ [_onwrite](er, bw) {
+ if (er) {
+ this[_onerror](er);
+ }
+ else {
+ if (this[_pos] !== undefined && typeof bw === 'number') {
+ this[_pos] += bw;
+ }
+ if (this[_queue].length) {
+ this[_flush]();
+ }
+ else {
+ this[_writing] = false;
+ if (this[_ended] && !this[_finished]) {
+ this[_finished] = true;
+ this[_close]();
+ this.emit('finish');
+ }
+ else if (this[_needDrain]) {
+ this[_needDrain] = false;
+ this.emit('drain');
+ }
+ }
+ }
+ }
+ [_flush]() {
+ if (this[_queue].length === 0) {
+ if (this[_ended]) {
+ this[_onwrite](null, 0);
+ }
+ }
+ else if (this[_queue].length === 1) {
+ this[_write](this[_queue].pop());
+ }
+ else {
+ const iovec = this[_queue];
+ this[_queue] = [];
+ writev(this[_fd], iovec, this[_pos], (er, bw) => this[_onwrite](er, bw));
+ }
+ }
+ [_close]() {
+ if (this[_autoClose] && typeof this[_fd] === 'number') {
+ const fd = this[_fd];
+ this[_fd] = undefined;
+ fs.close(fd, er => er ? this.emit('error', er) : this.emit('close'));
+ }
+ }
+}
+export class WriteStreamSync extends WriteStream {
+ [_open]() {
+ let fd;
+ // only wrap in a try{} block if we know we'll retry, to avoid
+ // the rethrow obscuring the error's source frame in most cases.
+ if (this[_defaultFlag] && this[_flags] === 'r+') {
+ try {
+ fd = fs.openSync(this[_path], this[_flags], this[_mode]);
+ }
+ catch (er) {
+ if (er?.code === 'ENOENT') {
+ this[_flags] = 'w';
+ return this[_open]();
+ }
+ else {
+ throw er;
+ }
+ }
+ }
+ else {
+ fd = fs.openSync(this[_path], this[_flags], this[_mode]);
+ }
+ this[_onopen](null, fd);
+ }
+ [_close]() {
+ if (this[_autoClose] && typeof this[_fd] === 'number') {
+ const fd = this[_fd];
+ this[_fd] = undefined;
+ fs.closeSync(fd);
+ this.emit('close');
+ }
+ }
+ [_write](buf) {
+ // throw the original, but try to close if it fails
+ let threw = true;
+ try {
+ this[_onwrite](null, fs.writeSync(this[_fd], buf, 0, buf.length, this[_pos]));
+ threw = false;
+ }
+ finally {
+ if (threw) {
+ try {
+ this[_close]();
+ }
+ catch {
+ // ok error
+ }
+ }
+ }
+ }
+}
+//# sourceMappingURL=index.js.map \ No newline at end of file
diff --git a/node_modules/@isaacs/fs-minipass/dist/esm/package.json b/node_modules/@isaacs/fs-minipass/dist/esm/package.json
new file mode 100644
index 0000000..3dbc1ca
--- /dev/null
+++ b/node_modules/@isaacs/fs-minipass/dist/esm/package.json
@@ -0,0 +1,3 @@
+{
+ "type": "module"
+}
diff --git a/node_modules/@isaacs/fs-minipass/package.json b/node_modules/@isaacs/fs-minipass/package.json
new file mode 100644
index 0000000..cc4576c
--- /dev/null
+++ b/node_modules/@isaacs/fs-minipass/package.json
@@ -0,0 +1,72 @@
+{
+ "name": "@isaacs/fs-minipass",
+ "version": "4.0.1",
+ "main": "./dist/commonjs/index.js",
+ "scripts": {
+ "prepare": "tshy",
+ "pretest": "npm run prepare",
+ "test": "tap",
+ "preversion": "npm test",
+ "postversion": "npm publish",
+ "prepublishOnly": "git push origin --follow-tags",
+ "format": "prettier --write . --loglevel warn",
+ "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
+ },
+ "keywords": [],
+ "author": "Isaac Z. Schlueter",
+ "license": "ISC",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/npm/fs-minipass.git"
+ },
+ "description": "fs read and write streams based on minipass",
+ "dependencies": {
+ "minipass": "^7.0.4"
+ },
+ "devDependencies": {
+ "@types/node": "^20.11.30",
+ "mutate-fs": "^2.1.1",
+ "prettier": "^3.2.5",
+ "tap": "^18.7.1",
+ "tshy": "^1.12.0",
+ "typedoc": "^0.25.12"
+ },
+ "files": [
+ "dist"
+ ],
+ "engines": {
+ "node": ">=18.0.0"
+ },
+ "tshy": {
+ "exports": {
+ "./package.json": "./package.json",
+ ".": "./src/index.ts"
+ }
+ },
+ "exports": {
+ "./package.json": "./package.json",
+ ".": {
+ "import": {
+ "types": "./dist/esm/index.d.ts",
+ "default": "./dist/esm/index.js"
+ },
+ "require": {
+ "types": "./dist/commonjs/index.d.ts",
+ "default": "./dist/commonjs/index.js"
+ }
+ }
+ },
+ "types": "./dist/commonjs/index.d.ts",
+ "type": "module",
+ "prettier": {
+ "semi": false,
+ "printWidth": 75,
+ "tabWidth": 2,
+ "useTabs": false,
+ "singleQuote": true,
+ "jsxSingleQuote": false,
+ "bracketSameLine": true,
+ "arrowParens": "avoid",
+ "endOfLine": "lf"
+ }
+}