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 @@
export declare function inherits(ctor: any, superCtor: any);

View file

@ -0,0 +1,12 @@
export function inherits(ctor, superCtor) {
if (!superCtor) {
return;
}
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, { constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
} });
}

View file

@ -0,0 +1,19 @@
import type nodeUtil from "node:util";
export declare const isRegExp: typeof nodeUtil.isRegExp;
export declare const isDate: typeof nodeUtil.isDate;
export declare const isArray: typeof nodeUtil.isArray;
export declare const isBoolean: typeof nodeUtil.isBoolean;
export declare const isNull: typeof nodeUtil.isNull;
export declare const isNullOrUndefined: typeof nodeUtil.isNullOrUndefined;
export declare const isNumber: typeof nodeUtil.isNumber;
export declare const isString: typeof nodeUtil.isString;
export declare const isSymbol: typeof nodeUtil.isSymbol;
export declare const isUndefined: typeof nodeUtil.isUndefined;
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
export declare const isFunction: typeof nodeUtil.isFunction;
export declare const isBuffer: typeof nodeUtil.isBuffer;
export declare const isDeepStrictEqual: typeof nodeUtil.isDeepStrictEqual;
export declare const isObject: typeof nodeUtil.isObject;
export declare const isError: typeof nodeUtil.isError;
// Source https://github.com/jonschlinkert/is-primitive/blob/b22c524da5cbac075f14145780ec4b3637afd7dc/index.js
export declare const isPrimitive: typeof nodeUtil.isPrimitive;

View file

@ -0,0 +1,25 @@
export const isRegExp = (val) => val instanceof RegExp;
export const isDate = (val) => val instanceof Date;
export const isArray = (val) => Array.isArray(val);
export const isBoolean = (val) => typeof val === "boolean";
export const isNull = (val) => val === null;
export const isNullOrUndefined = (val) => val === null || val === undefined;
export const isNumber = (val) => typeof val === "number";
export const isString = (val) => typeof val === "string";
export const isSymbol = (val) => typeof val === "symbol";
export const isUndefined = (val) => val === undefined;
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
export const isFunction = (val) => typeof val === "function";
export const isBuffer = (val) => {
return val && typeof val === "object" && typeof val.copy === "function" && typeof val.fill === "function" && typeof val.readUInt8 === "function";
};
export const isDeepStrictEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);
export const isObject = (val) => val !== null && typeof val === "object" && Object.getPrototypeOf(val).isPrototypeOf(Object);
export const isError = (val) => val instanceof Error;
// Source https://github.com/jonschlinkert/is-primitive/blob/b22c524da5cbac075f14145780ec4b3637afd7dc/index.js
export const isPrimitive = (val) => {
if (typeof val === "object") {
return val === null;
}
return typeof val !== "function";
};

View file

@ -0,0 +1,8 @@
import type nodeUtil from "node:util";
export declare const log: unknown;
export declare const debuglog: typeof nodeUtil.debuglog;
export declare const debug: typeof nodeUtil.debug;
// @ts-ignore
export declare const inspect: typeof nodeUtil.inspect;
export declare const format: typeof nodeUtil.format;
export declare const formatWithOptions: typeof nodeUtil.formatWithOptions;

View file

@ -0,0 +1,55 @@
export const log = (...args) => {
console.log(...args);
};
export const debuglog = (section, _cb) => {
const fn = (msg, ...params) => {
if (fn.enabled) {
console.debug(`[${section}] ${msg}`, ...params);
}
};
fn.enabled = true;
return fn;
};
export const debug = debuglog;
// @ts-ignore
export const inspect = (object) => JSON.stringify(object, null, 2);
export const format = (...args) => _format(...args);
export const formatWithOptions = (_options, ...args) => _format(...args);
// Source: https://github.com/tmpfs/format-util/blob/0c989942c959b179eec294a4e725afd63e743f18/format.js
function _format(fmt, ...args) {
const re = /(%?)(%([djos]))/g;
if (args.length > 0) {
fmt = fmt.replace(re, (match, escaped, ptn, flag) => {
let arg = args.shift();
switch (flag) {
case "o":
if (Array.isArray(arg)) {
arg = JSON.stringify(arg);
break;
}
break;
case "s":
arg = "" + arg;
break;
case "d":
arg = Number(arg);
break;
case "j":
arg = JSON.stringify(arg);
break;
}
if (!escaped) {
return arg;
}
args.unshift(arg);
return match;
});
}
// arguments remain after formatting
if (args.length > 0) {
fmt += " " + args.join(" ");
}
// update escaped %% values
fmt = fmt.replace(/%{2}/g, "%");
return "" + fmt;
}

View file

@ -0,0 +1,19 @@
import type { MIMEType as MIMETypeT, MIMEParams as MIMEParamsT } from "node:util";
// https://nodejs.org/api/util.html#class-utilmimetype
export declare class MIMEType implements MIMETypeT {
readonly __unenv__: true;
params;
type: string;
subtype: string;
constructor(input: string | {
toString: () => string;
});
get essence();
toString();
}
// https://nodejs.org/api/util.html#util_class_util_mimeparams
export declare class MIMEParams extends Map<string, string> implements MIMEParamsT {
readonly __unenv__: true;
get(name: string): any;
toString();
}

View file

@ -0,0 +1,35 @@
// https://nodejs.org/api/util.html#class-utilmimetype
export class MIMEType {
__unenv__ = true;
params = new MIMEParams();
type;
subtype;
constructor(input) {
const [essence = "", ...params] = String(input).split(";");
const [type = "", subtype = ""] = essence.split("/");
this.type = type;
this.subtype = subtype;
this.params = new MIMEParams();
for (const param of params) {
const [name, value] = param.split("=");
this.params.set(name, value);
}
}
get essence() {
return this.type + "/" + this.subtype;
}
toString() {
const paramsStr = this.params.toString();
return this.essence + (paramsStr ? `;${paramsStr}` : "");
}
}
// https://nodejs.org/api/util.html#util_class_util_mimeparams
export class MIMEParams extends Map {
__unenv__ = true;
get(name) {
return super.get(name) || null;
}
toString() {
return [...this.entries()].map(([name, value]) => `${name}=${value}`).join("&");
}
}

View file

@ -0,0 +1,3 @@
import type nodeUtil from "node:util";
// @ts-ignore
export declare const promisify: typeof nodeUtil.promisify;

View file

@ -0,0 +1,23 @@
const customSymbol = /* @__PURE__ */ Symbol("customPromisify");
function _promisify(fn) {
if (fn[customSymbol]) {
return fn[customSymbol];
}
return function(...args) {
return new Promise((resolve, reject) => {
try {
// @ts-ignore
fn.call(this, ...args, (err, val) => {
if (err) {
return reject(err);
}
resolve(val);
});
} catch (error) {
reject(error);
}
});
};
}
// @ts-ignore
export const promisify = /* @__PURE__ */ Object.assign(_promisify, { custom: customSymbol });

View file

@ -0,0 +1,45 @@
import type nodeUtilTypes from "node:util/types";
export declare const isExternal: typeof nodeUtilTypes.isExternal;
export declare const isDate: typeof nodeUtilTypes.isDate;
export declare const isArgumentsObject: unknown;
export declare const isBigIntObject: (val: any) => val is bigint;
export declare const isBooleanObject: typeof nodeUtilTypes.isBooleanObject;
export declare const isNumberObject: typeof nodeUtilTypes.isNumberObject;
export declare const isStringObject: typeof nodeUtilTypes.isStringObject;
export declare const isSymbolObject: typeof nodeUtilTypes.isSymbolObject;
export declare const isNativeError: unknown;
export declare const isRegExp: typeof nodeUtilTypes.isRegExp;
export declare const isAsyncFunction: unknown;
export declare const isGeneratorFunction: unknown;
export declare const isGeneratorObject: unknown;
export declare const isPromise: typeof nodeUtilTypes.isPromise;
// @ts-ignore
export declare const isMap: typeof nodeUtilTypes.isMap;
// @ts-ignore
export declare const isSet: typeof nodeUtilTypes.isSet;
export declare const isMapIterator: unknown;
export declare const isSetIterator: unknown;
export declare const isWeakMap: typeof nodeUtilTypes.isWeakMap;
export declare const isWeakSet: typeof nodeUtilTypes.isWeakSet;
export declare const isArrayBuffer: typeof nodeUtilTypes.isArrayBuffer;
export declare const isDataView: typeof nodeUtilTypes.isDataView;
export declare const isSharedArrayBuffer: typeof nodeUtilTypes.isSharedArrayBuffer;
export declare const isProxy: unknown;
export declare const isModuleNamespaceObject: unknown;
export declare const isAnyArrayBuffer: unknown;
export declare const isBoxedPrimitive: unknown;
export declare const isArrayBufferView: unknown;
export declare const isTypedArray: unknown;
export declare const isUint8Array: unknown;
export declare const isUint8ClampedArray: unknown;
export declare const isUint16Array: unknown;
export declare const isUint32Array: unknown;
export declare const isInt8Array: unknown;
export declare const isInt16Array: unknown;
export declare const isInt32Array: unknown;
export declare const isFloat32Array: unknown;
export declare const isFloat64Array: unknown;
export declare const isBigInt64Array: unknown;
export declare const isBigUint64Array: unknown;
export declare const isKeyObject: unknown;
export declare const isCryptoKey: unknown;

View file

@ -0,0 +1,45 @@
import { notImplemented } from "../../../_internal/utils.mjs";
export const isExternal = (_obj) => false;
export const isDate = (val) => val instanceof Date;
export const isArgumentsObject = /* @__PURE__ */ notImplemented("util.types.isArgumentsObject");
export const isBigIntObject = (val) => typeof val === "bigint";
export const isBooleanObject = (val) => typeof val === "boolean";
export const isNumberObject = (val) => typeof val === "number";
export const isStringObject = (val) => typeof val === "string";
export const isSymbolObject = (val) => typeof val === "symbol";
export const isNativeError = /* @__PURE__ */ notImplemented("util.types.isNativeError");
export const isRegExp = (val) => val instanceof RegExp;
export const isAsyncFunction = /* @__PURE__ */ notImplemented("util.types.isAsyncFunction");
export const isGeneratorFunction = /* @__PURE__ */ notImplemented("util.types.isGeneratorFunction");
export const isGeneratorObject = /* @__PURE__ */ notImplemented("util.types.isGeneratorObject");
export const isPromise = (val) => val instanceof Promise;
// @ts-ignore
export const isMap = (val) => val instanceof Map;
// @ts-ignore
export const isSet = (val) => val instanceof Set;
export const isMapIterator = /* @__PURE__ */ notImplemented("util.types.isMapIterator");
export const isSetIterator = /* @__PURE__ */ notImplemented("util.types.isSetIterator");
export const isWeakMap = (val) => val instanceof WeakMap;
export const isWeakSet = (val) => val instanceof WeakSet;
export const isArrayBuffer = (val) => val instanceof ArrayBuffer;
export const isDataView = (val) => val instanceof DataView;
export const isSharedArrayBuffer = (val) => val instanceof SharedArrayBuffer;
export const isProxy = /* @__PURE__ */ notImplemented("util.types.isProxy");
export const isModuleNamespaceObject = /* @__PURE__ */ notImplemented("util.types.isModuleNamespaceObject");
export const isAnyArrayBuffer = /* @__PURE__ */ notImplemented("util.types.isAnyArrayBuffer");
export const isBoxedPrimitive = /* @__PURE__ */ notImplemented("util.types.isBoxedPrimitive");
export const isArrayBufferView = /* @__PURE__ */ notImplemented("util.types.isArrayBufferView");
export const isTypedArray = /* @__PURE__ */ notImplemented("util.types.isTypedArray");
export const isUint8Array = /* @__PURE__ */ notImplemented("util.types.isUint8Array");
export const isUint8ClampedArray = /* @__PURE__ */ notImplemented("util.types.isUint8ClampedArray");
export const isUint16Array = /* @__PURE__ */ notImplemented("util.types.isUint16Array");
export const isUint32Array = /* @__PURE__ */ notImplemented("util.types.isUint32Array");
export const isInt8Array = /* @__PURE__ */ notImplemented("util.types.isInt8Array");
export const isInt16Array = /* @__PURE__ */ notImplemented("util.types.isInt16Array");
export const isInt32Array = /* @__PURE__ */ notImplemented("util.types.isInt32Array");
export const isFloat32Array = /* @__PURE__ */ notImplemented("util.types.isFloat32Array");
export const isFloat64Array = /* @__PURE__ */ notImplemented("util.types.isFloat64Array");
export const isBigInt64Array = /* @__PURE__ */ notImplemented("util.types.isBigInt64Array");
export const isBigUint64Array = /* @__PURE__ */ notImplemented("util.types.isBigUint64Array");
export const isKeyObject = /* @__PURE__ */ notImplemented("util.types.isKeyObject");
export const isCryptoKey = /* @__PURE__ */ notImplemented("util.types.isCryptoKey");