Website Structure

This commit is contained in:
supalerk-ar66 2026-01-13 10:46:40 +07:00
parent 62812f2090
commit 71f0676a62
22365 changed files with 4265753 additions and 791 deletions

View file

@ -0,0 +1,3 @@
import type nodeStream from "node:stream";
export declare const _Duplex: unknown;
export declare const Duplex: typeof nodeStream.Duplex;

View file

@ -0,0 +1,19 @@
import { mergeFns } from "../../../_internal/utils.mjs";
import { Readable } from "./readable.mjs";
import { Writable } from "./writable.mjs";
const __Duplex = class {
allowHalfOpen = true;
_destroy;
constructor(readable = new Readable(), writable = new Writable()) {
Object.assign(this, readable);
Object.assign(this, writable);
this._destroy = mergeFns(readable._destroy, writable._destroy);
}
};
function getDuplex() {
Object.assign(__Duplex.prototype, Readable.prototype);
Object.assign(__Duplex.prototype, Writable.prototype);
return __Duplex;
}
export const _Duplex = /* @__PURE__ */ getDuplex();
export const Duplex = globalThis.Duplex || _Duplex;

View file

@ -0,0 +1,67 @@
import type nodeStream from "node:stream";
import type { BufferEncoding, Callback } from "../../../_internal/types.mjs";
import { EventEmitter } from "node:events";
// Docs: https://nodejs.org/api/stream.html#stream_readable_streams
// Implementation: https://github.com/nodejs/node/blob/master/lib/internal/streams/readable.js
interface ArrayOptions {
/** the maximum concurrent invocations of `fn` to call on the stream at once. **Default: 1**. */
concurrency?: number;
/** allows destroying the stream if the signal is aborted. */
signal?: AbortSignal;
}
export declare class _Readable extends EventEmitter implements nodeStream.Readable {
__unenv__: unknown;
readonly readableEncoding: BufferEncoding | null;
readonly readableEnded: boolean;
readonly readableFlowing: boolean | null;
readonly readableHighWaterMark: number;
readonly readableLength: number;
readonly readableObjectMode: boolean;
readonly readableAborted: boolean;
readonly readableDidRead: boolean;
readonly closed: boolean;
readonly errored: Error | null;
readable: boolean;
destroyed: boolean;
static from(_iterable: Iterable<any> | AsyncIterable<any>, options?: nodeStream.ReadableOptions);
constructor(_opts?: nodeStream.ReadableOptions);
_read(_size: number);
read(_size?: number);
setEncoding(_encoding: BufferEncoding);
pause();
resume();
isPaused(): boolean;
unpipe(_destination?: any);
unshift(_chunk: any, _encoding?: BufferEncoding);
wrap(_oldStream: any);
push(_chunk: any, _encoding?: BufferEncoding): boolean;
_destroy(_error?: any, _callback?: Callback<any>);
destroy(error?: Error);
pipe<T>(_destenition: T, _options?: {
end?: boolean;
}): T;
compose<T extends NodeJS.ReadableStream>(stream: T | ((source: any) => void) | Iterable<T> | AsyncIterable<T>, options?: {
signal: AbortSignal;
} | undefined): T;
[Symbol.asyncDispose]();
// eslint-disable-next-line require-yield
[Symbol.asyncIterator](): NodeJS.AsyncIterator<any>;
iterator(options?: {
destroyOnReturn?: boolean | undefined;
} | undefined): NodeJS.AsyncIterator<any>;
map(fn: (data: any, options?: Pick<ArrayOptions, "signal"> | undefined) => any, options?: ArrayOptions | undefined): nodeStream.Readable;
filter(fn: (data: any, options?: Pick<ArrayOptions, "signal"> | undefined) => boolean, options?: ArrayOptions | undefined): nodeStream.Readable;
forEach(fn: (data: any, options?: Pick<ArrayOptions, "signal"> | undefined) => void | Promise<void>, options?: ArrayOptions | undefined): Promise<void>;
reduce(fn: (accumulator: any, data: any, options?: Pick<ArrayOptions, "signal"> | undefined) => any, initialValue?: any, options?: ArrayOptions | undefined): Promise<any>;
find(fn: (data: any, options?: Pick<ArrayOptions, "signal"> | undefined) => boolean, options?: ArrayOptions | undefined): Promise<any>;
findIndex(fn: (data: any, options?: Pick<ArrayOptions, "signal"> | undefined) => boolean, options?: ArrayOptions | undefined): Promise<number>;
some(fn: (data: any, options?: Pick<ArrayOptions, "signal"> | undefined) => boolean, options?: ArrayOptions | undefined): Promise<boolean>;
toArray(options?: Pick<ArrayOptions, "signal"> | undefined): Promise<any[]>;
every(fn: (data: any, options?: Pick<ArrayOptions, "signal"> | undefined) => boolean | Promise<boolean>, options?: ArrayOptions | undefined): Promise<boolean>;
flatMap(fn: (data: any, options?: Pick<ArrayOptions, "signal"> | undefined) => any, options?: ArrayOptions | undefined): nodeStream.Readable;
drop(limit: number, options?: Pick<ArrayOptions, "signal"> | undefined): nodeStream.Readable;
take(limit: number, options?: Pick<ArrayOptions, "signal"> | undefined): nodeStream.Readable;
asIndexedPairs(options?: Pick<ArrayOptions, "signal"> | undefined): nodeStream.Readable;
}
export declare const Readable: typeof nodeStream.Readable;
export {};

View file

@ -0,0 +1,112 @@
import { createNotImplementedError } from "../../../_internal/utils.mjs";
import { EventEmitter } from "node:events";
export class _Readable extends EventEmitter {
__unenv__ = true;
readableEncoding = null;
readableEnded = true;
readableFlowing = false;
readableHighWaterMark = 0;
readableLength = 0;
readableObjectMode = false;
readableAborted = false;
readableDidRead = false;
closed = false;
errored = null;
readable = false;
destroyed = false;
static from(_iterable, options) {
return new _Readable(options);
}
constructor(_opts) {
super();
}
_read(_size) {}
read(_size) {}
setEncoding(_encoding) {
return this;
}
pause() {
return this;
}
resume() {
return this;
}
isPaused() {
return true;
}
unpipe(_destination) {
return this;
}
unshift(_chunk, _encoding) {}
wrap(_oldStream) {
return this;
}
push(_chunk, _encoding) {
return false;
}
_destroy(_error, _callback) {
this.removeAllListeners();
}
destroy(error) {
this.destroyed = true;
this._destroy(error);
return this;
}
pipe(_destenition, _options) {
return {};
}
compose(stream, options) {
throw new Error("[unenv] Method not implemented.");
}
[Symbol.asyncDispose]() {
this.destroy();
return Promise.resolve();
}
// eslint-disable-next-line require-yield
async *[Symbol.asyncIterator]() {
throw createNotImplementedError("Readable.asyncIterator");
}
iterator(options) {
throw createNotImplementedError("Readable.iterator");
}
map(fn, options) {
throw createNotImplementedError("Readable.map");
}
filter(fn, options) {
throw createNotImplementedError("Readable.filter");
}
forEach(fn, options) {
throw createNotImplementedError("Readable.forEach");
}
reduce(fn, initialValue, options) {
throw createNotImplementedError("Readable.reduce");
}
find(fn, options) {
throw createNotImplementedError("Readable.find");
}
findIndex(fn, options) {
throw createNotImplementedError("Readable.findIndex");
}
some(fn, options) {
throw createNotImplementedError("Readable.some");
}
toArray(options) {
throw createNotImplementedError("Readable.toArray");
}
every(fn, options) {
throw createNotImplementedError("Readable.every");
}
flatMap(fn, options) {
throw createNotImplementedError("Readable.flatMap");
}
drop(limit, options) {
throw createNotImplementedError("Readable.drop");
}
take(limit, options) {
throw createNotImplementedError("Readable.take");
}
asIndexedPairs(options) {
throw createNotImplementedError("Readable.asIndexedPairs");
}
}
export const Readable = globalThis.Readable || _Readable;

View file

@ -0,0 +1,10 @@
import type nodeStream from "node:stream";
import { Duplex } from "./duplex.mjs";
// Docs: https://nodejs.org/api/stream.html#stream_duplex_and_transform_streams
// Implementation: https://github.com/nodejs/node/blob/master/lib/internal/streams/transform.js
export declare class _Transform extends Duplex implements nodeStream.Transform {
readonly __unenv__: true;
_transform(chunk: any, encoding: globalThis.BufferEncoding, callback: nodeStream.TransformCallback): void;
_flush(callback: nodeStream.TransformCallback): void;
}
export declare const Transform: typeof nodeStream.Transform;

View file

@ -0,0 +1,9 @@
import { Duplex } from "./duplex.mjs";
// Docs: https://nodejs.org/api/stream.html#stream_duplex_and_transform_streams
// Implementation: https://github.com/nodejs/node/blob/master/lib/internal/streams/transform.js
export class _Transform extends Duplex {
__unenv__ = true;
_transform(chunk, encoding, callback) {}
_flush(callback) {}
}
export const Transform = globalThis.Transform || _Transform;

View file

@ -0,0 +1,2 @@
import type nodeStream from "node:stream";
export declare const Writable: typeof nodeStream.Writable;

View file

@ -0,0 +1,87 @@
import { EventEmitter } from "node:events";
// Docs: https://nodejs.org/api/stream.html#stream_writable_streams
// Implementation: https://github.com/nodejs/node/blob/master/lib/internal/streams/writable.js
class _Writable extends EventEmitter {
__unenv__ = true;
writable = true;
writableEnded = false;
writableFinished = false;
writableHighWaterMark = 0;
writableLength = 0;
writableObjectMode = false;
writableCorked = 0;
closed = false;
errored = null;
writableNeedDrain = false;
destroyed = false;
_data;
_encoding = "utf-8";
constructor(_opts) {
super();
}
pipe(_destenition, _options) {
return {};
}
_write(chunk, encoding, callback) {
if (this.writableEnded) {
if (callback) {
callback();
}
return;
}
if (this._data === undefined) {
this._data = chunk;
} else {
const a = typeof this._data === "string" ? Buffer.from(this._data, this._encoding || encoding || "utf8") : this._data;
const b = typeof chunk === "string" ? Buffer.from(chunk, encoding || this._encoding || "utf8") : chunk;
this._data = Buffer.concat([a, b]);
}
this._encoding = encoding;
if (callback) {
callback();
}
}
_writev(_chunks, _callback) {}
_destroy(_error, _callback) {}
_final(_callback) {}
write(chunk, arg2, arg3) {
const encoding = typeof arg2 === "string" ? this._encoding : "utf-8";
const cb = typeof arg2 === "function" ? arg2 : typeof arg3 === "function" ? arg3 : undefined;
this._write(chunk, encoding, cb);
return true;
}
setDefaultEncoding(_encoding) {
return this;
}
end(arg1, arg2, arg3) {
const callback = typeof arg1 === "function" ? arg1 : typeof arg2 === "function" ? arg2 : typeof arg3 === "function" ? arg3 : undefined;
if (this.writableEnded) {
if (callback) {
callback();
}
return this;
}
const data = arg1 === callback ? undefined : arg1;
if (data) {
const encoding = arg2 === callback ? undefined : arg2;
this.write(data, encoding, callback);
}
this.writableEnded = true;
this.writableFinished = true;
this.emit("close");
this.emit("finish");
return this;
}
cork() {}
uncork() {}
destroy(_error) {
this.destroyed = true;
delete this._data;
this.removeAllListeners();
return this;
}
compose(stream, options) {
throw new Error("[h3] Method not implemented.");
}
}
export const Writable = globalThis.Writable || _Writable;