diff --git a/node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs b/node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5c7fb16254ae8a7fbcef8513f976fdbabb770aaf --- /dev/null +++ b/node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs @@ -0,0 +1,1581 @@ +import { _WebAssembly } from "../webassembly.mjs"; +import { resolve } from "./path.mjs"; +// Linux fcntl flag bits ↔ Windows libuv flag bits. `pathOpen()` builds +// `flagsRes` using Linux constants (O_CREAT=0x40, O_EXCL=0x80, +// O_APPEND=0x400). Windows libuv expects different bits (O_CREAT=0x100, +// O_EXCL=0x400, O_APPEND=0x8). Without translation, +// `fs.openSync(path, 0x241 /* L:WRONLY|CREAT|TRUNC */)` is rejected +// with EINVAL because Linux's 0x40 happens to mean O_TEMPORARY on +// Windows — and O_TEMPORARY without O_CREAT is invalid. +const _isWin32Flags = typeof process !== 'undefined' && process.platform === 'win32'; +function _toWinOpenFlags(f) { + let r = f & 3; // RDONLY/WRONLY/RDWR — same on both + if ((f & 0x40) !== 0) + r |= 0x100; // O_CREAT: Linux 0x40 -> Windows 0x100 + if ((f & 0x80) !== 0) + r |= 0x400; // O_EXCL: Linux 0x80 -> Windows 0x400 + if ((f & 0x200) !== 0) + r |= 0x200; // O_TRUNC: same value on both + if ((f & 0x400) !== 0) + r |= 0x8; // O_APPEND: Linux 0x400 -> Windows 0x8 + return r; +} +import { WasiErrno, WasiRights, FileControlFlag, WasiFileControlFlag, WasiFdFlag, WasiFileType, WasiClockid, WasiFstFlag, WasiEventType, WasiSubclockflags } from "./types.mjs"; +import { concatBuffer, toFileStat, AsyncTable, SyncTable } from "./fd.mjs"; +import { WasiError } from "./error.mjs"; +import { isPromiseLike, sleepBreakIf, unsharedSlice } from "./util.mjs"; +import { getRights } from "./rights.mjs"; +import { extendMemory } from "../memory.mjs"; +import { wrapAsyncImport } from "../jspi.mjs"; +function copyMemory(targets, src) { + if (targets.length === 0 || src.length === 0) + return 0; + let copied = 0; + let left = src.length - copied; + for (let i = 0; i < targets.length; ++i) { + const target = targets[i]; + if (left < target.length) { + target.set(src.subarray(copied, copied + left), 0); + copied += left; + left = 0; + return copied; + } + target.set(src.subarray(copied, copied + target.length), 0); + copied += target.length; + left -= target.length; + } + return copied; +} +const _memory = new WeakMap(); +const _wasi = new WeakMap(); +const _fs = new WeakMap(); +function getMemory(wasi) { + return _memory.get(wasi); +} +function getFs(wasi) { + const fs = _fs.get(wasi); + if (!fs) + throw new Error('filesystem is unavailable'); + return fs; +} +function handleError(err) { + if (err instanceof WasiError) { + if (process.env.NODE_ENV !== 'production') { + console.warn(err); + } + return err.errno; + } + switch (err.code) { + case 'ENOENT': return WasiErrno.ENOENT; + case 'EBADF': return WasiErrno.EBADF; + case 'EINVAL': return WasiErrno.EINVAL; + case 'EPERM': return WasiErrno.EPERM; + case 'EPROTO': return WasiErrno.EPROTO; + case 'EEXIST': return WasiErrno.EEXIST; + case 'ENOTDIR': return WasiErrno.ENOTDIR; + case 'EMFILE': return WasiErrno.EMFILE; + case 'EACCES': return WasiErrno.EACCES; + case 'EISDIR': return WasiErrno.EISDIR; + case 'ENOTEMPTY': return WasiErrno.ENOTEMPTY; + case 'ENOSYS': return WasiErrno.ENOSYS; + } + throw err; +} +function defineName(name, f) { + Object.defineProperty(f, 'name', { value: name }); + return f; +} +function tryCall(f, wasi, args) { + let r; + try { + r = f.apply(wasi, args); + } + catch (err) { + return handleError(err); + } + if (isPromiseLike(r)) { + return r.then(_ => _, handleError); + } + return r; +} +function syscallWrap(self, name, f) { + let debug = false; + const NODE_DEBUG_NATIVE = (() => { + try { + return process.env.NODE_DEBUG_NATIVE; + } + catch (_) { + return undefined; + } + })(); + if (typeof NODE_DEBUG_NATIVE === 'string' && NODE_DEBUG_NATIVE.split(',').includes('wasi')) { + debug = true; + } + return debug + ? defineName(name, function () { + const args = Array.prototype.slice.call(arguments); + let debugArgs = [`${name}(${Array.from({ length: arguments.length }).map(() => '%d').join(', ')})`]; + debugArgs = debugArgs.concat(args); + console.debug.apply(console, debugArgs); + return tryCall(f, self, args); + }) + : defineName(name, function () { + return tryCall(f, self, arguments); + }); +} +function resolvePathSync(fs, fileDescriptor, path, flags) { + let resolvedPath = resolve(fileDescriptor.realPath, path); + if ((flags & 1) === 1) { + try { + resolvedPath = fs.readlinkSync(resolvedPath); + } + catch (err) { + if (err.code !== 'EINVAL' && err.code !== 'ENOENT') { + throw err; + } + } + } + return resolvedPath; +} +async function resolvePathAsync(fs, fileDescriptor, path, flags) { + let resolvedPath = resolve(fileDescriptor.realPath, path); + if ((flags & 1) === 1) { + try { + resolvedPath = await fs.promises.readlink(resolvedPath); + } + catch (err) { + if (err.code !== 'EINVAL' && err.code !== 'ENOENT') { + throw err; + } + } + } + return resolvedPath; +} +// eslint-disable-next-line spaced-comment +const encoder = /*#__PURE__*/ new TextEncoder(); +// eslint-disable-next-line spaced-comment +const decoder = /*#__PURE__*/ new TextDecoder(); +const INT64_MAX = (BigInt(1) << BigInt(63)) - BigInt(1); +function readStdin() { + const value = window.prompt(); + if (value === null) + return new Uint8Array(); + const buffer = new TextEncoder().encode(value + '\n'); + return buffer; +} +function validateFstFlagsOrReturn(flags) { + return (Boolean((flags) & ~(WasiFstFlag.SET_ATIM | WasiFstFlag.SET_ATIM_NOW | + WasiFstFlag.SET_MTIM | WasiFstFlag.SET_MTIM_NOW)) || + ((flags) & (WasiFstFlag.SET_ATIM | WasiFstFlag.SET_ATIM_NOW)) === + (WasiFstFlag.SET_ATIM | WasiFstFlag.SET_ATIM_NOW) || + ((flags) & (WasiFstFlag.SET_MTIM | WasiFstFlag.SET_MTIM_NOW)) === + (WasiFstFlag.SET_MTIM | WasiFstFlag.SET_MTIM_NOW)); +} +export class WASI { + constructor(args, env, fds, asyncFs, fs, asyncify) { + this.args_get = syscallWrap(this, 'args_get', function (argv, argv_buf) { + argv = Number(argv); + argv_buf = Number(argv_buf); + if (argv === 0 || argv_buf === 0) { + return WasiErrno.EINVAL; + } + const { HEAPU8, view } = getMemory(this); + const wasi = _wasi.get(this); + const args = wasi.args; + for (let i = 0; i < args.length; ++i) { + const arg = args[i]; + view.setInt32(argv, argv_buf, true); + argv += 4; + const data = encoder.encode(arg + '\0'); + HEAPU8.set(data, argv_buf); + argv_buf += data.length; + } + return WasiErrno.ESUCCESS; + }); + this.args_sizes_get = syscallWrap(this, 'args_sizes_get', function (argc, argv_buf_size) { + argc = Number(argc); + argv_buf_size = Number(argv_buf_size); + if (argc === 0 || argv_buf_size === 0) { + return WasiErrno.EINVAL; + } + const { view } = getMemory(this); + const wasi = _wasi.get(this); + const args = wasi.args; + view.setUint32(argc, args.length, true); + view.setUint32(argv_buf_size, encoder.encode(args.join('\0') + '\0').length, true); + return WasiErrno.ESUCCESS; + }); + this.environ_get = syscallWrap(this, 'environ_get', function (environ, environ_buf) { + environ = Number(environ); + environ_buf = Number(environ_buf); + if (environ === 0 || environ_buf === 0) { + return WasiErrno.EINVAL; + } + const { HEAPU8, view } = getMemory(this); + const wasi = _wasi.get(this); + const env = wasi.env; + for (let i = 0; i < env.length; ++i) { + const pair = env[i]; + view.setInt32(environ, environ_buf, true); + environ += 4; + const data = encoder.encode(pair + '\0'); + HEAPU8.set(data, environ_buf); + environ_buf += data.length; + } + return WasiErrno.ESUCCESS; + }); + this.environ_sizes_get = syscallWrap(this, 'environ_sizes_get', function (len, buflen) { + len = Number(len); + buflen = Number(buflen); + if (len === 0 || buflen === 0) { + return WasiErrno.EINVAL; + } + const { view } = getMemory(this); + const wasi = _wasi.get(this); + view.setUint32(len, wasi.env.length, true); + view.setUint32(buflen, encoder.encode(wasi.env.join('\0') + '\0').length, true); + return WasiErrno.ESUCCESS; + }); + this.clock_res_get = syscallWrap(this, 'clock_res_get', function (id, resolution) { + resolution = Number(resolution); + if (resolution === 0) { + return WasiErrno.EINVAL; + } + const { view } = getMemory(this); + switch (id) { + case WasiClockid.REALTIME: + view.setBigUint64(resolution, BigInt(1000000), true); + return WasiErrno.ESUCCESS; + case WasiClockid.MONOTONIC: + case WasiClockid.PROCESS_CPUTIME_ID: + case WasiClockid.THREAD_CPUTIME_ID: + view.setBigUint64(resolution, BigInt(1000), true); + return WasiErrno.ESUCCESS; + default: return WasiErrno.EINVAL; + } + }); + this.clock_time_get = syscallWrap(this, 'clock_time_get', function (id, _percision, time) { + time = Number(time); + if (time === 0) { + return WasiErrno.EINVAL; + } + const { view } = getMemory(this); + switch (id) { + case WasiClockid.REALTIME: + view.setBigUint64(time, BigInt(Date.now()) * BigInt(1000000), true); + return WasiErrno.ESUCCESS; + case WasiClockid.MONOTONIC: + case WasiClockid.PROCESS_CPUTIME_ID: + case WasiClockid.THREAD_CPUTIME_ID: { + const t = performance.now() / 1000; + const s = Math.trunc(t); + const ms = Math.floor((t - s) * 1000); + const result = BigInt(s) * BigInt(1000000000) + BigInt(ms) * BigInt(1000000); + view.setBigUint64(time, result, true); + return WasiErrno.ESUCCESS; + } + default: return WasiErrno.EINVAL; + } + }); + this.fd_advise = syscallWrap(this, 'fd_advise', function (_fd, _offset, _len, _advice) { + return WasiErrno.ENOSYS; + }); + this.fd_fdstat_get = syscallWrap(this, 'fd_fdstat_get', function (fd, fdstat) { + fdstat = Number(fdstat); + if (fdstat === 0) { + return WasiErrno.EINVAL; + } + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, BigInt(0), BigInt(0)); + const { view } = getMemory(this); + view.setUint16(fdstat, fileDescriptor.type, true); + view.setUint16(fdstat + 2, 0, true); + view.setBigUint64(fdstat + 8, fileDescriptor.rightsBase, true); + view.setBigUint64(fdstat + 16, fileDescriptor.rightsInheriting, true); + return WasiErrno.ESUCCESS; + }); + this.fd_fdstat_set_flags = syscallWrap(this, 'fd_fdstat_set_flags', function (_fd, _flags) { + return WasiErrno.ENOSYS; + }); + this.fd_fdstat_set_rights = syscallWrap(this, 'fd_fdstat_set_rights', function (fd, rightsBase, rightsInheriting) { + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, BigInt(0), BigInt(0)); + if ((rightsBase | fileDescriptor.rightsBase) > fileDescriptor.rightsBase) { + return WasiErrno.ENOTCAPABLE; + } + if ((rightsInheriting | fileDescriptor.rightsInheriting) > + fileDescriptor.rightsInheriting) { + return WasiErrno.ENOTCAPABLE; + } + fileDescriptor.rightsBase = rightsBase; + fileDescriptor.rightsInheriting = rightsInheriting; + return WasiErrno.ESUCCESS; + }); + this.fd_prestat_get = syscallWrap(this, 'fd_prestat_get', function (fd, prestat) { + prestat = Number(prestat); + if (prestat === 0) { + return WasiErrno.EINVAL; + } + const wasi = _wasi.get(this); + let fileDescriptor; + try { + fileDescriptor = wasi.fds.get(fd, BigInt(0), BigInt(0)); + } + catch (err) { + if (err instanceof WasiError) + return err.errno; + throw err; + } + if (fileDescriptor.preopen !== 1) + return WasiErrno.EINVAL; + const { view } = getMemory(this); + // preopen type is dir(0) + view.setUint32(prestat, 0, true); + view.setUint32(prestat + 4, encoder.encode(fileDescriptor.path).length, true); + return WasiErrno.ESUCCESS; + }); + this.fd_prestat_dir_name = syscallWrap(this, 'fd_prestat_dir_name', function (fd, path, path_len) { + path = Number(path); + path_len = Number(path_len); + if (path === 0) { + return WasiErrno.EINVAL; + } + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, BigInt(0), BigInt(0)); + if (fileDescriptor.preopen !== 1) + return WasiErrno.EBADF; + const buffer = encoder.encode(fileDescriptor.path); + const size = buffer.length; + if (size > path_len) + return WasiErrno.ENOBUFS; + const { HEAPU8 } = getMemory(this); + HEAPU8.set(buffer, path); + return WasiErrno.ESUCCESS; + }); + this.fd_seek = syscallWrap(this, 'fd_seek', function (fd, offset, whence, newOffset) { + newOffset = Number(newOffset); + if (newOffset === 0) { + return WasiErrno.EINVAL; + } + if (fd === 0 || fd === 1 || fd === 2) + return WasiErrno.ESUCCESS; + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_SEEK, BigInt(0)); + const r = fileDescriptor.seek(offset, whence); + const { view } = getMemory(this); + view.setBigUint64(newOffset, r, true); + return WasiErrno.ESUCCESS; + }); + this.fd_tell = syscallWrap(this, 'fd_tell', function (fd, offset) { + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_TELL, BigInt(0)); + const pos = BigInt(fileDescriptor.pos); + const { view } = getMemory(this); + view.setBigUint64(Number(offset), pos, true); + return WasiErrno.ESUCCESS; + }); + this.poll_oneoff = syscallWrap(this, 'poll_oneoff', function (in_ptr, out_ptr, nsubscriptions, nevents) { + in_ptr = Number(in_ptr); + out_ptr = Number(out_ptr); + nevents = Number(nevents); + nsubscriptions = Number(nsubscriptions); + nsubscriptions = nsubscriptions >>> 0; + if (in_ptr === 0 || out_ptr === 0 || nsubscriptions === 0 || nevents === 0) { + return WasiErrno.EINVAL; + } + const { view } = getMemory(this); + view.setUint32(nevents, 0, true); + let i = 0; + let timer_userdata = BigInt(0); + let cur_timeout = BigInt(0); + let has_timeout = 0; + let min_timeout = BigInt(0); + let sub; + const subscriptions = Array(nsubscriptions); + for (i = 0; i < nsubscriptions; i++) { + sub = in_ptr + i * 48; + const userdata = view.getBigUint64(sub, true); + const type = view.getUint8(sub + 8); + const clockIdOrFd = view.getUint32(sub + 16, true); + const timeout = view.getBigUint64(sub + 24, true); + const precision = view.getBigUint64(sub + 32, true); + const flags = view.getUint16(sub + 40, true); + subscriptions[i] = { + userdata, + type, + u: { + clock: { + clock_id: clockIdOrFd, + timeout, + precision, + flags + }, + fd_readwrite: { + fd: clockIdOrFd + } + } + }; + } + const fdevents = []; + for (i = 0; i < nsubscriptions; i++) { + sub = subscriptions[i]; + switch (sub.type) { + case WasiEventType.CLOCK: { + if (sub.u.clock.flags === WasiSubclockflags.ABSTIME) { + /* Convert absolute time to relative delay. */ + const now = BigInt(Date.now()) * BigInt(1000000); + cur_timeout = sub.u.clock.timeout - now; + } + else { + cur_timeout = sub.u.clock.timeout; + } + if (has_timeout === 0 || cur_timeout < min_timeout) { + min_timeout = cur_timeout; + timer_userdata = sub.userdata; + has_timeout = 1; + } + break; + } + case WasiEventType.FD_READ: + case WasiEventType.FD_WRITE: + fdevents.push(sub); + break; + default: return WasiErrno.EINVAL; + } + } + if (fdevents.length > 0) { + for (i = 0; i < fdevents.length; i++) { + const fdevent = fdevents[i]; + const event = out_ptr + 32 * i; + view.setBigUint64(event, fdevent.userdata, true); + view.setUint32(event + 8, WasiErrno.ENOSYS, true); + view.setUint32(event + 12, fdevent.type, true); + view.setBigUint64(event + 16, BigInt(0), true); + view.setUint16(event + 24, 0, true); + view.setUint32(nevents, 1, true); + } + view.setUint32(nevents, fdevents.length, true); + return WasiErrno.ESUCCESS; + } + if (has_timeout) { + const delay = Number(min_timeout / BigInt(1000000)); + // if (isMainThread || typeof SharedArrayBuffer !== 'function') { + sleepBreakIf(delay, () => false); + // } else { + // const buf = new SharedArrayBuffer(4) + // const arr = new Int32Array(buf) + // postMsg({ + // __tybys_wasm_util_wasi__: { + // type: 'set-timeout', + // payload: { + // buffer: buf, + // delay + // } + // } + // }) + // Atomics.wait(arr, 0, 0) + // } + const event = out_ptr; + view.setBigUint64(event, timer_userdata, true); + view.setUint32(event + 8, WasiErrno.ESUCCESS, true); + view.setUint32(event + 12, WasiEventType.CLOCK, true); + view.setUint32(nevents, 1, true); + } + return WasiErrno.ESUCCESS; + }); + this.proc_exit = syscallWrap(this, 'proc_exit', function (rval) { + if ((typeof process === 'object') && (process !== null) && (typeof process.exit === 'function')) { + process.exit(rval); + } + return WasiErrno.ESUCCESS; + }); + this.proc_raise = syscallWrap(this, 'proc_raise', function (_sig) { + return WasiErrno.ENOSYS; + }); + this.sched_yield = syscallWrap(this, 'sched_yield', function () { + return WasiErrno.ESUCCESS; + }); + this.random_get = typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function' + ? syscallWrap(this, 'random_get', function (buf, buf_len) { + buf = Number(buf); + if (buf === 0) { + return WasiErrno.EINVAL; + } + buf_len = Number(buf_len); + const { HEAPU8, view } = getMemory(this); + if ((typeof SharedArrayBuffer === 'function' && HEAPU8.buffer instanceof SharedArrayBuffer) || + (Object.prototype.toString.call(HEAPU8.buffer) === '[object SharedArrayBuffer]')) { + for (let i = buf; i < buf + buf_len; ++i) { + view.setUint8(i, Math.floor(Math.random() * 256)); + } + return WasiErrno.ESUCCESS; + } + let pos; + const stride = 65536; + for (pos = 0; pos + stride < buf_len; pos += stride) { + crypto.getRandomValues(HEAPU8.subarray(buf + pos, buf + pos + stride)); + } + crypto.getRandomValues(HEAPU8.subarray(buf + pos, buf + buf_len)); + return WasiErrno.ESUCCESS; + }) + : syscallWrap(this, 'random_get', function (buf, buf_len) { + buf = Number(buf); + if (buf === 0) { + return WasiErrno.EINVAL; + } + buf_len = Number(buf_len); + const { view } = getMemory(this); + for (let i = buf; i < buf + buf_len; ++i) { + view.setUint8(i, Math.floor(Math.random() * 256)); + } + return WasiErrno.ESUCCESS; + }); + this.sock_recv = syscallWrap(this, 'sock_recv', function () { + return WasiErrno.ENOTSUP; + }); + this.sock_send = syscallWrap(this, 'sock_send', function () { + return WasiErrno.ENOTSUP; + }); + this.sock_shutdown = syscallWrap(this, 'sock_shutdown', function () { + return WasiErrno.ENOTSUP; + }); + this.sock_accept = syscallWrap(this, 'sock_accept', function () { + return WasiErrno.ENOTSUP; + }); + _wasi.set(this, { + fds, + args, + env + }); + if (fs) + _fs.set(this, fs); + // eslint-disable-next-line @typescript-eslint/no-this-alias + const _this = this; + function defineImport(name, syncVersion, asyncVersion, parameterType, returnType) { + if (asyncFs) { + if (asyncify) { + _this[name] = asyncify.wrapImportFunction(syscallWrap(_this, name, asyncVersion)); + } + else { + _this[name] = wrapAsyncImport(syscallWrap(_this, name, asyncVersion), parameterType, returnType); + } + } + else { + _this[name] = syscallWrap(_this, name, syncVersion); + } + } + defineImport('fd_allocate', function fd_allocate(fd, offset, len) { + const wasi = _wasi.get(this); + const fs = getFs(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_ALLOCATE, BigInt(0)); + const stat = fs.fstatSync(fileDescriptor.fd, { bigint: true }); + if (stat.size < offset + len) { + fs.ftruncateSync(fileDescriptor.fd, Number(offset + len)); + } + return WasiErrno.ESUCCESS; + }, async function fd_allocate(fd, offset, len) { + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_ALLOCATE, BigInt(0)); + const h = fileDescriptor.fd; + const stat = await h.stat({ bigint: true }); + if (stat.size < offset + len) { + await h.truncate(Number(offset + len)); + } + return WasiErrno.ESUCCESS; + }, ['i32', 'i64', 'f64'], ['i32']); + defineImport('fd_close', function fd_close(fd) { + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, BigInt(0), BigInt(0)); + const fs = getFs(this); + fs.closeSync(fileDescriptor.fd); + wasi.fds.remove(fd); + return WasiErrno.ESUCCESS; + }, async function fd_close(fd) { + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, BigInt(0), BigInt(0)); + await fileDescriptor.fd.close(); + wasi.fds.remove(fd); + return WasiErrno.ESUCCESS; + }, ['i32'], ['i32']); + defineImport('fd_datasync', function fd_datasync(fd) { + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_DATASYNC, BigInt(0)); + const fs = getFs(this); + fs.fdatasyncSync(fileDescriptor.fd); + return WasiErrno.ESUCCESS; + }, async function fd_datasync(fd) { + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_DATASYNC, BigInt(0)); + await fileDescriptor.fd.datasync(); + return WasiErrno.ESUCCESS; + }, ['i32'], ['i32']); + defineImport('fd_filestat_get', function fd_filestat_get(fd, buf) { + buf = Number(buf); + if (buf === 0) + return WasiErrno.EINVAL; + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_FILESTAT_GET, BigInt(0)); + const fs = getFs(this); + const stat = fs.fstatSync(fileDescriptor.fd, { bigint: true }); + const { view } = getMemory(this); + toFileStat(view, buf, stat); + return WasiErrno.ESUCCESS; + }, async function fd_filestat_get(fd, buf) { + buf = Number(buf); + if (buf === 0) + return WasiErrno.EINVAL; + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_FILESTAT_GET, BigInt(0)); + const h = fileDescriptor.fd; + const stat = await h.stat({ bigint: true }); + const { view } = getMemory(this); + toFileStat(view, buf, stat); + return WasiErrno.ESUCCESS; + }, ['i32', 'i32'], ['i32']); + defineImport('fd_filestat_set_size', function fd_filestat_set_size(fd, size) { + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_FILESTAT_SET_SIZE, BigInt(0)); + const fs = getFs(this); + fs.ftruncateSync(fileDescriptor.fd, Number(size)); + return WasiErrno.ESUCCESS; + }, async function fd_filestat_set_size(fd, size) { + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_FILESTAT_SET_SIZE, BigInt(0)); + const h = fileDescriptor.fd; + await h.truncate(Number(size)); + return WasiErrno.ESUCCESS; + }, ['i32', 'i64'], ['i32']); + function fdFilestatGetTimes(fd, atim, mtim, flags) { + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_FILESTAT_SET_TIMES, BigInt(0)); + if ((flags & WasiFstFlag.SET_ATIM_NOW) === WasiFstFlag.SET_ATIM_NOW) { + atim = BigInt(Date.now() * 1000000); + } + if ((flags & WasiFstFlag.SET_MTIM_NOW) === WasiFstFlag.SET_MTIM_NOW) { + mtim = BigInt(Date.now() * 1000000); + } + return { fileDescriptor, atim, mtim }; + } + defineImport('fd_filestat_set_times', function fd_filestat_set_times(fd, atim, mtim, flags) { + if (validateFstFlagsOrReturn(flags)) { + return WasiErrno.EINVAL; + } + const { fileDescriptor, atim: atimRes, mtim: mtimRes } = fdFilestatGetTimes.call(this, fd, atim, mtim, flags); + const fs = getFs(this); + fs.futimesSync(fileDescriptor.fd, Number(atimRes), Number(mtimRes)); + return WasiErrno.ESUCCESS; + }, async function fd_filestat_set_times(fd, atim, mtim, flags) { + if (validateFstFlagsOrReturn(flags)) { + return WasiErrno.EINVAL; + } + const { fileDescriptor, atim: atimRes, mtim: mtimRes } = fdFilestatGetTimes.call(this, fd, atim, mtim, flags); + const h = fileDescriptor.fd; + await h.utimes(Number(atimRes), Number(mtimRes)); + return WasiErrno.ESUCCESS; + }, ['i32', 'i64', 'i64', 'i32'], ['i32']); + defineImport('fd_pread', function fd_pread(fd, iovs, iovslen, offset, size) { + iovs = Number(iovs); + size = Number(size); + if ((iovs === 0 && iovslen) || size === 0 || offset > INT64_MAX) { + return WasiErrno.EINVAL; + } + const { HEAPU8, view } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_READ | WasiRights.FD_SEEK, BigInt(0)); + if (!iovslen) { + view.setUint32(size, 0, true); + return WasiErrno.ESUCCESS; + } + let totalSize = 0; + const ioVecs = Array.from({ length: Number(iovslen) }, (_, i) => { + const offset = iovs + (i * 8); + const buf = view.getInt32(offset, true); + const bufLen = view.getUint32(offset + 4, true); + totalSize += bufLen; + return HEAPU8.subarray(buf, buf + bufLen); + }); + let nread = 0; + const buffer = (() => { + try { + return new Uint8Array(new SharedArrayBuffer(totalSize)); + } + catch (_) { + return new Uint8Array(totalSize); + } + })(); + buffer._isBuffer = true; + const fs = getFs(this); + const bytesRead = fs.readSync(fileDescriptor.fd, buffer, 0, buffer.length, Number(offset)); + nread = buffer ? copyMemory(ioVecs, buffer.subarray(0, bytesRead)) : 0; + view.setUint32(size, nread, true); + return WasiErrno.ESUCCESS; + }, async function (fd, iovs, iovslen, offset, size) { + iovs = Number(iovs); + size = Number(size); + if ((iovs === 0 && iovslen) || size === 0 || offset > INT64_MAX) { + return WasiErrno.EINVAL; + } + const { HEAPU8, view } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_READ | WasiRights.FD_SEEK, BigInt(0)); + if (!iovslen) { + view.setUint32(size, 0, true); + return WasiErrno.ESUCCESS; + } + let totalSize = 0; + const ioVecs = Array.from({ length: Number(iovslen) }, (_, i) => { + const offset = iovs + (i * 8); + const buf = view.getInt32(offset, true); + const bufLen = view.getUint32(offset + 4, true); + totalSize += bufLen; + return HEAPU8.subarray(buf, buf + bufLen); + }); + let nread = 0; + const buffer = new Uint8Array(totalSize); + buffer._isBuffer = true; + const { bytesRead } = await fileDescriptor.fd.read(buffer, 0, buffer.length, Number(offset)); + nread = buffer ? copyMemory(ioVecs, buffer.subarray(0, bytesRead)) : 0; + view.setUint32(size, nread, true); + return WasiErrno.ESUCCESS; + }, ['i32', 'i32', 'i32', 'i64', 'i32'], ['i32']); + defineImport('fd_pwrite', function fd_pwrite(fd, iovs, iovslen, offset, size) { + iovs = Number(iovs); + size = Number(size); + if ((iovs === 0 && iovslen) || size === 0 || offset > INT64_MAX) { + return WasiErrno.EINVAL; + } + const { HEAPU8, view } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_WRITE | WasiRights.FD_SEEK, BigInt(0)); + if (!iovslen) { + view.setUint32(size, 0, true); + return WasiErrno.ESUCCESS; + } + const buffer = concatBuffer(Array.from({ length: Number(iovslen) }, (_, i) => { + const offset = iovs + (i * 8); + const buf = view.getInt32(offset, true); + const bufLen = view.getUint32(offset + 4, true); + return HEAPU8.subarray(buf, buf + bufLen); + })); + const fs = getFs(this); + const nwritten = fs.writeSync(fileDescriptor.fd, buffer, 0, buffer.length, Number(offset)); + view.setUint32(size, nwritten, true); + return WasiErrno.ESUCCESS; + }, async function fd_pwrite(fd, iovs, iovslen, offset, size) { + iovs = Number(iovs); + size = Number(size); + if ((iovs === 0 && iovslen) || size === 0 || offset > INT64_MAX) { + return WasiErrno.EINVAL; + } + const { HEAPU8, view } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_WRITE | WasiRights.FD_SEEK, BigInt(0)); + if (!iovslen) { + view.setUint32(size, 0, true); + return WasiErrno.ESUCCESS; + } + const buffer = concatBuffer(Array.from({ length: Number(iovslen) }, (_, i) => { + const offset = iovs + (i * 8); + const buf = view.getInt32(offset, true); + const bufLen = view.getUint32(offset + 4, true); + return HEAPU8.subarray(buf, buf + bufLen); + })); + const { bytesWritten } = await fileDescriptor.fd.write(buffer, 0, buffer.length, Number(offset)); + view.setUint32(size, bytesWritten, true); + return WasiErrno.ESUCCESS; + }, ['i32', 'i32', 'i32', 'i64', 'i32'], ['i32']); + defineImport('fd_read', function fd_read(fd, iovs, iovslen, size) { + iovs = Number(iovs); + size = Number(size); + if ((iovs === 0 && iovslen) || size === 0) { + return WasiErrno.EINVAL; + } + const { HEAPU8, view } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_READ, BigInt(0)); + if (!iovslen) { + view.setUint32(size, 0, true); + return WasiErrno.ESUCCESS; + } + let totalSize = 0; + const ioVecs = Array.from({ length: Number(iovslen) }, (_, i) => { + const offset = iovs + (i * 8); + const buf = view.getInt32(offset, true); + const bufLen = view.getUint32(offset + 4, true); + totalSize += bufLen; + return HEAPU8.subarray(buf, buf + bufLen); + }); + let buffer; + let nread = 0; + if (fd === 0) { + if (typeof window === 'undefined' || typeof window.prompt !== 'function') { + return WasiErrno.ENOTSUP; + } + buffer = readStdin(); + nread = buffer ? copyMemory(ioVecs, buffer) : 0; + } + else { + buffer = (() => { + try { + return new Uint8Array(new SharedArrayBuffer(totalSize)); + } + catch (_) { + return new Uint8Array(totalSize); + } + })(); + buffer._isBuffer = true; + const fs = getFs(this); + const bytesRead = fs.readSync(fileDescriptor.fd, buffer, 0, buffer.length, Number(fileDescriptor.pos)); + nread = buffer ? copyMemory(ioVecs, buffer.subarray(0, bytesRead)) : 0; + fileDescriptor.pos += BigInt(nread); + } + view.setUint32(size, nread, true); + return WasiErrno.ESUCCESS; + }, async function fd_read(fd, iovs, iovslen, size) { + iovs = Number(iovs); + size = Number(size); + if ((iovs === 0 && iovslen) || size === 0) { + return WasiErrno.EINVAL; + } + const { HEAPU8, view } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_READ, BigInt(0)); + if (!iovslen) { + view.setUint32(size, 0, true); + return WasiErrno.ESUCCESS; + } + let totalSize = 0; + const ioVecs = Array.from({ length: Number(iovslen) }, (_, i) => { + const offset = iovs + (i * 8); + const buf = view.getInt32(offset, true); + const bufLen = view.getUint32(offset + 4, true); + totalSize += bufLen; + return HEAPU8.subarray(buf, buf + bufLen); + }); + let buffer; + let nread = 0; + if (fd === 0) { + if (typeof window === 'undefined' || typeof window.prompt !== 'function') { + return WasiErrno.ENOTSUP; + } + buffer = readStdin(); + nread = buffer ? copyMemory(ioVecs, buffer) : 0; + } + else { + buffer = new Uint8Array(totalSize); + buffer._isBuffer = true; + const { bytesRead } = await fileDescriptor.fd.read(buffer, 0, buffer.length, Number(fileDescriptor.pos)); + nread = buffer ? copyMemory(ioVecs, buffer.subarray(0, bytesRead)) : 0; + fileDescriptor.pos += BigInt(nread); + } + view.setUint32(size, nread, true); + return WasiErrno.ESUCCESS; + }, ['i32', 'i32', 'i32', 'i32'], ['i32']); + defineImport('fd_readdir', function fd_readdir(fd, buf, buf_len, cookie, bufused) { + buf = Number(buf); + buf_len = Number(buf_len); + bufused = Number(bufused); + if (buf === 0 || bufused === 0) + return WasiErrno.ESUCCESS; + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_READDIR, BigInt(0)); + const fs = getFs(this); + const entries = fs.readdirSync(fileDescriptor.realPath, { withFileTypes: true }); + const { HEAPU8, view } = getMemory(this); + let bufferUsed = 0; + for (let i = Number(cookie); i < entries.length; i++) { + const nameData = encoder.encode(entries[i].name); + const entryInfo = fs.statSync(resolve(fileDescriptor.realPath, entries[i].name), { bigint: true }); + const entryData = new Uint8Array(24 + nameData.byteLength); + const entryView = new DataView(entryData.buffer); + entryView.setBigUint64(0, BigInt(i + 1), true); + entryView.setBigUint64(8, BigInt(entryInfo.ino ? entryInfo.ino : 0), true); + entryView.setUint32(16, nameData.byteLength, true); + let type; + if (entries[i].isFile()) { + type = WasiFileType.REGULAR_FILE; + } + else if (entries[i].isDirectory()) { + type = WasiFileType.DIRECTORY; + } + else if (entries[i].isSymbolicLink()) { + type = WasiFileType.SYMBOLIC_LINK; + } + else if (entries[i].isCharacterDevice()) { + type = WasiFileType.CHARACTER_DEVICE; + } + else if (entries[i].isBlockDevice()) { + type = WasiFileType.BLOCK_DEVICE; + } + else if (entries[i].isSocket()) { + type = WasiFileType.SOCKET_STREAM; + } + else { + type = WasiFileType.UNKNOWN; + } + entryView.setUint8(20, type); + entryData.set(nameData, 24); + const data = entryData.slice(0, Math.min(entryData.length, buf_len - bufferUsed)); + HEAPU8.set(data, buf + bufferUsed); + bufferUsed += data.byteLength; + } + view.setUint32(bufused, bufferUsed, true); + return WasiErrno.ESUCCESS; + }, async function fd_readdir(fd, buf, buf_len, cookie, bufused) { + buf = Number(buf); + buf_len = Number(buf_len); + bufused = Number(bufused); + if (buf === 0 || bufused === 0) + return WasiErrno.ESUCCESS; + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_READDIR, BigInt(0)); + const fs = getFs(this); + const entries = await fs.promises.readdir(fileDescriptor.realPath, { withFileTypes: true }); + const { HEAPU8, view } = getMemory(this); + let bufferUsed = 0; + for (let i = Number(cookie); i < entries.length; i++) { + const nameData = encoder.encode(entries[i].name); + const entryInfo = await fs.promises.stat(resolve(fileDescriptor.realPath, entries[i].name), { bigint: true }); + const entryData = new Uint8Array(24 + nameData.byteLength); + const entryView = new DataView(entryData.buffer); + entryView.setBigUint64(0, BigInt(i + 1), true); + entryView.setBigUint64(8, BigInt(entryInfo.ino ? entryInfo.ino : 0), true); + entryView.setUint32(16, nameData.byteLength, true); + let type; + if (entries[i].isFile()) { + type = WasiFileType.REGULAR_FILE; + } + else if (entries[i].isDirectory()) { + type = WasiFileType.DIRECTORY; + } + else if (entries[i].isSymbolicLink()) { + type = WasiFileType.SYMBOLIC_LINK; + } + else if (entries[i].isCharacterDevice()) { + type = WasiFileType.CHARACTER_DEVICE; + } + else if (entries[i].isBlockDevice()) { + type = WasiFileType.BLOCK_DEVICE; + } + else if (entries[i].isSocket()) { + type = WasiFileType.SOCKET_STREAM; + } + else { + type = WasiFileType.UNKNOWN; + } + entryView.setUint8(20, type); + entryData.set(nameData, 24); + const data = entryData.slice(0, Math.min(entryData.length, buf_len - bufferUsed)); + HEAPU8.set(data, buf + bufferUsed); + bufferUsed += data.byteLength; + } + view.setUint32(bufused, bufferUsed, true); + return WasiErrno.ESUCCESS; + }, ['i32', 'i32', 'i32', 'i64', 'i32'], ['i32']); + defineImport('fd_renumber', function fd_renumber(from, to) { + const wasi = _wasi.get(this); + wasi.fds.renumber(to, from); + return WasiErrno.ESUCCESS; + }, async function fd_renumber(from, to) { + const wasi = _wasi.get(this); + await wasi.fds.renumber(to, from); + return WasiErrno.ESUCCESS; + }, ['i32', 'i32'], ['i32']); + defineImport('fd_sync', function fd_sync(fd) { + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_SYNC, BigInt(0)); + const fs = getFs(this); + fs.fsyncSync(fileDescriptor.fd); + return WasiErrno.ESUCCESS; + }, async function fd_sync(fd) { + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_SYNC, BigInt(0)); + await fileDescriptor.fd.sync(); + return WasiErrno.ESUCCESS; + }, ['i32'], ['i32']); + defineImport('fd_write', function fd_write(fd, iovs, iovslen, size) { + iovs = Number(iovs); + size = Number(size); + if ((iovs === 0 && iovslen) || size === 0) { + return WasiErrno.EINVAL; + } + const { HEAPU8, view } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_WRITE, BigInt(0)); + if (!iovslen) { + view.setUint32(size, 0, true); + return WasiErrno.ESUCCESS; + } + const buffer = concatBuffer(Array.from({ length: Number(iovslen) }, (_, i) => { + const offset = iovs + (i * 8); + const buf = view.getInt32(offset, true); + const bufLen = view.getUint32(offset + 4, true); + return HEAPU8.subarray(buf, buf + bufLen); + })); + let nwritten; + if (fd === 1 || fd === 2) { + nwritten = fileDescriptor.write(buffer); + } + else { + const fs = getFs(this); + nwritten = fs.writeSync(fileDescriptor.fd, buffer, 0, buffer.length, Number(fileDescriptor.pos)); + fileDescriptor.pos += BigInt(nwritten); + } + view.setUint32(size, nwritten, true); + return WasiErrno.ESUCCESS; + }, async function fd_write(fd, iovs, iovslen, size) { + iovs = Number(iovs); + size = Number(size); + if ((iovs === 0 && iovslen) || size === 0) { + return WasiErrno.EINVAL; + } + const { HEAPU8, view } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_WRITE, BigInt(0)); + if (!iovslen) { + view.setUint32(size, 0, true); + return WasiErrno.ESUCCESS; + } + const buffer = concatBuffer(Array.from({ length: Number(iovslen) }, (_, i) => { + const offset = iovs + (i * 8); + const buf = view.getInt32(offset, true); + const bufLen = view.getUint32(offset + 4, true); + return HEAPU8.subarray(buf, buf + bufLen); + })); + let nwritten; + if (fd === 1 || fd === 2) { + nwritten = fileDescriptor.write(buffer); + } + else { + nwritten = await (await (fileDescriptor.fd.write(buffer, 0, buffer.length, Number(fileDescriptor.pos)))).bytesWritten; + fileDescriptor.pos += BigInt(nwritten); + } + view.setUint32(size, nwritten, true); + return WasiErrno.ESUCCESS; + }, ['i32', 'i32', 'i32', 'i32'], ['i32']); + defineImport('path_create_directory', function path_create_directory(fd, path, path_len) { + path = Number(path); + path_len = Number(path_len); + if (path === 0) { + return WasiErrno.EINVAL; + } + const { HEAPU8 } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_CREATE_DIRECTORY, BigInt(0)); + let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len)); + pathString = resolve(fileDescriptor.realPath, pathString); + const fs = getFs(this); + fs.mkdirSync(pathString); + return WasiErrno.ESUCCESS; + }, async function path_create_directory(fd, path, path_len) { + path = Number(path); + path_len = Number(path_len); + if (path === 0) { + return WasiErrno.EINVAL; + } + const { HEAPU8 } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_CREATE_DIRECTORY, BigInt(0)); + let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len)); + pathString = resolve(fileDescriptor.realPath, pathString); + const fs = getFs(this); + await fs.promises.mkdir(pathString); + return WasiErrno.ESUCCESS; + }, ['i32', 'i32', 'i32'], ['i32']); + defineImport('path_filestat_get', function path_filestat_get(fd, flags, path, path_len, filestat) { + path = Number(path); + path_len = Number(path_len); + filestat = Number(filestat); + if (path === 0 || filestat === 0) { + return WasiErrno.EINVAL; + } + const { HEAPU8, view } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_FILESTAT_GET, BigInt(0)); + let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len)); + const fs = getFs(this); + pathString = resolve(fileDescriptor.realPath, pathString); + let stat; + if ((flags & 1) === 1) { + stat = fs.statSync(pathString, { bigint: true }); + } + else { + stat = fs.lstatSync(pathString, { bigint: true }); + } + toFileStat(view, filestat, stat); + return WasiErrno.ESUCCESS; + }, async function path_filestat_get(fd, flags, path, path_len, filestat) { + path = Number(path); + path_len = Number(path_len); + filestat = Number(filestat); + if (path === 0 || filestat === 0) { + return WasiErrno.EINVAL; + } + const { HEAPU8, view } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_FILESTAT_GET, BigInt(0)); + let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len)); + const fs = getFs(this); + pathString = resolve(fileDescriptor.realPath, pathString); + let stat; + if ((flags & 1) === 1) { + stat = await fs.promises.stat(pathString, { bigint: true }); + } + else { + stat = await fs.promises.lstat(pathString, { bigint: true }); + } + toFileStat(view, filestat, stat); + return WasiErrno.ESUCCESS; + }, ['i32', 'i32', 'i32', 'i32', 'i32'], ['i32']); + defineImport('path_filestat_set_times', function path_filestat_set_times(fd, flags, path, path_len, atim, mtim, fst_flags) { + path = Number(path); + path_len = Number(path_len); + if (path === 0) + return WasiErrno.EINVAL; + const { HEAPU8 } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_FILESTAT_SET_TIMES, BigInt(0)); + if (validateFstFlagsOrReturn(fst_flags)) { + return WasiErrno.EINVAL; + } + const fs = getFs(this); + const resolvedPath = resolvePathSync(fs, fileDescriptor, decoder.decode(unsharedSlice(HEAPU8, path, path + path_len)), flags); + if ((fst_flags & WasiFstFlag.SET_ATIM_NOW) === WasiFstFlag.SET_ATIM_NOW) { + atim = BigInt(Date.now() * 1000000); + } + if ((fst_flags & WasiFstFlag.SET_MTIM_NOW) === WasiFstFlag.SET_MTIM_NOW) { + mtim = BigInt(Date.now() * 1000000); + } + fs.utimesSync(resolvedPath, Number(atim), Number(mtim)); + return WasiErrno.ESUCCESS; + }, async function path_filestat_set_times(fd, flags, path, path_len, atim, mtim, fst_flags) { + path = Number(path); + path_len = Number(path_len); + if (path === 0) + return WasiErrno.EINVAL; + const { HEAPU8 } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_FILESTAT_SET_TIMES, BigInt(0)); + if (validateFstFlagsOrReturn(fst_flags)) { + return WasiErrno.EINVAL; + } + const fs = getFs(this); + const resolvedPath = await resolvePathAsync(fs, fileDescriptor, decoder.decode(unsharedSlice(HEAPU8, path, path + path_len)), flags); + if ((fst_flags & WasiFstFlag.SET_ATIM_NOW) === WasiFstFlag.SET_ATIM_NOW) { + atim = BigInt(Date.now() * 1000000); + } + if ((fst_flags & WasiFstFlag.SET_MTIM_NOW) === WasiFstFlag.SET_MTIM_NOW) { + mtim = BigInt(Date.now() * 1000000); + } + await fs.promises.utimes(resolvedPath, Number(atim), Number(mtim)); + return WasiErrno.ESUCCESS; + }, ['i32', 'i32', 'i32', 'i32', 'i64', 'i64', 'i32'], ['i32']); + defineImport('path_link', function path_link(old_fd, old_flags, old_path, old_path_len, new_fd, new_path, new_path_len) { + old_path = Number(old_path); + old_path_len = Number(old_path_len); + new_path = Number(new_path); + new_path_len = Number(new_path_len); + if (old_path === 0 || new_path === 0) { + return WasiErrno.EINVAL; + } + const wasi = _wasi.get(this); + let oldWrap; + let newWrap; + if (old_fd === new_fd) { + oldWrap = newWrap = wasi.fds.get(old_fd, WasiRights.PATH_LINK_SOURCE | WasiRights.PATH_LINK_TARGET, BigInt(0)); + } + else { + oldWrap = wasi.fds.get(old_fd, WasiRights.PATH_LINK_SOURCE, BigInt(0)); + newWrap = wasi.fds.get(new_fd, WasiRights.PATH_LINK_TARGET, BigInt(0)); + } + const { HEAPU8 } = getMemory(this); + const fs = getFs(this); + const resolvedOldPath = resolvePathSync(fs, oldWrap, decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len)), old_flags); + const resolvedNewPath = resolve(newWrap.realPath, decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len))); + fs.linkSync(resolvedOldPath, resolvedNewPath); + return WasiErrno.ESUCCESS; + }, async function path_link(old_fd, old_flags, old_path, old_path_len, new_fd, new_path, new_path_len) { + old_path = Number(old_path); + old_path_len = Number(old_path_len); + new_path = Number(new_path); + new_path_len = Number(new_path_len); + if (old_path === 0 || new_path === 0) { + return WasiErrno.EINVAL; + } + const wasi = _wasi.get(this); + let oldWrap; + let newWrap; + if (old_fd === new_fd) { + oldWrap = newWrap = wasi.fds.get(old_fd, WasiRights.PATH_LINK_SOURCE | WasiRights.PATH_LINK_TARGET, BigInt(0)); + } + else { + oldWrap = wasi.fds.get(old_fd, WasiRights.PATH_LINK_SOURCE, BigInt(0)); + newWrap = wasi.fds.get(new_fd, WasiRights.PATH_LINK_TARGET, BigInt(0)); + } + const { HEAPU8 } = getMemory(this); + const fs = getFs(this); + const resolvedOldPath = await resolvePathAsync(fs, oldWrap, decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len)), old_flags); + const resolvedNewPath = resolve(newWrap.realPath, decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len))); + await fs.promises.link(resolvedOldPath, resolvedNewPath); + return WasiErrno.ESUCCESS; + }, ['i32', 'i32', 'i32', 'i32', 'i32', 'i32', 'i32'], ['i32']); + function pathOpen(o_flags, fs_rights_base, fs_rights_inheriting, fs_flags) { + const read = (fs_rights_base & (WasiRights.FD_READ | + WasiRights.FD_READDIR)) !== BigInt(0); + const write = (fs_rights_base & (WasiRights.FD_DATASYNC | + WasiRights.FD_WRITE | + WasiRights.FD_ALLOCATE | + WasiRights.FD_FILESTAT_SET_SIZE)) !== BigInt(0); + let flags = write ? read ? FileControlFlag.O_RDWR : FileControlFlag.O_WRONLY : FileControlFlag.O_RDONLY; + let needed_base = WasiRights.PATH_OPEN; + let needed_inheriting = fs_rights_base | fs_rights_inheriting; + if ((o_flags & WasiFileControlFlag.O_CREAT) !== 0) { + flags |= FileControlFlag.O_CREAT; + needed_base |= WasiRights.PATH_CREATE_FILE; + } + if ((o_flags & WasiFileControlFlag.O_DIRECTORY) !== 0) { + flags |= FileControlFlag.O_DIRECTORY; + } + if ((o_flags & WasiFileControlFlag.O_EXCL) !== 0) { + flags |= FileControlFlag.O_EXCL; + } + if ((o_flags & WasiFileControlFlag.O_TRUNC) !== 0) { + flags |= FileControlFlag.O_TRUNC; + needed_base |= WasiRights.PATH_FILESTAT_SET_SIZE; + } + if ((fs_flags & WasiFdFlag.APPEND) !== 0) { + flags |= FileControlFlag.O_APPEND; + } + if ((fs_flags & WasiFdFlag.DSYNC) !== 0) { + // flags |= FileControlFlag.O_DSYNC; + needed_inheriting |= WasiRights.FD_DATASYNC; + } + if ((fs_flags & WasiFdFlag.NONBLOCK) !== 0) { + flags |= FileControlFlag.O_NONBLOCK; + } + if ((fs_flags & WasiFdFlag.RSYNC) !== 0) { + flags |= FileControlFlag.O_SYNC; + needed_inheriting |= WasiRights.FD_SYNC; + } + if ((fs_flags & WasiFdFlag.SYNC) !== 0) { + flags |= FileControlFlag.O_SYNC; + needed_inheriting |= WasiRights.FD_SYNC; + } + if (write && (flags & (FileControlFlag.O_APPEND | FileControlFlag.O_TRUNC)) === 0) { + needed_inheriting |= WasiRights.FD_SEEK; + } + return { flags, needed_base, needed_inheriting }; + } + defineImport('path_open', function path_open(dirfd, dirflags, path, path_len, o_flags, fs_rights_base, fs_rights_inheriting, fs_flags, fd) { + path = Number(path); + fd = Number(fd); + if (path === 0 || fd === 0) { + return WasiErrno.EINVAL; + } + path_len = Number(path_len); + fs_rights_base = BigInt(fs_rights_base); + fs_rights_inheriting = BigInt(fs_rights_inheriting); + const { flags: flagsRes, needed_base: neededBase, needed_inheriting: neededInheriting } = pathOpen(o_flags, fs_rights_base, fs_rights_inheriting, fs_flags); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(dirfd, neededBase, neededInheriting); + const memory = getMemory(this); + const HEAPU8 = memory.HEAPU8; + const pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len)); + const fs = getFs(this); + const resolved_path = resolvePathSync(fs, fileDescriptor, pathString, dirflags); + const r = fs.openSync(resolved_path, _isWin32Flags ? _toWinOpenFlags(flagsRes) : flagsRes, 0o666); + const filetype = wasi.fds.getFileTypeByFd(r); + if ((filetype !== WasiFileType.DIRECTORY) && + ((o_flags & WasiFileControlFlag.O_DIRECTORY) !== 0 || + (resolved_path.endsWith('/')))) { + return WasiErrno.ENOTDIR; + } + const { base: max_base, inheriting: max_inheriting } = getRights(wasi.fds.stdio, r, flagsRes, filetype); + const wrap = wasi.fds.insert(r, resolved_path, resolved_path, filetype, fs_rights_base & max_base, fs_rights_inheriting & max_inheriting, 0); + const stat = fs.fstatSync(r, { bigint: true }); + if (stat.isFile()) { + wrap.size = stat.size; + if ((flagsRes & FileControlFlag.O_APPEND) !== 0) { + wrap.pos = stat.size; + } + } + const view = memory.view; + view.setInt32(fd, wrap.id, true); + return WasiErrno.ESUCCESS; + }, async function path_open(dirfd, dirflags, path, path_len, o_flags, fs_rights_base, fs_rights_inheriting, fs_flags, fd) { + path = Number(path); + fd = Number(fd); + if (path === 0 || fd === 0) { + return WasiErrno.EINVAL; + } + path_len = Number(path_len); + fs_rights_base = BigInt(fs_rights_base); + fs_rights_inheriting = BigInt(fs_rights_inheriting); + const { flags: flagsRes, needed_base: neededBase, needed_inheriting: neededInheriting } = pathOpen(o_flags, fs_rights_base, fs_rights_inheriting, fs_flags); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(dirfd, neededBase, neededInheriting); + const memory = getMemory(this); + const HEAPU8 = memory.HEAPU8; + const pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len)); + const fs = getFs(this); + const resolved_path = await resolvePathAsync(fs, fileDescriptor, pathString, dirflags); + const r = await fs.promises.open(resolved_path, _isWin32Flags ? _toWinOpenFlags(flagsRes) : flagsRes, 0o666); + const filetype = await wasi.fds.getFileTypeByFd(r); + if ((o_flags & WasiFileControlFlag.O_DIRECTORY) !== 0 && filetype !== WasiFileType.DIRECTORY) { + return WasiErrno.ENOTDIR; + } + const { base: max_base, inheriting: max_inheriting } = getRights(wasi.fds.stdio, r.fd, flagsRes, filetype); + const wrap = wasi.fds.insert(r, resolved_path, resolved_path, filetype, fs_rights_base & max_base, fs_rights_inheriting & max_inheriting, 0); + const stat = await r.stat({ bigint: true }); + if (stat.isFile()) { + wrap.size = stat.size; + if ((flagsRes & FileControlFlag.O_APPEND) !== 0) { + wrap.pos = stat.size; + } + } + const view = memory.view; + view.setInt32(fd, wrap.id, true); + return WasiErrno.ESUCCESS; + }, ['i32', 'i32', 'i32', 'i32', 'i32', 'i64', 'i64', 'i32', 'i32'], ['i32']); + defineImport('path_readlink', function path_readlink(fd, path, path_len, buf, buf_len, bufused) { + path = Number(path); + path_len = Number(path_len); + buf = Number(buf); + buf_len = Number(buf_len); + bufused = Number(bufused); + if (path === 0 || buf === 0 || bufused === 0) { + return WasiErrno.EINVAL; + } + const { HEAPU8, view } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_READLINK, BigInt(0)); + let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len)); + pathString = resolve(fileDescriptor.realPath, pathString); + const fs = getFs(this); + const link = fs.readlinkSync(pathString); + const linkData = encoder.encode(link); + const len = Math.min(linkData.length, buf_len); + if (len >= buf_len) + return WasiErrno.ENOBUFS; + HEAPU8.set(linkData.subarray(0, len), buf); + HEAPU8[buf + len] = 0; + view.setUint32(bufused, len, true); + return WasiErrno.ESUCCESS; + }, async function path_readlink(fd, path, path_len, buf, buf_len, bufused) { + path = Number(path); + path_len = Number(path_len); + buf = Number(buf); + buf_len = Number(buf_len); + bufused = Number(bufused); + if (path === 0 || buf === 0 || bufused === 0) { + return WasiErrno.EINVAL; + } + const { HEAPU8, view } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_READLINK, BigInt(0)); + let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len)); + pathString = resolve(fileDescriptor.realPath, pathString); + const fs = getFs(this); + const link = await fs.promises.readlink(pathString); + const linkData = encoder.encode(link); + const len = Math.min(linkData.length, buf_len); + if (len >= buf_len) + return WasiErrno.ENOBUFS; + HEAPU8.set(linkData.subarray(0, len), buf); + HEAPU8[buf + len] = 0; + view.setUint32(bufused, len, true); + return WasiErrno.ESUCCESS; + }, ['i32', 'i32', 'i32', 'i32', 'i32', 'i32'], ['i32']); + defineImport('path_remove_directory', function path_remove_directory(fd, path, path_len) { + path = Number(path); + path_len = Number(path_len); + if (path === 0) { + return WasiErrno.EINVAL; + } + const { HEAPU8 } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_REMOVE_DIRECTORY, BigInt(0)); + let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len)); + pathString = resolve(fileDescriptor.realPath, pathString); + const fs = getFs(this); + fs.rmdirSync(pathString); + return WasiErrno.ESUCCESS; + }, async function path_remove_directory(fd, path, path_len) { + path = Number(path); + path_len = Number(path_len); + if (path === 0) { + return WasiErrno.EINVAL; + } + const { HEAPU8 } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_REMOVE_DIRECTORY, BigInt(0)); + let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len)); + pathString = resolve(fileDescriptor.realPath, pathString); + const fs = getFs(this); + await fs.promises.rmdir(pathString); + return WasiErrno.ESUCCESS; + }, ['i32', 'i32', 'i32'], ['i32']); + defineImport('path_rename', function path_rename(old_fd, old_path, old_path_len, new_fd, new_path, new_path_len) { + old_path = Number(old_path); + old_path_len = Number(old_path_len); + new_path = Number(new_path); + new_path_len = Number(new_path_len); + if (old_path === 0 || new_path === 0) { + return WasiErrno.EINVAL; + } + const wasi = _wasi.get(this); + let oldWrap; + let newWrap; + if (old_fd === new_fd) { + oldWrap = newWrap = wasi.fds.get(old_fd, WasiRights.PATH_RENAME_SOURCE | WasiRights.PATH_RENAME_TARGET, BigInt(0)); + } + else { + oldWrap = wasi.fds.get(old_fd, WasiRights.PATH_RENAME_SOURCE, BigInt(0)); + newWrap = wasi.fds.get(new_fd, WasiRights.PATH_RENAME_TARGET, BigInt(0)); + } + const { HEAPU8 } = getMemory(this); + const resolvedOldPath = resolve(oldWrap.realPath, decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len))); + const resolvedNewPath = resolve(newWrap.realPath, decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len))); + const fs = getFs(this); + fs.renameSync(resolvedOldPath, resolvedNewPath); + return WasiErrno.ESUCCESS; + }, async function path_rename(old_fd, old_path, old_path_len, new_fd, new_path, new_path_len) { + old_path = Number(old_path); + old_path_len = Number(old_path_len); + new_path = Number(new_path); + new_path_len = Number(new_path_len); + if (old_path === 0 || new_path === 0) { + return WasiErrno.EINVAL; + } + const wasi = _wasi.get(this); + let oldWrap; + let newWrap; + if (old_fd === new_fd) { + oldWrap = newWrap = wasi.fds.get(old_fd, WasiRights.PATH_RENAME_SOURCE | WasiRights.PATH_RENAME_TARGET, BigInt(0)); + } + else { + oldWrap = wasi.fds.get(old_fd, WasiRights.PATH_RENAME_SOURCE, BigInt(0)); + newWrap = wasi.fds.get(new_fd, WasiRights.PATH_RENAME_TARGET, BigInt(0)); + } + const { HEAPU8 } = getMemory(this); + const resolvedOldPath = resolve(oldWrap.realPath, decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len))); + const resolvedNewPath = resolve(newWrap.realPath, decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len))); + const fs = getFs(this); + await fs.promises.rename(resolvedOldPath, resolvedNewPath); + return WasiErrno.ESUCCESS; + }, ['i32', 'i32', 'i32', 'i32', 'i32', 'i32'], ['i32']); + defineImport('path_symlink', function path_symlink(old_path, old_path_len, fd, new_path, new_path_len) { + old_path = Number(old_path); + old_path_len = Number(old_path_len); + new_path = Number(new_path); + new_path_len = Number(new_path_len); + if (old_path === 0 || new_path === 0) { + return WasiErrno.EINVAL; + } + const { HEAPU8 } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_SYMLINK, BigInt(0)); + const oldPath = decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len)); + if (oldPath.length > 0 && oldPath[0] === '/') { + return WasiErrno.EPERM; + } + let newPath = decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len)); + newPath = resolve(fileDescriptor.realPath, newPath); + const fs = getFs(this); + fs.symlinkSync(oldPath, newPath); + return WasiErrno.ESUCCESS; + }, async function path_symlink(old_path, old_path_len, fd, new_path, new_path_len) { + old_path = Number(old_path); + old_path_len = Number(old_path_len); + new_path = Number(new_path); + new_path_len = Number(new_path_len); + if (old_path === 0 || new_path === 0) { + return WasiErrno.EINVAL; + } + const { HEAPU8 } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_SYMLINK, BigInt(0)); + const oldPath = decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len)); + let newPath = decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len)); + newPath = resolve(fileDescriptor.realPath, newPath); + const fs = getFs(this); + await fs.promises.symlink(oldPath, newPath); + return WasiErrno.ESUCCESS; + }, ['i32', 'i32', 'i32', 'i32', 'i32'], ['i32']); + defineImport('path_unlink_file', function path_unlink_file(fd, path, path_len) { + path = Number(path); + path_len = Number(path_len); + if (path === 0) { + return WasiErrno.EINVAL; + } + const { HEAPU8 } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_UNLINK_FILE, BigInt(0)); + let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len)); + pathString = resolve(fileDescriptor.realPath, pathString); + const fs = getFs(this); + fs.unlinkSync(pathString); + return WasiErrno.ESUCCESS; + }, async function path_unlink_file(fd, path, path_len) { + path = Number(path); + path_len = Number(path_len); + if (path === 0) { + return WasiErrno.EINVAL; + } + const { HEAPU8 } = getMemory(this); + const wasi = _wasi.get(this); + const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_UNLINK_FILE, BigInt(0)); + let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len)); + pathString = resolve(fileDescriptor.realPath, pathString); + const fs = getFs(this); + await fs.promises.unlink(pathString); + return WasiErrno.ESUCCESS; + }, ['i32', 'i32', 'i32'], ['i32']); + this._setMemory = function setMemory(m) { + if (!(m instanceof _WebAssembly.Memory)) { + throw new TypeError('"instance.exports.memory" property must be a WebAssembly.Memory'); + } + _memory.set(_this, extendMemory(m)); + }; + } + static createSync(args, env, preopens, stdio, fs, print, printErr) { + const fds = new SyncTable({ + size: 3, + in: stdio[0], + out: stdio[1], + err: stdio[2], + fs, + print, + printErr + }); + const _this = new WASI(args, env, fds, false, fs); + if (preopens.length > 0) { + for (let i = 0; i < preopens.length; ++i) { + const realPath = fs.realpathSync(preopens[i].realPath, 'utf8'); + const fd = fs.openSync(realPath, 'r', 0o666); + fds.insertPreopen(fd, preopens[i].mappedPath, realPath); + } + } + return _this; + } + static async createAsync(args, env, preopens, stdio, fs, print, printErr, asyncify) { + const fds = new AsyncTable({ + size: 3, + in: stdio[0], + out: stdio[1], + err: stdio[2], + print, + printErr + }); + const _this = new WASI(args, env, fds, true, fs, asyncify); + if (preopens.length > 0) { + for (let i = 0; i < preopens.length; ++i) { + const entry = preopens[i]; + const realPath = await fs.promises.realpath(entry.realPath); + const fd = await fs.promises.open(realPath, 'r', 0o666); + await fds.insertPreopen(fd, entry.mappedPath, realPath); + } + } + return _this; + } +} diff --git a/node_modules/@tybys/wasm-util/lib/mjs/wasi/rights.mjs b/node_modules/@tybys/wasm-util/lib/mjs/wasi/rights.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b87351d5d924f14d66e34a4b3fd43a07cd989445 --- /dev/null +++ b/node_modules/@tybys/wasm-util/lib/mjs/wasi/rights.mjs @@ -0,0 +1,135 @@ +import { WasiError } from "./error.mjs"; +import { WasiErrno, WasiRights, WasiFileType } from "./types.mjs"; +export const RIGHTS_ALL = WasiRights.FD_DATASYNC | + WasiRights.FD_READ | + WasiRights.FD_SEEK | + WasiRights.FD_FDSTAT_SET_FLAGS | + WasiRights.FD_SYNC | + WasiRights.FD_TELL | + WasiRights.FD_WRITE | + WasiRights.FD_ADVISE | + WasiRights.FD_ALLOCATE | + WasiRights.PATH_CREATE_DIRECTORY | + WasiRights.PATH_CREATE_FILE | + WasiRights.PATH_LINK_SOURCE | + WasiRights.PATH_LINK_TARGET | + WasiRights.PATH_OPEN | + WasiRights.FD_READDIR | + WasiRights.PATH_READLINK | + WasiRights.PATH_RENAME_SOURCE | + WasiRights.PATH_RENAME_TARGET | + WasiRights.PATH_FILESTAT_GET | + WasiRights.PATH_FILESTAT_SET_SIZE | + WasiRights.PATH_FILESTAT_SET_TIMES | + WasiRights.FD_FILESTAT_GET | + WasiRights.FD_FILESTAT_SET_TIMES | + WasiRights.FD_FILESTAT_SET_SIZE | + WasiRights.PATH_SYMLINK | + WasiRights.PATH_UNLINK_FILE | + WasiRights.PATH_REMOVE_DIRECTORY | + WasiRights.POLL_FD_READWRITE | + WasiRights.SOCK_SHUTDOWN | + WasiRights.SOCK_ACCEPT; +export const BLOCK_DEVICE_BASE = RIGHTS_ALL; +export const BLOCK_DEVICE_INHERITING = RIGHTS_ALL; +export const CHARACTER_DEVICE_BASE = RIGHTS_ALL; +export const CHARACTER_DEVICE_INHERITING = RIGHTS_ALL; +export const REGULAR_FILE_BASE = WasiRights.FD_DATASYNC | + WasiRights.FD_READ | + WasiRights.FD_SEEK | + WasiRights.FD_FDSTAT_SET_FLAGS | + WasiRights.FD_SYNC | + WasiRights.FD_TELL | + WasiRights.FD_WRITE | + WasiRights.FD_ADVISE | + WasiRights.FD_ALLOCATE | + WasiRights.FD_FILESTAT_GET | + WasiRights.FD_FILESTAT_SET_SIZE | + WasiRights.FD_FILESTAT_SET_TIMES | + WasiRights.POLL_FD_READWRITE; +export const REGULAR_FILE_INHERITING = /*#__PURE__*/ BigInt(0); +export const DIRECTORY_BASE = WasiRights.FD_FDSTAT_SET_FLAGS | + WasiRights.FD_SYNC | + WasiRights.FD_ADVISE | + WasiRights.PATH_CREATE_DIRECTORY | + WasiRights.PATH_CREATE_FILE | + WasiRights.PATH_LINK_SOURCE | + WasiRights.PATH_LINK_TARGET | + WasiRights.PATH_OPEN | + WasiRights.FD_READDIR | + WasiRights.PATH_READLINK | + WasiRights.PATH_RENAME_SOURCE | + WasiRights.PATH_RENAME_TARGET | + WasiRights.PATH_FILESTAT_GET | + WasiRights.PATH_FILESTAT_SET_SIZE | + WasiRights.PATH_FILESTAT_SET_TIMES | + WasiRights.FD_FILESTAT_GET | + WasiRights.FD_FILESTAT_SET_TIMES | + WasiRights.PATH_SYMLINK | + WasiRights.PATH_UNLINK_FILE | + WasiRights.PATH_REMOVE_DIRECTORY | + WasiRights.POLL_FD_READWRITE; +export const DIRECTORY_INHERITING = DIRECTORY_BASE | REGULAR_FILE_BASE; +export const SOCKET_BASE = (WasiRights.FD_READ | + WasiRights.FD_FDSTAT_SET_FLAGS | + WasiRights.FD_WRITE | + WasiRights.FD_FILESTAT_GET | + WasiRights.POLL_FD_READWRITE | + WasiRights.SOCK_SHUTDOWN); +export const SOCKET_INHERITING = RIGHTS_ALL; +export const TTY_BASE = WasiRights.FD_READ | + WasiRights.FD_FDSTAT_SET_FLAGS | + WasiRights.FD_WRITE | + WasiRights.FD_FILESTAT_GET | + WasiRights.POLL_FD_READWRITE; +export const TTY_INHERITING = /*#__PURE__*/ BigInt(0); +export function getRights(stdio, fd, flags, type) { + const ret = { + base: BigInt(0), + inheriting: BigInt(0) + }; + if (type === WasiFileType.UNKNOWN) { + throw new WasiError('Unknown file type', WasiErrno.EINVAL); + } + switch (type) { + case WasiFileType.REGULAR_FILE: + ret.base = REGULAR_FILE_BASE; + ret.inheriting = REGULAR_FILE_INHERITING; + break; + case WasiFileType.DIRECTORY: + ret.base = DIRECTORY_BASE; + ret.inheriting = DIRECTORY_INHERITING; + break; + case WasiFileType.SOCKET_STREAM: + case WasiFileType.SOCKET_DGRAM: + ret.base = SOCKET_BASE; + ret.inheriting = SOCKET_INHERITING; + break; + case WasiFileType.CHARACTER_DEVICE: + if (stdio.indexOf(fd) !== -1) { + ret.base = TTY_BASE; + ret.inheriting = TTY_INHERITING; + } + else { + ret.base = CHARACTER_DEVICE_BASE; + ret.inheriting = CHARACTER_DEVICE_INHERITING; + } + break; + case WasiFileType.BLOCK_DEVICE: + ret.base = BLOCK_DEVICE_BASE; + ret.inheriting = BLOCK_DEVICE_INHERITING; + break; + default: + ret.base = BigInt(0); + ret.inheriting = BigInt(0); + } + /* Disable read/write bits depending on access mode. */ + const read_or_write_only = flags & (0 | 1 | 2); + if (read_or_write_only === 0) { + ret.base &= ~WasiRights.FD_WRITE; + } + else if (read_or_write_only === 1) { + ret.base &= ~WasiRights.FD_READ; + } + return ret; +} diff --git a/node_modules/@tybys/wasm-util/lib/mjs/wasi/types.mjs b/node_modules/@tybys/wasm-util/lib/mjs/wasi/types.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c18bdd689b26041d4e6ac7e52f76a093df947f5e --- /dev/null +++ b/node_modules/@tybys/wasm-util/lib/mjs/wasi/types.mjs @@ -0,0 +1,216 @@ +/* eslint-disable spaced-comment */ +export var WasiErrno; +(function (WasiErrno) { + WasiErrno[WasiErrno["ESUCCESS"] = 0] = "ESUCCESS"; + WasiErrno[WasiErrno["E2BIG"] = 1] = "E2BIG"; + WasiErrno[WasiErrno["EACCES"] = 2] = "EACCES"; + WasiErrno[WasiErrno["EADDRINUSE"] = 3] = "EADDRINUSE"; + WasiErrno[WasiErrno["EADDRNOTAVAIL"] = 4] = "EADDRNOTAVAIL"; + WasiErrno[WasiErrno["EAFNOSUPPORT"] = 5] = "EAFNOSUPPORT"; + WasiErrno[WasiErrno["EAGAIN"] = 6] = "EAGAIN"; + WasiErrno[WasiErrno["EALREADY"] = 7] = "EALREADY"; + WasiErrno[WasiErrno["EBADF"] = 8] = "EBADF"; + WasiErrno[WasiErrno["EBADMSG"] = 9] = "EBADMSG"; + WasiErrno[WasiErrno["EBUSY"] = 10] = "EBUSY"; + WasiErrno[WasiErrno["ECANCELED"] = 11] = "ECANCELED"; + WasiErrno[WasiErrno["ECHILD"] = 12] = "ECHILD"; + WasiErrno[WasiErrno["ECONNABORTED"] = 13] = "ECONNABORTED"; + WasiErrno[WasiErrno["ECONNREFUSED"] = 14] = "ECONNREFUSED"; + WasiErrno[WasiErrno["ECONNRESET"] = 15] = "ECONNRESET"; + WasiErrno[WasiErrno["EDEADLK"] = 16] = "EDEADLK"; + WasiErrno[WasiErrno["EDESTADDRREQ"] = 17] = "EDESTADDRREQ"; + WasiErrno[WasiErrno["EDOM"] = 18] = "EDOM"; + WasiErrno[WasiErrno["EDQUOT"] = 19] = "EDQUOT"; + WasiErrno[WasiErrno["EEXIST"] = 20] = "EEXIST"; + WasiErrno[WasiErrno["EFAULT"] = 21] = "EFAULT"; + WasiErrno[WasiErrno["EFBIG"] = 22] = "EFBIG"; + WasiErrno[WasiErrno["EHOSTUNREACH"] = 23] = "EHOSTUNREACH"; + WasiErrno[WasiErrno["EIDRM"] = 24] = "EIDRM"; + WasiErrno[WasiErrno["EILSEQ"] = 25] = "EILSEQ"; + WasiErrno[WasiErrno["EINPROGRESS"] = 26] = "EINPROGRESS"; + WasiErrno[WasiErrno["EINTR"] = 27] = "EINTR"; + WasiErrno[WasiErrno["EINVAL"] = 28] = "EINVAL"; + WasiErrno[WasiErrno["EIO"] = 29] = "EIO"; + WasiErrno[WasiErrno["EISCONN"] = 30] = "EISCONN"; + WasiErrno[WasiErrno["EISDIR"] = 31] = "EISDIR"; + WasiErrno[WasiErrno["ELOOP"] = 32] = "ELOOP"; + WasiErrno[WasiErrno["EMFILE"] = 33] = "EMFILE"; + WasiErrno[WasiErrno["EMLINK"] = 34] = "EMLINK"; + WasiErrno[WasiErrno["EMSGSIZE"] = 35] = "EMSGSIZE"; + WasiErrno[WasiErrno["EMULTIHOP"] = 36] = "EMULTIHOP"; + WasiErrno[WasiErrno["ENAMETOOLONG"] = 37] = "ENAMETOOLONG"; + WasiErrno[WasiErrno["ENETDOWN"] = 38] = "ENETDOWN"; + WasiErrno[WasiErrno["ENETRESET"] = 39] = "ENETRESET"; + WasiErrno[WasiErrno["ENETUNREACH"] = 40] = "ENETUNREACH"; + WasiErrno[WasiErrno["ENFILE"] = 41] = "ENFILE"; + WasiErrno[WasiErrno["ENOBUFS"] = 42] = "ENOBUFS"; + WasiErrno[WasiErrno["ENODEV"] = 43] = "ENODEV"; + WasiErrno[WasiErrno["ENOENT"] = 44] = "ENOENT"; + WasiErrno[WasiErrno["ENOEXEC"] = 45] = "ENOEXEC"; + WasiErrno[WasiErrno["ENOLCK"] = 46] = "ENOLCK"; + WasiErrno[WasiErrno["ENOLINK"] = 47] = "ENOLINK"; + WasiErrno[WasiErrno["ENOMEM"] = 48] = "ENOMEM"; + WasiErrno[WasiErrno["ENOMSG"] = 49] = "ENOMSG"; + WasiErrno[WasiErrno["ENOPROTOOPT"] = 50] = "ENOPROTOOPT"; + WasiErrno[WasiErrno["ENOSPC"] = 51] = "ENOSPC"; + WasiErrno[WasiErrno["ENOSYS"] = 52] = "ENOSYS"; + WasiErrno[WasiErrno["ENOTCONN"] = 53] = "ENOTCONN"; + WasiErrno[WasiErrno["ENOTDIR"] = 54] = "ENOTDIR"; + WasiErrno[WasiErrno["ENOTEMPTY"] = 55] = "ENOTEMPTY"; + WasiErrno[WasiErrno["ENOTRECOVERABLE"] = 56] = "ENOTRECOVERABLE"; + WasiErrno[WasiErrno["ENOTSOCK"] = 57] = "ENOTSOCK"; + WasiErrno[WasiErrno["ENOTSUP"] = 58] = "ENOTSUP"; + WasiErrno[WasiErrno["ENOTTY"] = 59] = "ENOTTY"; + WasiErrno[WasiErrno["ENXIO"] = 60] = "ENXIO"; + WasiErrno[WasiErrno["EOVERFLOW"] = 61] = "EOVERFLOW"; + WasiErrno[WasiErrno["EOWNERDEAD"] = 62] = "EOWNERDEAD"; + WasiErrno[WasiErrno["EPERM"] = 63] = "EPERM"; + WasiErrno[WasiErrno["EPIPE"] = 64] = "EPIPE"; + WasiErrno[WasiErrno["EPROTO"] = 65] = "EPROTO"; + WasiErrno[WasiErrno["EPROTONOSUPPORT"] = 66] = "EPROTONOSUPPORT"; + WasiErrno[WasiErrno["EPROTOTYPE"] = 67] = "EPROTOTYPE"; + WasiErrno[WasiErrno["ERANGE"] = 68] = "ERANGE"; + WasiErrno[WasiErrno["EROFS"] = 69] = "EROFS"; + WasiErrno[WasiErrno["ESPIPE"] = 70] = "ESPIPE"; + WasiErrno[WasiErrno["ESRCH"] = 71] = "ESRCH"; + WasiErrno[WasiErrno["ESTALE"] = 72] = "ESTALE"; + WasiErrno[WasiErrno["ETIMEDOUT"] = 73] = "ETIMEDOUT"; + WasiErrno[WasiErrno["ETXTBSY"] = 74] = "ETXTBSY"; + WasiErrno[WasiErrno["EXDEV"] = 75] = "EXDEV"; + WasiErrno[WasiErrno["ENOTCAPABLE"] = 76] = "ENOTCAPABLE"; +})(WasiErrno || (WasiErrno = {})); +export var WasiFileType; +(function (WasiFileType) { + WasiFileType[WasiFileType["UNKNOWN"] = 0] = "UNKNOWN"; + WasiFileType[WasiFileType["BLOCK_DEVICE"] = 1] = "BLOCK_DEVICE"; + WasiFileType[WasiFileType["CHARACTER_DEVICE"] = 2] = "CHARACTER_DEVICE"; + WasiFileType[WasiFileType["DIRECTORY"] = 3] = "DIRECTORY"; + WasiFileType[WasiFileType["REGULAR_FILE"] = 4] = "REGULAR_FILE"; + WasiFileType[WasiFileType["SOCKET_DGRAM"] = 5] = "SOCKET_DGRAM"; + WasiFileType[WasiFileType["SOCKET_STREAM"] = 6] = "SOCKET_STREAM"; + WasiFileType[WasiFileType["SYMBOLIC_LINK"] = 7] = "SYMBOLIC_LINK"; +})(WasiFileType || (WasiFileType = {})); +const FD_DATASYNC = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(0)); +const FD_READ = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(1)); +const FD_SEEK = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(2)); +const FD_FDSTAT_SET_FLAGS = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(3)); +const FD_SYNC = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(4)); +const FD_TELL = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(5)); +const FD_WRITE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(6)); +const FD_ADVISE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(7)); +const FD_ALLOCATE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(8)); +const PATH_CREATE_DIRECTORY = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(9)); +const PATH_CREATE_FILE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(10)); +const PATH_LINK_SOURCE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(11)); +const PATH_LINK_TARGET = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(12)); +const PATH_OPEN = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(13)); +const FD_READDIR = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(14)); +const PATH_READLINK = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(15)); +const PATH_RENAME_SOURCE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(16)); +const PATH_RENAME_TARGET = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(17)); +const PATH_FILESTAT_GET = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(18)); +const PATH_FILESTAT_SET_SIZE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(19)); +const PATH_FILESTAT_SET_TIMES = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(20)); +const FD_FILESTAT_GET = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(21)); +const FD_FILESTAT_SET_SIZE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(22)); +const FD_FILESTAT_SET_TIMES = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(23)); +const PATH_SYMLINK = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(24)); +const PATH_REMOVE_DIRECTORY = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(25)); +const PATH_UNLINK_FILE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(26)); +const POLL_FD_READWRITE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(27)); +const SOCK_SHUTDOWN = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(28)); +const SOCK_ACCEPT = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(29)); +export const WasiRights = { + FD_DATASYNC, + FD_READ, + FD_SEEK, + FD_FDSTAT_SET_FLAGS, + FD_SYNC, + FD_TELL, + FD_WRITE, + FD_ADVISE, + FD_ALLOCATE, + PATH_CREATE_DIRECTORY, + PATH_CREATE_FILE, + PATH_LINK_SOURCE, + PATH_LINK_TARGET, + PATH_OPEN, + FD_READDIR, + PATH_READLINK, + PATH_RENAME_SOURCE, + PATH_RENAME_TARGET, + PATH_FILESTAT_GET, + PATH_FILESTAT_SET_SIZE, + PATH_FILESTAT_SET_TIMES, + FD_FILESTAT_GET, + FD_FILESTAT_SET_SIZE, + FD_FILESTAT_SET_TIMES, + PATH_SYMLINK, + PATH_REMOVE_DIRECTORY, + PATH_UNLINK_FILE, + POLL_FD_READWRITE, + SOCK_SHUTDOWN, + SOCK_ACCEPT +}; +export var WasiWhence; +(function (WasiWhence) { + WasiWhence[WasiWhence["SET"] = 0] = "SET"; + WasiWhence[WasiWhence["CUR"] = 1] = "CUR"; + WasiWhence[WasiWhence["END"] = 2] = "END"; +})(WasiWhence || (WasiWhence = {})); +export var FileControlFlag; +(function (FileControlFlag) { + FileControlFlag[FileControlFlag["O_RDONLY"] = 0] = "O_RDONLY"; + FileControlFlag[FileControlFlag["O_WRONLY"] = 1] = "O_WRONLY"; + FileControlFlag[FileControlFlag["O_RDWR"] = 2] = "O_RDWR"; + FileControlFlag[FileControlFlag["O_CREAT"] = 64] = "O_CREAT"; + FileControlFlag[FileControlFlag["O_EXCL"] = 128] = "O_EXCL"; + FileControlFlag[FileControlFlag["O_NOCTTY"] = 256] = "O_NOCTTY"; + FileControlFlag[FileControlFlag["O_TRUNC"] = 512] = "O_TRUNC"; + FileControlFlag[FileControlFlag["O_APPEND"] = 1024] = "O_APPEND"; + FileControlFlag[FileControlFlag["O_DIRECTORY"] = 65536] = "O_DIRECTORY"; + FileControlFlag[FileControlFlag["O_NOATIME"] = 262144] = "O_NOATIME"; + FileControlFlag[FileControlFlag["O_NOFOLLOW"] = 131072] = "O_NOFOLLOW"; + FileControlFlag[FileControlFlag["O_SYNC"] = 1052672] = "O_SYNC"; + FileControlFlag[FileControlFlag["O_DIRECT"] = 16384] = "O_DIRECT"; + FileControlFlag[FileControlFlag["O_NONBLOCK"] = 2048] = "O_NONBLOCK"; +})(FileControlFlag || (FileControlFlag = {})); +export var WasiFileControlFlag; +(function (WasiFileControlFlag) { + WasiFileControlFlag[WasiFileControlFlag["O_CREAT"] = 1] = "O_CREAT"; + WasiFileControlFlag[WasiFileControlFlag["O_DIRECTORY"] = 2] = "O_DIRECTORY"; + WasiFileControlFlag[WasiFileControlFlag["O_EXCL"] = 4] = "O_EXCL"; + WasiFileControlFlag[WasiFileControlFlag["O_TRUNC"] = 8] = "O_TRUNC"; +})(WasiFileControlFlag || (WasiFileControlFlag = {})); +export var WasiFdFlag; +(function (WasiFdFlag) { + WasiFdFlag[WasiFdFlag["APPEND"] = 1] = "APPEND"; + WasiFdFlag[WasiFdFlag["DSYNC"] = 2] = "DSYNC"; + WasiFdFlag[WasiFdFlag["NONBLOCK"] = 4] = "NONBLOCK"; + WasiFdFlag[WasiFdFlag["RSYNC"] = 8] = "RSYNC"; + WasiFdFlag[WasiFdFlag["SYNC"] = 16] = "SYNC"; +})(WasiFdFlag || (WasiFdFlag = {})); +export var WasiClockid; +(function (WasiClockid) { + WasiClockid[WasiClockid["REALTIME"] = 0] = "REALTIME"; + WasiClockid[WasiClockid["MONOTONIC"] = 1] = "MONOTONIC"; + WasiClockid[WasiClockid["PROCESS_CPUTIME_ID"] = 2] = "PROCESS_CPUTIME_ID"; + WasiClockid[WasiClockid["THREAD_CPUTIME_ID"] = 3] = "THREAD_CPUTIME_ID"; +})(WasiClockid || (WasiClockid = {})); +export var WasiFstFlag; +(function (WasiFstFlag) { + WasiFstFlag[WasiFstFlag["SET_ATIM"] = 1] = "SET_ATIM"; + WasiFstFlag[WasiFstFlag["SET_ATIM_NOW"] = 2] = "SET_ATIM_NOW"; + WasiFstFlag[WasiFstFlag["SET_MTIM"] = 4] = "SET_MTIM"; + WasiFstFlag[WasiFstFlag["SET_MTIM_NOW"] = 8] = "SET_MTIM_NOW"; +})(WasiFstFlag || (WasiFstFlag = {})); +export var WasiEventType; +(function (WasiEventType) { + WasiEventType[WasiEventType["CLOCK"] = 0] = "CLOCK"; + WasiEventType[WasiEventType["FD_READ"] = 1] = "FD_READ"; + WasiEventType[WasiEventType["FD_WRITE"] = 2] = "FD_WRITE"; +})(WasiEventType || (WasiEventType = {})); +export var WasiSubclockflags; +(function (WasiSubclockflags) { + WasiSubclockflags[WasiSubclockflags["ABSTIME"] = 1] = "ABSTIME"; +})(WasiSubclockflags || (WasiSubclockflags = {})); diff --git a/node_modules/@tybys/wasm-util/lib/mjs/wasi/util.mjs b/node_modules/@tybys/wasm-util/lib/mjs/wasi/util.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a8ba329398053908c93156b8ed4dd77d2d18cd30 --- /dev/null +++ b/node_modules/@tybys/wasm-util/lib/mjs/wasi/util.mjs @@ -0,0 +1,113 @@ +/* eslint-disable spaced-comment */ +export function validateObject(value, name) { + if (value === null || typeof value !== 'object') { + throw new TypeError(`${name} must be an object. Received ${value === null ? 'null' : typeof value}`); + } +} +export function validateArray(value, name) { + if (!Array.isArray(value)) { + throw new TypeError(`${name} must be an array. Received ${value === null ? 'null' : typeof value}`); + } +} +export function validateBoolean(value, name) { + if (typeof value !== 'boolean') { + throw new TypeError(`${name} must be a boolean. Received ${value === null ? 'null' : typeof value}`); + } +} +export function validateString(value, name) { + if (typeof value !== 'string') { + throw new TypeError(`${name} must be a string. Received ${value === null ? 'null' : typeof value}`); + } +} +export function validateFunction(value, name) { + if (typeof value !== 'function') { + throw new TypeError(`${name} must be a function. Received ${value === null ? 'null' : typeof value}`); + } +} +export function validateUndefined(value, name) { + if (value !== undefined) { + throw new TypeError(`${name} must be undefined. Received ${value === null ? 'null' : typeof value}`); + } +} +export function validateInt32(value, name, min = -2147483648, max = 2147483647) { + if (typeof value !== 'number') { + throw new TypeError(`${name} must be a number. Received ${value === null ? 'null' : typeof value}`); + } + if (!Number.isInteger(value)) { + throw new RangeError(`${name} must be a integer.`); + } + if (value < min || value > max) { + throw new RangeError(`${name} must be >= ${min} && <= ${max}. Received ${value}`); + } +} +export function isPromiseLike(obj) { + return !!(obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function'); +} +export function wrapInstanceExports(exports, mapFn) { + const newExports = Object.create(null); + Object.keys(exports).forEach(name => { + const exportValue = exports[name]; + Object.defineProperty(newExports, name, { + enumerable: true, + value: mapFn(exportValue, name) + }); + }); + return newExports; +} +const _require = /*#__PURE__*/ (function () { + let nativeRequire; + if (typeof __webpack_public_path__ !== 'undefined') { + nativeRequire = (function () { + return typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : undefined; + })(); + } + else { + nativeRequire = (function () { + return typeof __webpack_public_path__ !== 'undefined' ? (typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : undefined) : (typeof require !== 'undefined' ? require : undefined); + })(); + } + return nativeRequire; +})(); +export const isMainThread = /*#__PURE__*/ (function () { + let worker_threads; + try { + worker_threads = _require('worker_threads'); + } + catch (_) { } + if (!worker_threads) { + return typeof importScripts === 'undefined'; + } + return worker_threads.isMainThread; +})(); +export const postMsg = isMainThread + ? () => { } + : /*#__PURE__*/ (function () { + let worker_threads; + try { + worker_threads = _require('worker_threads'); + } + catch (_) { } + if (!worker_threads) { + return postMessage; + } + return function postMessage(data) { + worker_threads.parentPort.postMessage({ data }); + }; + })(); +export function sleepBreakIf(delay, breakIf) { + const start = Date.now(); + const end = start + delay; + let ret = false; + while (Date.now() < end) { + if (breakIf()) { + ret = true; + break; + } + } + return ret; +} +export function unsharedSlice(view, start, end) { + return ((typeof SharedArrayBuffer === 'function' && view.buffer instanceof SharedArrayBuffer) || (Object.prototype.toString.call(view.buffer.constructor) === '[object SharedArrayBuffer]')) + ? view.slice(start, end) + : view.subarray(start, end); +} diff --git a/node_modules/@tybys/wasm-util/lib/mjs/webassembly.mjs b/node_modules/@tybys/wasm-util/lib/mjs/webassembly.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b4192f7c8dc07be899878088ff8a422d614a0f25 --- /dev/null +++ b/node_modules/@tybys/wasm-util/lib/mjs/webassembly.mjs @@ -0,0 +1,9 @@ +const _WebAssembly = typeof WebAssembly !== 'undefined' + ? WebAssembly + : typeof WXWebAssembly !== 'undefined' + ? WXWebAssembly + : undefined; +if (!_WebAssembly) { + throw new Error('WebAssembly is not supported in this environment'); +} +export { _WebAssembly }; diff --git a/node_modules/@tybys/wasm-util/package.json b/node_modules/@tybys/wasm-util/package.json new file mode 100644 index 0000000000000000000000000000000000000000..458f72ad00cc31f46f99230d7743e6acd054ee1d --- /dev/null +++ b/node_modules/@tybys/wasm-util/package.json @@ -0,0 +1,58 @@ +{ + "name": "@tybys/wasm-util", + "version": "0.10.2", + "description": "WASI polyfill for browser and some wasm util", + "main": "./lib/cjs/index.js", + "module": "./dist/wasm-util.esm-bundler.js", + "types": "./dist/wasm-util.d.ts", + "exports": { + ".": { + "module": "./dist/wasm-util.esm-bundler.js", + "import": "./lib/mjs/index.mjs", + "require": "./lib/cjs/index.js", + "types": "./dist/wasm-util.d.ts" + } + }, + "scripts": { + "build": "tsgo build", + "watch": "tsgo watch", + "test": "jest", + "lint": "eslint ./src/**/*.{ts,js} --fix", + "prepare": "npm run build" + }, + "publishConfig": { + "access": "public" + }, + "keywords": [ + "wasm", + "webassembly", + "wasi", + "polyfill" + ], + "repository": { + "type": "git", + "url": "https://github.com/toyobayashi/wasm-util.git" + }, + "author": "toyobayashi", + "license": "MIT", + "dependencies": { + "tslib": "^2.4.0" + }, + "devDependencies": { + "@tybys/ts-transform-module-specifier": "^0.0.2", + "@tybys/ts-transform-pure-class": "^0.1.1", + "@tybys/tsgo": "^1.1.0", + "@types/node": "^14.14.31", + "@typescript-eslint/eslint-plugin": "^5.40.1", + "@typescript-eslint/parser": "^5.40.1", + "eslint": "^8.25.0", + "eslint-config-standard-with-typescript": "^23.0.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-n": "^15.3.0", + "eslint-plugin-promise": "^6.1.0", + "memfs-browser": "^3.4.13000", + "mocha": "^10.1.0", + "ts-node": "^10.9.1", + "typescript": "~4.8.3" + } +} diff --git a/node_modules/@types/archiver/LICENSE b/node_modules/@types/archiver/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9e841e7a26e4eb057b24511e7b92d42b257a80e5 --- /dev/null +++ b/node_modules/@types/archiver/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/archiver/README.md b/node_modules/@types/archiver/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e2636872db75f37144a11551bedc0f8f578f30d8 --- /dev/null +++ b/node_modules/@types/archiver/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/archiver` + +# Summary +This package contains type definitions for archiver (https://github.com/archiverjs/node-archiver). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/archiver. + +### Additional Details + * Last updated: Mon, 27 Oct 2025 19:02:12 GMT + * Dependencies: [@types/readdir-glob](https://npmjs.com/package/@types/readdir-glob) + +# Credits +These definitions were written by [ Esri +// Dolan Miu](https://github.com/dolanmiu), [Crevil](https://github.com/crevil), and [Piotr Błażejewicz](https://github.com/peterblazejewicz). diff --git a/node_modules/@types/archiver/index.d.ts b/node_modules/@types/archiver/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..03d2d7d4cdd914271216dcae1b27ca316928d86f --- /dev/null +++ b/node_modules/@types/archiver/index.d.ts @@ -0,0 +1,137 @@ +import * as fs from "fs"; +import ReaddirGlob = require("readdir-glob"); +import stream = require("stream"); +import { ZlibOptions } from "zlib"; + +type Partial = { + [P in keyof T]?: T[P]; +}; + +// This library adds `cwd` to the options +type GlobOptions = ReaddirGlob.Options & { cwd?: string }; + +// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type -- support for ConstructorFn function and classes +type ConstructorFn = Function | (new(...params: any[]) => T); + +declare function archiver(format: archiver.Format, options?: archiver.ArchiverOptions): archiver.Archiver; + +declare namespace archiver { + type Format = "zip" | "tar"; + + function create(format: string, options?: ArchiverOptions): Archiver; + + /** Check if the format is already registered. */ + function isRegisteredFormat(format: string): boolean; + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type + function registerFormat(format: string, module: Function): void; + + interface EntryData { + /** Sets the entry name including internal path */ + name: string; + /** Sets the entry date */ + date?: Date | string | undefined; + /** Sets the entry permissions */ + mode?: number | undefined; + /** + * Sets a path prefix for the entry name. + * Useful when working with methods like `directory` or `glob` + */ + prefix?: string | undefined; + /** + * Sets the fs stat data for this entry allowing + * for reduction of fs stat calls when stat data is already known + */ + stats?: fs.Stats | undefined; + } + + interface ZipEntryData extends EntryData { + /** Sets the compression method to STORE */ + store?: boolean | undefined; + } + + type TarEntryData = EntryData; + + interface ProgressData { + entries: { + total: number; + processed: number; + }; + fs: { + totalBytes: number; + processedBytes: number; + }; + } + + /** A function that lets you either opt out of including an entry (by returning false), or modify the contents of an entry as it is added (by returning an EntryData) */ + type EntryDataFunction = (entry: EntryData) => false | EntryData; + + class ArchiverError extends Error { + code: string; // Since archiver format support is modular, we cannot enumerate all possible error codes, as the modules can throw arbitrary ones. + data: any; + path?: any; + + constructor(code: string, data: any); + } + + interface Archiver extends stream.Transform { + abort(): this; + append(source: stream.Readable | Buffer | string, data?: EntryData | ZipEntryData | TarEntryData): this; + + /** if false is passed for destpath, the path of a chunk of data in the archive is set to the root */ + directory(dirpath: string, destpath: false | string, data?: Partial | EntryDataFunction): this; + file(filename: string, data: EntryData): this; + glob(pattern: string, options?: GlobOptions, data?: Partial): this; + finalize(): Promise; + + setFormat(format: string): this; + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type + setModule(module: Function): this; + + pointer(): number; + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type + use(plugin: Function): this; + + symlink(filepath: string, target: string, mode?: number): this; + + on(event: "error" | "warning", listener: (error: ArchiverError) => void): this; + on(event: "data", listener: (data: Buffer) => void): this; + on(event: "progress", listener: (progress: ProgressData) => void): this; + on(event: "close" | "drain" | "finish", listener: () => void): this; + on(event: "pipe" | "unpipe", listener: (src: stream.Readable) => void): this; + on(event: "entry", listener: (entry: EntryData) => void): this; + on(event: string, listener: (...args: any[]) => void): this; + } + + type ArchiverOptions = CoreOptions & TransformOptions & ZipOptions & TarOptions; + + interface CoreOptions { + statConcurrency?: number | undefined; + } + + interface TransformOptions { + allowHalfOpen?: boolean | undefined; + readableObjectMode?: boolean | undefined; + writeableObjectMode?: boolean | undefined; + decodeStrings?: boolean | undefined; + encoding?: string | undefined; + highWaterMark?: number | undefined; + objectmode?: boolean | undefined; + } + + interface ZipOptions { + comment?: string | undefined; + forceLocalTime?: boolean | undefined; + forceZip64?: boolean | undefined; + /** @default false */ + namePrependSlash?: boolean | undefined; + store?: boolean | undefined; + zlib?: ZlibOptions | undefined; + } + + interface TarOptions { + gzip?: boolean | undefined; + gzipOptions?: ZlibOptions | undefined; + } +} + +export = archiver; diff --git a/node_modules/@types/archiver/package.json b/node_modules/@types/archiver/package.json new file mode 100644 index 0000000000000000000000000000000000000000..aa6fcd5ba50b17985c07894eae74cd79faf362eb --- /dev/null +++ b/node_modules/@types/archiver/package.json @@ -0,0 +1,38 @@ +{ + "name": "@types/archiver", + "version": "7.0.0", + "description": "TypeScript definitions for archiver", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/archiver", + "license": "MIT", + "contributors": [ + { + "name": " Esri\n// Dolan Miu", + "githubUsername": "dolanmiu", + "url": "https://github.com/dolanmiu" + }, + { + "name": "Crevil", + "githubUsername": "crevil", + "url": "https://github.com/crevil" + }, + { + "name": "Piotr Błażejewicz", + "githubUsername": "peterblazejewicz", + "url": "https://github.com/peterblazejewicz" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/archiver" + }, + "scripts": {}, + "dependencies": { + "@types/readdir-glob": "*" + }, + "peerDependencies": {}, + "typesPublisherContentHash": "731a8e9a62243b895360c618aa46fc9bff1b97c14b10a057e4ef77d343b04efc", + "typeScriptVersion": "5.2" +} \ No newline at end of file diff --git a/node_modules/@types/bcryptjs/LICENSE b/node_modules/@types/bcryptjs/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9e841e7a26e4eb057b24511e7b92d42b257a80e5 --- /dev/null +++ b/node_modules/@types/bcryptjs/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/bcryptjs/README.md b/node_modules/@types/bcryptjs/README.md new file mode 100644 index 0000000000000000000000000000000000000000..83835033906b5380bb0ac835ad675de82e95898d --- /dev/null +++ b/node_modules/@types/bcryptjs/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/bcryptjs` + +# Summary +This package contains type definitions for bcryptjs (https://github.com/dcodeIO/bcrypt.js). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bcryptjs. + +### Additional Details + * Last updated: Mon, 06 Nov 2023 22:41:04 GMT + * Dependencies: none + +# Credits +These definitions were written by [Joshua Filby](https://github.com/Joshua-F), [Rafael Kraut](https://github.com/RafaelKr), and [Branislav Holý](https://github.com/branoholy). diff --git a/node_modules/@types/bcryptjs/index.d.ts b/node_modules/@types/bcryptjs/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..961680e99d1d5e50cfea8aecf3d3ad369854ec0d --- /dev/null +++ b/node_modules/@types/bcryptjs/index.d.ts @@ -0,0 +1,124 @@ +/** + * Sets the pseudo random number generator to use as a fallback if neither node's crypto module nor the Web Crypto API is available. + * Please note: It is highly important that the PRNG used is cryptographically secure and that it is seeded properly! + * @param random Function taking the number of bytes to generate as its sole argument, returning the corresponding array of cryptographically secure random byte values. + */ +export declare function setRandomFallback(random: (random: number) => number[]): void; + +/** + * Synchronously generates a salt. + * @param rounds Number of rounds to use, defaults to 10 if omitted + * @return Resulting salt + * @throws If a random fallback is required but not set + */ +export declare function genSaltSync(rounds?: number): string; + +/** + * Asynchronously generates a salt. + * @param rounds Number of rounds to use, defaults to 10 if omitted + * @return Promise with resulting salt, if callback has been omitted + */ +export declare function genSalt(rounds?: number): Promise; + +/** + * Asynchronously generates a salt. + * @param callback Callback receiving the error, if any, and the resulting salt + */ +export declare function genSalt(callback: (err: Error | null, salt: string) => void): void; + +/** + * Asynchronously generates a salt. + * @param rounds Number of rounds to use, defaults to 10 if omitted + * @param callback Callback receiving the error, if any, and the resulting salt + */ +export declare function genSalt(rounds: number, callback: (err: Error | null, salt: string) => void): void; + +/** + * Synchronously generates a hash for the given string. + * @param s String to hash + * @param salt Salt length to generate or salt to use, default to 10 + * @return Resulting hash + */ +export declare function hashSync(s: string, salt?: number | string): string; + +/** + * Asynchronously generates a hash for the given string. + * @param s String to hash + * @param salt Salt length to generate or salt to use + * @return Promise with resulting hash, if callback has been omitted + */ +export declare function hash(s: string, salt: number | string): Promise; + +/** + * Asynchronously generates a hash for the given string. + * @param s String to hash + * @param salt Salt length to generate or salt to use + * @param callback Callback receiving the error, if any, and the resulting hash + * @param progressCallback Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per MAX_EXECUTION_TIME = 100 ms. + */ +export declare function hash( + s: string, + salt: number | string, + callback?: (err: Error | null, hash: string) => void, + progressCallback?: (percent: number) => void, +): void; + +/** + * Synchronously tests a string against a hash. + * @param s String to compare + * @param hash Hash to test against + * @return true if matching, otherwise false + */ +export declare function compareSync(s: string, hash: string): boolean; + +/** + * Asynchronously compares the given data against the given hash. + * @param s Data to compare + * @param hash Data to be compared to + * @return Promise, if callback has been omitted + */ +export declare function compare(s: string, hash: string): Promise; + +/** + * Asynchronously compares the given data against the given hash. + * @param s Data to compare + * @param hash Data to be compared to + * @param callback Callback receiving the error, if any, otherwise the result + * @param progressCallback Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per MAX_EXECUTION_TIME = 100 ms. + */ +export declare function compare( + s: string, + hash: string, + callback?: (err: Error | null, success: boolean) => void, + progressCallback?: (percent: number) => void, +): void; + +/** + * Gets the number of rounds used to encrypt the specified hash. + * @param hash Hash to extract the used number of rounds from + * @return Number of rounds used + */ +export declare function getRounds(hash: string): number; + +/** + * Gets the salt portion from a hash. Does not validate the hash. + * @param hash Hash to extract the salt from + * @return Extracted salt part + */ +export declare function getSalt(hash: string): string; + +/** + * Encodes a byte array to base64 with up to len bytes of input, using the custom bcrypt alphabet. + * @function + * @param b Byte array + * @param len Maximum input length + */ +export declare function encodeBase64(b: Readonly>, len: number): string; + +/** + * Decodes a base64 encoded string to up to len bytes of output, using the custom bcrypt alphabet. + * @function + * @param s String to decode + * @param len Maximum output length + */ +export declare function decodeBase64(s: string, len: number): number[]; diff --git a/node_modules/@types/bcryptjs/package.json b/node_modules/@types/bcryptjs/package.json new file mode 100644 index 0000000000000000000000000000000000000000..325a7a1d581c0e1d7f41e5ca0c5012a9b8814b95 --- /dev/null +++ b/node_modules/@types/bcryptjs/package.json @@ -0,0 +1,35 @@ +{ + "name": "@types/bcryptjs", + "version": "2.4.6", + "description": "TypeScript definitions for bcryptjs", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bcryptjs", + "license": "MIT", + "contributors": [ + { + "name": "Joshua Filby", + "githubUsername": "Joshua-F", + "url": "https://github.com/Joshua-F" + }, + { + "name": "Rafael Kraut", + "githubUsername": "RafaelKr", + "url": "https://github.com/RafaelKr" + }, + { + "name": "Branislav Holý", + "githubUsername": "branoholy", + "url": "https://github.com/branoholy" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/bcryptjs" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "b39980d6e9840f900b6f594a24d8f24dcce0864b2e9b631ed39ce6ef5b690daa", + "typeScriptVersion": "4.5" +} \ No newline at end of file diff --git a/node_modules/@types/better-sqlite3/LICENSE b/node_modules/@types/better-sqlite3/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9e841e7a26e4eb057b24511e7b92d42b257a80e5 --- /dev/null +++ b/node_modules/@types/better-sqlite3/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/better-sqlite3/README.md b/node_modules/@types/better-sqlite3/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e9948c910b4af20c82b7544f4846f1f6ef843d15 --- /dev/null +++ b/node_modules/@types/better-sqlite3/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/better-sqlite3` + +# Summary +This package contains type definitions for better-sqlite3 (https://github.com/JoshuaWise/better-sqlite3). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/better-sqlite3. + +### Additional Details + * Last updated: Fri, 04 Apr 2025 18:38:14 GMT + * Dependencies: [@types/node](https://npmjs.com/package/@types/node) + +# Credits +These definitions were written by [Ben Davies](https://github.com/Morfent), [Mathew Rumsey](https://github.com/matrumz), [Santiago Aguilar](https://github.com/sant123), [Alessandro Vergani](https://github.com/loghorn), [Andrew Kaiser](https://github.com/andykais), [Mark Stewart](https://github.com/mrkstwrt), [Florian Stamer](https://github.com/stamerf), and [Beeno Tung](https://github.com/beenotung). diff --git a/node_modules/@types/better-sqlite3/index.d.ts b/node_modules/@types/better-sqlite3/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e7f4f54e75a97bd6ef4217bb843ef096369e8341 --- /dev/null +++ b/node_modules/@types/better-sqlite3/index.d.ts @@ -0,0 +1,159 @@ +/// + +// FIXME: Is this `any` really necessary? +type VariableArgFunction = (...params: any[]) => unknown; +type ArgumentTypes = F extends (...args: infer A) => unknown ? A : never; +type ElementOf = T extends Array ? E : T; + +declare namespace BetterSqlite3 { + interface Statement { + database: Database; + source: string; + reader: boolean; + readonly: boolean; + busy: boolean; + + run(...params: BindParameters): Database.RunResult; + get(...params: BindParameters): Result | undefined; + all(...params: BindParameters): Result[]; + iterate(...params: BindParameters): IterableIterator; + pluck(toggleState?: boolean): this; + expand(toggleState?: boolean): this; + raw(toggleState?: boolean): this; + bind(...params: BindParameters): this; + columns(): ColumnDefinition[]; + safeIntegers(toggleState?: boolean): this; + } + + interface ColumnDefinition { + name: string; + column: string | null; + table: string | null; + database: string | null; + type: string | null; + } + + interface Transaction { + (...params: ArgumentTypes): ReturnType; + default(...params: ArgumentTypes): ReturnType; + deferred(...params: ArgumentTypes): ReturnType; + immediate(...params: ArgumentTypes): ReturnType; + exclusive(...params: ArgumentTypes): ReturnType; + } + + interface VirtualTableOptions { + rows: (...params: unknown[]) => Generator; + columns: string[]; + parameters?: string[] | undefined; + safeIntegers?: boolean | undefined; + directOnly?: boolean | undefined; + } + + interface Database { + memory: boolean; + readonly: boolean; + name: string; + open: boolean; + inTransaction: boolean; + + prepare( + source: string, + ): BindParameters extends unknown[] ? Statement : Statement<[BindParameters], Result>; + transaction(fn: F): Transaction; + exec(source: string): this; + pragma(source: string, options?: Database.PragmaOptions): unknown; + function( + name: string, + cb: (...params: any[]) => any, + ): this; + function( + name: string, + options: Database.RegistrationOptions, + cb: (...params: any[]) => any, + ): this; + aggregate( + name: string, + options: Database.RegistrationOptions & { + start?: T | (() => T); + // eslint-disable-next-line @typescript-eslint/no-invalid-void-type + step: (total: T, next: ElementOf) => T | void; + inverse?: ((total: T, dropped: T) => T) | undefined; + result?: ((total: T) => unknown) | undefined; + }, + ): this; + loadExtension(path: string): this; + close(): this; + defaultSafeIntegers(toggleState?: boolean): this; + backup(destinationFile: string, options?: Database.BackupOptions): Promise; + table(name: string, options: VirtualTableOptions): this; + unsafeMode(unsafe?: boolean): this; + serialize(options?: Database.SerializeOptions): Buffer; + } + + interface DatabaseConstructor { + new(filename?: string | Buffer, options?: Database.Options): Database; + (filename?: string, options?: Database.Options): Database; + prototype: Database; + SqliteError: SqliteErrorType; + } +} + +declare class SqliteErrorClass extends Error { + name: string; + message: string; + code: string; + constructor(message: string, code: string); +} + +type SqliteErrorType = typeof SqliteErrorClass; + +declare namespace Database { + interface RunResult { + changes: number; + lastInsertRowid: number | bigint; + } + + interface Options { + readonly?: boolean | undefined; + fileMustExist?: boolean | undefined; + timeout?: number | undefined; + verbose?: ((message?: unknown, ...additionalArgs: unknown[]) => void) | undefined; + nativeBinding?: string | undefined; + } + + interface SerializeOptions { + attached?: string; + } + + interface PragmaOptions { + simple?: boolean | undefined; + } + + interface RegistrationOptions { + varargs?: boolean | undefined; + deterministic?: boolean | undefined; + safeIntegers?: boolean | undefined; + directOnly?: boolean | undefined; + } + + type AggregateOptions = Parameters[1]; + + interface BackupMetadata { + totalPages: number; + remainingPages: number; + } + interface BackupOptions { + progress: (info: BackupMetadata) => number; + } + + type SqliteError = SqliteErrorType; + type Statement = BindParameters extends + unknown[] ? BetterSqlite3.Statement + : BetterSqlite3.Statement<[BindParameters], Result>; + type ColumnDefinition = BetterSqlite3.ColumnDefinition; + type Transaction = BetterSqlite3.Transaction; + type Database = BetterSqlite3.Database; +} + +declare const Database: BetterSqlite3.DatabaseConstructor; +export = Database; diff --git a/node_modules/@types/better-sqlite3/package.json b/node_modules/@types/better-sqlite3/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f92cf5a0fd0899e5098a93f0b7b44ec485fccfd6 --- /dev/null +++ b/node_modules/@types/better-sqlite3/package.json @@ -0,0 +1,63 @@ +{ + "name": "@types/better-sqlite3", + "version": "7.6.13", + "description": "TypeScript definitions for better-sqlite3", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/better-sqlite3", + "license": "MIT", + "contributors": [ + { + "name": "Ben Davies", + "githubUsername": "Morfent", + "url": "https://github.com/Morfent" + }, + { + "name": "Mathew Rumsey", + "githubUsername": "matrumz", + "url": "https://github.com/matrumz" + }, + { + "name": "Santiago Aguilar", + "githubUsername": "sant123", + "url": "https://github.com/sant123" + }, + { + "name": "Alessandro Vergani", + "githubUsername": "loghorn", + "url": "https://github.com/loghorn" + }, + { + "name": "Andrew Kaiser", + "githubUsername": "andykais", + "url": "https://github.com/andykais" + }, + { + "name": "Mark Stewart", + "githubUsername": "mrkstwrt", + "url": "https://github.com/mrkstwrt" + }, + { + "name": "Florian Stamer", + "githubUsername": "stamerf", + "url": "https://github.com/stamerf" + }, + { + "name": "Beeno Tung", + "githubUsername": "beenotung", + "url": "https://github.com/beenotung" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/better-sqlite3" + }, + "scripts": {}, + "dependencies": { + "@types/node": "*" + }, + "peerDependencies": {}, + "typesPublisherContentHash": "d3573b172a1ed98c5e63d112a1d270bef2b683e7f13829155088694326b5fbac", + "typeScriptVersion": "5.1" +} \ No newline at end of file diff --git a/node_modules/@types/body-parser/LICENSE b/node_modules/@types/body-parser/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9e841e7a26e4eb057b24511e7b92d42b257a80e5 --- /dev/null +++ b/node_modules/@types/body-parser/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/body-parser/README.md b/node_modules/@types/body-parser/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ab818af43af684b0338f12babfa083fd910fb10a --- /dev/null +++ b/node_modules/@types/body-parser/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/body-parser` + +# Summary +This package contains type definitions for body-parser (https://github.com/expressjs/body-parser). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/body-parser. + +### Additional Details + * Last updated: Sat, 07 Jun 2025 02:15:25 GMT + * Dependencies: [@types/connect](https://npmjs.com/package/@types/connect), [@types/node](https://npmjs.com/package/@types/node) + +# Credits +These definitions were written by [Santi Albo](https://github.com/santialbo), [Vilic Vane](https://github.com/vilic), [Jonathan Häberle](https://github.com/dreampulse), [Gevik Babakhani](https://github.com/blendsdk), [Tomasz Łaziuk](https://github.com/tlaziuk), [Jason Walton](https://github.com/jwalton), [Piotr Błażejewicz](https://github.com/peterblazejewicz), and [Sebastian Beltran](https://github.com/bjohansebas). diff --git a/node_modules/@types/body-parser/index.d.ts b/node_modules/@types/body-parser/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..96feda8227381251f826ebc70b70b3ee18bffe94 --- /dev/null +++ b/node_modules/@types/body-parser/index.d.ts @@ -0,0 +1,95 @@ +/// + +import { NextHandleFunction } from "connect"; +import * as http from "http"; + +// for docs go to https://github.com/expressjs/body-parser/tree/1.19.0#body-parser + +declare namespace bodyParser { + interface BodyParser { + /** + * @deprecated use individual json/urlencoded middlewares + */ + (options?: OptionsJson & OptionsText & OptionsUrlencoded): NextHandleFunction; + /** + * Returns middleware that only parses json and only looks at requests + * where the Content-Type header matches the type option. + */ + json(options?: OptionsJson): NextHandleFunction; + /** + * Returns middleware that parses all bodies as a Buffer and only looks at requests + * where the Content-Type header matches the type option. + */ + raw(options?: Options): NextHandleFunction; + + /** + * Returns middleware that parses all bodies as a string and only looks at requests + * where the Content-Type header matches the type option. + */ + text(options?: OptionsText): NextHandleFunction; + /** + * Returns middleware that only parses urlencoded bodies and only looks at requests + * where the Content-Type header matches the type option + */ + urlencoded(options?: OptionsUrlencoded): NextHandleFunction; + } + + interface Options { + /** When set to true, then deflated (compressed) bodies will be inflated; when false, deflated bodies are rejected. Defaults to true. */ + inflate?: boolean | undefined; + /** + * Controls the maximum request body size. If this is a number, + * then the value specifies the number of bytes; if it is a string, + * the value is passed to the bytes library for parsing. Defaults to '100kb'. + */ + limit?: number | string | undefined; + /** + * The type option is used to determine what media type the middleware will parse + */ + type?: string | string[] | ((req: http.IncomingMessage) => any) | undefined; + /** + * The verify option, if supplied, is called as verify(req, res, buf, encoding), + * where buf is a Buffer of the raw request body and encoding is the encoding of the request. + */ + verify?(req: http.IncomingMessage, res: http.ServerResponse, buf: Buffer, encoding: string): void; + } + + interface OptionsJson extends Options { + /** + * The reviver option is passed directly to JSON.parse as the second argument. + */ + reviver?(key: string, value: any): any; + /** + * When set to `true`, will only accept arrays and objects; + * when `false` will accept anything JSON.parse accepts. Defaults to `true`. + */ + strict?: boolean | undefined; + } + + interface OptionsText extends Options { + /** + * Specify the default character set for the text content if the charset + * is not specified in the Content-Type header of the request. + * Defaults to `utf-8`. + */ + defaultCharset?: string | undefined; + } + + interface OptionsUrlencoded extends Options { + /** + * The extended option allows to choose between parsing the URL-encoded data + * with the querystring library (when `false`) or the qs library (when `true`). + */ + extended?: boolean | undefined; + /** + * The parameterLimit option controls the maximum number of parameters + * that are allowed in the URL-encoded data. If a request contains more parameters than this value, + * a 413 will be returned to the client. Defaults to 1000. + */ + parameterLimit?: number | undefined; + } +} + +declare const bodyParser: bodyParser.BodyParser; + +export = bodyParser; diff --git a/node_modules/@types/body-parser/package.json b/node_modules/@types/body-parser/package.json new file mode 100644 index 0000000000000000000000000000000000000000..15e2dd6ca9c357a4b250d2956fdb7bf208c77496 --- /dev/null +++ b/node_modules/@types/body-parser/package.json @@ -0,0 +1,64 @@ +{ + "name": "@types/body-parser", + "version": "1.19.6", + "description": "TypeScript definitions for body-parser", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/body-parser", + "license": "MIT", + "contributors": [ + { + "name": "Santi Albo", + "githubUsername": "santialbo", + "url": "https://github.com/santialbo" + }, + { + "name": "Vilic Vane", + "githubUsername": "vilic", + "url": "https://github.com/vilic" + }, + { + "name": "Jonathan Häberle", + "githubUsername": "dreampulse", + "url": "https://github.com/dreampulse" + }, + { + "name": "Gevik Babakhani", + "githubUsername": "blendsdk", + "url": "https://github.com/blendsdk" + }, + { + "name": "Tomasz Łaziuk", + "githubUsername": "tlaziuk", + "url": "https://github.com/tlaziuk" + }, + { + "name": "Jason Walton", + "githubUsername": "jwalton", + "url": "https://github.com/jwalton" + }, + { + "name": "Piotr Błażejewicz", + "githubUsername": "peterblazejewicz", + "url": "https://github.com/peterblazejewicz" + }, + { + "name": "Sebastian Beltran", + "githubUsername": "bjohansebas", + "url": "https://github.com/bjohansebas" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/body-parser" + }, + "scripts": {}, + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + }, + "peerDependencies": {}, + "typesPublisherContentHash": "d788c843f427d6ca19640ee90eb433324a18f23aed05402a82c4e47e6d60b29d", + "typeScriptVersion": "5.1" +} \ No newline at end of file diff --git a/node_modules/@types/chai/LICENSE b/node_modules/@types/chai/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9e841e7a26e4eb057b24511e7b92d42b257a80e5 --- /dev/null +++ b/node_modules/@types/chai/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/chai/README.md b/node_modules/@types/chai/README.md new file mode 100644 index 0000000000000000000000000000000000000000..27c1356787f5bcbfe717ff68f4432722535f25ee --- /dev/null +++ b/node_modules/@types/chai/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/chai` + +# Summary +This package contains type definitions for chai (http://chaijs.com/). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chai. + +### Additional Details + * Last updated: Mon, 20 Oct 2025 23:32:35 GMT + * Dependencies: [@types/deep-eql](https://npmjs.com/package/@types/deep-eql), [assertion-error](https://npmjs.com/package/assertion-error) + +# Credits +These definitions were written by [Bart van der Schoor](https://github.com/Bartvds), [Andrew Brown](https://github.com/AGBrown), [Olivier Chevet](https://github.com/olivr70), [Matt Wistrand](https://github.com/mwistrand), [Shaun Luttin](https://github.com/shaunluttin), [Satana Charuwichitratana](https://github.com/micksatana), [Erik Schierboom](https://github.com/ErikSchierboom), [Bogdan Paranytsia](https://github.com/bparan), [CXuesong](https://github.com/CXuesong), and [Joey Kilpatrick](https://github.com/joeykilpatrick). diff --git a/node_modules/@types/chai/index.d.ts b/node_modules/@types/chai/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4fed6b906ef0d56b429ccaa9e2804915175e6f7e --- /dev/null +++ b/node_modules/@types/chai/index.d.ts @@ -0,0 +1,2145 @@ +import deepEqual = require("deep-eql"); +import { AssertionError as ImportedAssertionError } from "assertion-error"; + +declare global { + namespace Chai { + export type Message = string | (() => string); + export type ObjectProperty = string | symbol | number; + + export interface PathInfo { + parent: object; + name: string; + value?: any; + exists: boolean; + } + + export interface Constructor { + new(...args: any[]): T; + } + + export interface ErrorConstructor { + new(...args: any[]): Error; + } + + export interface ChaiUtils { + addChainableMethod( + // object to define the method on, e.g. chai.Assertion.prototype + ctx: object, + // method name + name: string, + // method itself; any arguments + method: (...args: any[]) => void, + // called when property is accessed + chainingBehavior?: () => void, + ): void; + overwriteChainableMethod( + ctx: object, + name: string, + method: (...args: any[]) => void, + chainingBehavior?: () => void, + ): void; + addLengthGuard( + fn: Function, + assertionName: string, + isChainable: boolean, + ): void; + addMethod(ctx: object, name: string, method: Function): void; + addProperty(ctx: object, name: string, getter: () => any): void; + overwriteMethod(ctx: object, name: string, method: Function): void; + overwriteProperty(ctx: object, name: string, getter: (this: AssertionStatic, _super: any) => any): void; + compareByInspect(a: object, b: object): -1 | 1; + expectTypes(obj: object, types: string[]): void; + flag(obj: object, key: string, value?: any): any; + getActual(obj: object, args: AssertionArgs): any; + getProperties(obj: object): string[]; + getEnumerableProperties(obj: object): string[]; + getOwnEnumerablePropertySymbols(obj: object): symbol[]; + getOwnEnumerableProperties(obj: object): Array; + getMessage(errorLike: Error | string): string; + getMessage(obj: any, args: AssertionArgs): string; + inspect(obj: any, showHidden?: boolean, depth?: number, colors?: boolean): string; + isProxyEnabled(): boolean; + objDisplay(obj: object): void; + proxify(obj: object, nonChainableMethodName: string): object; + test(obj: object, args: AssertionArgs): boolean; + transferFlags(assertion: Assertion, obj: object, includeAll?: boolean): void; + compatibleInstance(thrown: Error, errorLike: Error | ErrorConstructor): boolean; + compatibleConstructor(thrown: Error, errorLike: Error | ErrorConstructor): boolean; + compatibleMessage(thrown: Error, errMatcher: string | RegExp): boolean; + getConstructorName(constructorFn: Function): string; + getFuncName(constructorFn: Function): string | null; + + // Reexports from pathval: + hasProperty(obj: object | undefined | null, name: ObjectProperty): boolean; + getPathInfo(obj: object, path: string): PathInfo; + getPathValue(obj: object, path: string): object | undefined; + + eql: typeof deepEqual; + } + + export type ChaiPlugin = (chai: ChaiStatic, utils: ChaiUtils) => void; + + export interface ChaiStatic { + expect: ExpectStatic; + should(): Should; + /** + * Provides a way to extend the internals of Chai + */ + use(fn: ChaiPlugin): ChaiStatic; + util: ChaiUtils; + assert: AssertStatic; + config: Config; + Assertion: AssertionStatic; + AssertionError: typeof AssertionError; + version: string; + } + + export interface ExpectStatic { + (val: any, message?: string): Assertion; + fail(message?: string): never; + fail(actual: any, expected: any, message?: string, operator?: Operator): never; + } + + export interface AssertStatic extends Assert { + } + + // chai.Assertion.prototype.assert arguments + export type AssertionArgs = [ + any, // expression to be tested + Message, // message or function that returns message to display if expression fails + Message, // negatedMessage or function that returns negatedMessage to display if expression fails + any?, // expected value + any?, // actual value + boolean?, // showDiff, when set to `true`, assert will display a diff in addition to the message if expression fails + ]; + + export interface AssertionPrototype { + assert(...args: AssertionArgs): void; + _obj: any; + } + + export interface AssertionStatic extends AssertionPrototype { + prototype: AssertionPrototype; + + new(target: any, message?: string, ssfi?: Function, lockSsfi?: boolean): Assertion; + + // Deprecated properties: + includeStack: boolean; + showDiff: boolean; + + // Partials of functions on ChaiUtils: + addProperty(name: string, getter: (this: AssertionStatic) => any): void; + addMethod(name: string, method: (this: AssertionStatic, ...args: any[]) => any): void; + addChainableMethod( + name: string, + method: (this: AssertionStatic, ...args: any[]) => void, + chainingBehavior?: () => void, + ): void; + overwriteProperty(name: string, getter: (this: AssertionStatic, _super: any) => any): void; + overwriteMethod(name: string, method: (this: AssertionStatic, ...args: any[]) => any): void; + overwriteChainableMethod( + name: string, + method: (this: AssertionStatic, ...args: any[]) => void, + chainingBehavior?: () => void, + ): void; + } + + export type Operator = string; // "==" | "===" | ">" | ">=" | "<" | "<=" | "!=" | "!=="; + + export type OperatorComparable = boolean | null | number | string | undefined | Date; + + export interface ShouldAssertion { + equal(value1: any, value2: any, message?: string): void; + Throw: ShouldThrow; + throw: ShouldThrow; + exist(value: any, message?: string): void; + } + + export interface Should extends ShouldAssertion { + not: ShouldAssertion; + fail(message?: string): never; + fail(actual: any, expected: any, message?: string, operator?: Operator): never; + } + + export interface ShouldThrow { + (actual: Function, expected?: string | RegExp, message?: string): void; + (actual: Function, constructor: Error | Function, expected?: string | RegExp, message?: string): void; + } + + export interface Assertion extends LanguageChains, NumericComparison, TypeComparison { + not: Assertion; + deep: Deep; + ordered: Ordered; + nested: Nested; + own: Own; + any: KeyFilter; + all: KeyFilter; + a: Assertion; + an: Assertion; + include: Include; + includes: Include; + contain: Include; + contains: Include; + ok: Assertion; + true: Assertion; + false: Assertion; + null: Assertion; + undefined: Assertion; + NaN: Assertion; + exist: Assertion; + empty: Assertion; + arguments: Assertion; + Arguments: Assertion; + finite: Assertion; + equal: Equal; + equals: Equal; + eq: Equal; + eql: Equal; + eqls: Equal; + containSubset: ContainSubset; + property: Property; + ownProperty: Property; + haveOwnProperty: Property; + ownPropertyDescriptor: OwnPropertyDescriptor; + haveOwnPropertyDescriptor: OwnPropertyDescriptor; + length: Length; + lengthOf: Length; + match: Match; + matches: Match; + string(string: string, message?: string): Assertion; + keys: Keys; + key(string: string): Assertion; + throw: Throw; + throws: Throw; + Throw: Throw; + respondTo: RespondTo; + respondsTo: RespondTo; + itself: Assertion; + satisfy: Satisfy; + satisfies: Satisfy; + closeTo: CloseTo; + approximately: CloseTo; + members: Members; + increase: PropertyChange; + increases: PropertyChange; + decrease: PropertyChange; + decreases: PropertyChange; + change: PropertyChange; + changes: PropertyChange; + extensible: Assertion; + sealed: Assertion; + frozen: Assertion; + oneOf: OneOf; + } + + export interface LanguageChains { + to: Assertion; + be: Assertion; + been: Assertion; + is: Assertion; + that: Assertion; + which: Assertion; + and: Assertion; + has: Assertion; + have: Assertion; + with: Assertion; + at: Assertion; + of: Assertion; + same: Assertion; + but: Assertion; + does: Assertion; + } + + export interface NumericComparison { + above: NumberComparer; + gt: NumberComparer; + greaterThan: NumberComparer; + least: NumberComparer; + gte: NumberComparer; + greaterThanOrEqual: NumberComparer; + below: NumberComparer; + lt: NumberComparer; + lessThan: NumberComparer; + most: NumberComparer; + lte: NumberComparer; + lessThanOrEqual: NumberComparer; + within(start: number, finish: number, message?: string): Assertion; + within(start: Date, finish: Date, message?: string): Assertion; + } + + export interface NumberComparer { + (value: number | Date, message?: string): Assertion; + } + + export interface TypeComparison { + (type: string, message?: string): Assertion; + instanceof: InstanceOf; + instanceOf: InstanceOf; + } + + export interface InstanceOf { + (constructor: any, message?: string): Assertion; + } + + export interface CloseTo { + (expected: number, delta: number, message?: string): Assertion; + } + + export interface Nested { + include: Include; + includes: Include; + contain: Include; + contains: Include; + property: Property; + members: Members; + } + + export interface Own { + include: Include; + includes: Include; + contain: Include; + contains: Include; + property: Property; + } + + export interface Deep extends KeyFilter { + be: Assertion; + equal: Equal; + equals: Equal; + eq: Equal; + include: Include; + includes: Include; + contain: Include; + contains: Include; + property: Property; + ordered: Ordered; + nested: Nested; + oneOf: OneOf; + own: Own; + } + + export interface Ordered { + members: Members; + } + + export interface KeyFilter { + keys: Keys; + members: Members; + } + + export interface Equal { + (value: any, message?: string): Assertion; + } + + export interface ContainSubset { + (expected: any): Assertion; + } + + export interface Property { + (name: string | symbol, value: any, message?: string): Assertion; + (name: string | symbol, message?: string): Assertion; + } + + export interface OwnPropertyDescriptor { + (name: string | symbol, descriptor: PropertyDescriptor, message?: string): Assertion; + (name: string | symbol, message?: string): Assertion; + } + + export interface Length extends LanguageChains, NumericComparison { + (length: number, message?: string): Assertion; + } + + export interface Include { + (value: any, message?: string): Assertion; + keys: Keys; + deep: Deep; + ordered: Ordered; + members: Members; + any: KeyFilter; + all: KeyFilter; + oneOf: OneOf; + } + + export interface OneOf { + (list: readonly unknown[], message?: string): Assertion; + } + + export interface Match { + (regexp: RegExp, message?: string): Assertion; + } + + export interface Keys { + (...keys: string[]): Assertion; + (keys: readonly any[] | Object): Assertion; + } + + export interface Throw { + (expected?: string | RegExp, message?: string): Assertion; + (constructor: Error | Function, expected?: string | RegExp, message?: string): Assertion; + } + + export interface RespondTo { + (method: string, message?: string): Assertion; + } + + export interface Satisfy { + (matcher: Function, message?: string): Assertion; + } + + export interface Members { + (set: readonly any[], message?: string): Assertion; + } + + export interface PropertyChange { + (object: Object, property?: string, message?: string): DeltaAssertion; + } + + export interface DeltaAssertion extends Assertion { + by(delta: number, msg?: string): Assertion; + } + + export interface Assert { + /** + * @param expression Expression to test for truthiness. + * @param message Message to display on error. + */ + (expression: any, message?: string): asserts expression; + + /** + * Throws a failure. + * + * @param message Message to display on error. + * @remarks Node.js assert module-compatible. + */ + fail(message?: string): never; + + /** + * Throws a failure. + * + * T Type of the objects. + * @param actual Actual value. + * @param expected Potential expected value. + * @param message Message to display on error. + * @param operator Comparison operator, if not strict equality. + * @remarks Node.js assert module-compatible. + */ + fail(actual: T, expected: T, message?: string, operator?: Operator): never; + + /** + * Asserts that object is truthy. + * + * @param object Object to test. + * @param message Message to display on error. + */ + isOk(value: unknown, message?: string): asserts value; + + /** + * Asserts that object is truthy. + * + * @param object Object to test. + * @param message Message to display on error. + */ + ok(value: unknown, message?: string): asserts value; + + /** + * Asserts that object is falsy. + * + * T Type of object. + * @param object Object to test. + * @param message Message to display on error. + */ + isNotOk(value: T, message?: string): void; + + /** + * Asserts that object is falsy. + * + * T Type of object. + * @param object Object to test. + * @param message Message to display on error. + */ + notOk(value: T, message?: string): void; + + /** + * Asserts non-strict equality (==) of actual and expected. + * + * T Type of the objects. + * @param actual Actual value. + * @param expected Potential expected value. + * @param message Message to display on error. + */ + equal(actual: T, expected: T, message?: string): void; + + /** + * Asserts non-strict inequality (!=) of actual and expected. + * + * T Type of the objects. + * @param actual Actual value. + * @param expected Potential expected value. + * @param message Message to display on error. + */ + notEqual(actual: T, expected: T, message?: string): void; + + /** + * Asserts strict equality (===) of actual and expected. + * + * T Type of the objects. + * @param actual Actual value. + * @param expected Potential expected value. + * @param message Message to display on error. + */ + strictEqual(actual: T, expected: T, message?: string): void; + + /** + * Asserts strict inequality (!==) of actual and expected. + * + * T Type of the objects. + * @param actual Actual value. + * @param expected Potential expected value. + * @param message Message to display on error. + */ + notStrictEqual(actual: T, expected: T, message?: string): void; + + /** + * Asserts that actual is deeply equal to expected. + * + * T Type of the objects. + * @param actual Actual value. + * @param expected Potential expected value. + * @param message Message to display on error. + */ + deepEqual(actual: T, expected: T, message?: string): void; + + /** + * Asserts that actual is not deeply equal to expected. + * + * T Type of the objects. + * @param actual Actual value. + * @param expected Potential expected value. + * @param message Message to display on error. + */ + notDeepEqual(actual: T, expected: T, message?: string): void; + + /** + * Alias to deepEqual + * + * T Type of the objects. + * @param actual Actual value. + * @param expected Potential expected value. + * @param message Message to display on error. + */ + deepStrictEqual(actual: T, expected: T, message?: string): void; + + /** + * Partially matches actual and expected. + * + * @param actual Actual value. + * @param expected Potential subset of the value. + * @param message Message to display on error. + */ + containSubset(val: any, exp: any, msg?: string): void; + + /** + * Partially matches actual and expected. + * + * @param actual Actual value. + * @param expected Potential subset of the value. + * @param message Message to display on error. + */ + containsSubset(val: any, exp: any, msg?: string): void; + + /** + * No partial match between actual and expected exists. + * + * @param actual Actual value. + * @param expected Potential subset of the value. + * @param message Message to display on error. + */ + doesNotContainSubset(val: any, exp: any, msg?: string): void; + + /** + * Asserts valueToCheck is strictly greater than (>) valueToBeAbove. + * + * @param valueToCheck Actual value. + * @param valueToBeAbove Minimum Potential expected value. + * @param message Message to display on error. + */ + isAbove(valueToCheck: number, valueToBeAbove: number, message?: string): void; + + /** + * Asserts valueToCheck is greater than or equal to (>=) valueToBeAtLeast. + * + * @param valueToCheck Actual value. + * @param valueToBeAtLeast Minimum Potential expected value. + * @param message Message to display on error. + */ + isAtLeast(valueToCheck: number, valueToBeAtLeast: number, message?: string): void; + + /** + * Asserts valueToCheck is strictly less than (<) valueToBeBelow. + * + * @param valueToCheck Actual value. + * @param valueToBeBelow Minimum Potential expected value. + * @param message Message to display on error. + */ + isBelow(valueToCheck: number, valueToBeBelow: number, message?: string): void; + + /** + * Asserts valueToCheck is less than or equal to (<=) valueToBeAtMost. + * + * @param valueToCheck Actual value. + * @param valueToBeAtMost Minimum Potential expected value. + * @param message Message to display on error. + */ + isAtMost(valueToCheck: number, valueToBeAtMost: number, message?: string): void; + + /** + * Asserts that value is true. + * + * @param value Actual value. + * @param message Message to display on error. + */ + isTrue(value: unknown, message?: string): asserts value is true; + + /** + * Asserts that value is false. + * + * @param value Actual value. + * @param message Message to display on error. + */ + isFalse(value: unknown, message?: string): asserts value is false; + + /** + * Asserts that value is not true. + * + * T Type of value. + * @param value Actual value. + * @param message Message to display on error. + */ + isNotTrue(value: T, message?: string): asserts value is Exclude; + + /** + * Asserts that value is not false. + * + * @param value Actual value. + * @param message Message to display on error. + */ + isNotFalse(value: T, message?: string): asserts value is Exclude; + + /** + * Asserts that value is null. + * + * @param value Actual value. + * @param message Message to display on error. + */ + isNull(value: unknown, message?: string): asserts value is null; + + /** + * Asserts that value is not null. + * + * T Type of value. + * @param value Actual value. + * @param message Message to display on error. + */ + isNotNull(value: T, message?: string): asserts value is Exclude; + + /** + * Asserts that value is NaN. + * + * T Type of value. + * @param value Actual value. + * @param message Message to display on error. + */ + isNaN(value: T, message?: string): void; + + /** + * Asserts that value is not NaN. + * + * T Type of value. + * @param value Actual value. + * @param message Message to display on error. + */ + isNotNaN(value: T, message?: string): void; + + /** + * Asserts that the target is neither null nor undefined. + * + * T Type of value. + * @param value Actual value. + * @param message Message to display on error. + */ + exists(value: T, message?: string): asserts value is NonNullable; + + /** + * Asserts that the target is either null or undefined. + * + * @param value Actual value. + * @param message Message to display on error. + */ + notExists(value: unknown, message?: string): asserts value is + | null + | undefined; + + /** + * Asserts that value is undefined. + * + * @param value Actual value. + * @param message Message to display on error. + */ + isUndefined(value: unknown, message?: string): asserts value is undefined; + + /** + * Asserts that value is not undefined. + * + * T Type of value. + * @param value Actual value. + * @param message Message to display on error. + */ + isDefined(value: T, message?: string): asserts value is Exclude; + + /** + * Asserts that value is a function. + * + * T Type of value. + * @param value Actual value. + * @param message Message to display on error. + */ + isFunction(value: T, message?: string): void; + + /** + * Asserts that value is not a function. + * + * T Type of value. + * @param value Actual value. + * @param message Message to display on error. + */ + isNotFunction(value: T, message?: string): void; + + /** + * Asserts that value is an object of type 'Object' + * (as revealed by Object.prototype.toString). + * + * T Type of value. + * @param value Actual value. + * @param message Message to display on error. + * @remarks The assertion does not match subclassed objects. + */ + isObject(value: T, message?: string): void; + + /** + * Asserts that value is not an object of type 'Object' + * (as revealed by Object.prototype.toString). + * + * T Type of value. + * @param value Actual value. + * @param message Message to display on error. + */ + isNotObject(value: T, message?: string): void; + + /** + * Asserts that value is an array. + * + * T Type of value. + * @param value Actual value. + * @param message Message to display on error. + */ + isArray(value: T, message?: string): void; + + /** + * Asserts that value is not an array. + * + * T Type of value. + * @param value Actual value. + * @param message Message to display on error. + */ + isNotArray(value: T, message?: string): void; + + /** + * Asserts that value is a string. + * + * T Type of value. + * @param value Actual value. + * @param message Message to display on error. + */ + isString(value: T, message?: string): void; + + /** + * Asserts that value is not a string. + * + * T Type of value. + * @param value Actual value. + * @param message Message to display on error. + */ + isNotString(value: T, message?: string): void; + + /** + * Asserts that value is a number. + * + * T Type of value. + * @param value Actual value. + * @param message Message to display on error. + */ + isNumber(value: T, message?: string): void; + + /** + * Asserts that value is not a number. + * + * T Type of value. + * @param value Actual value. + * @param message Message to display on error. + */ + isNotNumber(value: T, message?: string): void; + + /** + * Asserts that value is a finite number. + * Unlike `.isNumber`, this will fail for `NaN` and `Infinity`. + * + * T Type of value + * @param value Actual value + * @param message Message to display on error. + */ + isFinite(value: T, message?: string): void; + + /** + * Asserts that value is a boolean. + * + * T Type of value. + * @param value Actual value. + * @param message Message to display on error. + */ + isBoolean(value: T, message?: string): void; + + /** + * Asserts that value is not a boolean. + * + * T Type of value. + * @param value Actual value. + * @param message Message to display on error. + */ + isNotBoolean(value: T, message?: string): void; + + /** + * Asserts that value's type is name, as determined by Object.prototype.toString. + * + * T Type of value. + * @param value Actual value. + * @param name Potential expected type name of value. + * @param message Message to display on error. + */ + typeOf(value: T, name: string, message?: string): void; + + /** + * Asserts that value's type is not name, as determined by Object.prototype.toString. + * + * T Type of value. + * @param value Actual value. + * @param name Potential expected type name of value. + * @param message Message to display on error. + */ + notTypeOf(value: T, name: string, message?: string): void; + + /** + * Asserts that value is an instance of constructor. + * + * T Expected type of value. + * @param value Actual value. + * @param constructor Potential expected contructor of value. + * @param message Message to display on error. + */ + instanceOf( + value: unknown, + constructor: Constructor, + message?: string, + ): asserts value is T; + + /** + * Asserts that value is not an instance of constructor. + * + * T Type of value. + * U Type that value shouldn't be an instance of. + * @param value Actual value. + * @param constructor Potential expected contructor of value. + * @param message Message to display on error. + */ + notInstanceOf(value: T, type: Constructor, message?: string): asserts value is Exclude; + + /** + * Asserts that haystack includes needle. + * + * @param haystack Container string. + * @param needle Potential substring of haystack. + * @param message Message to display on error. + */ + include(haystack: string, needle: string, message?: string): void; + + /** + * Asserts that haystack includes needle. + * + * T Type of values in haystack. + * @param haystack Container array, set or map. + * @param needle Potential value contained in haystack. + * @param message Message to display on error. + */ + include( + haystack: readonly T[] | ReadonlySet | ReadonlyMap, + needle: T, + message?: string, + ): void; + + /** + * Asserts that haystack includes needle. + * + * T Type of values in haystack. + * @param haystack WeakSet container. + * @param needle Potential value contained in haystack. + * @param message Message to display on error. + */ + include(haystack: WeakSet, needle: T, message?: string): void; + + /** + * Asserts that haystack includes needle. + * + * T Type of haystack. + * @param haystack Object. + * @param needle Potential subset of the haystack's properties. + * @param message Message to display on error. + */ + include(haystack: T, needle: Partial, message?: string): void; + + /** + * Asserts that haystack does not include needle. + * + * @param haystack Container string. + * @param needle Potential substring of haystack. + * @param message Message to display on error. + */ + notInclude(haystack: string, needle: string, message?: string): void; + + /** + * Asserts that haystack does not include needle. + * + * T Type of values in haystack. + * @param haystack Container array, set or map. + * @param needle Potential value contained in haystack. + * @param message Message to display on error. + */ + notInclude( + haystack: readonly T[] | ReadonlySet | ReadonlyMap, + needle: T, + message?: string, + ): void; + + /** + * Asserts that haystack does not include needle. + * + * T Type of values in haystack. + * @param haystack WeakSet container. + * @param needle Potential value contained in haystack. + * @param message Message to display on error. + */ + notInclude(haystack: WeakSet, needle: T, message?: string): void; + + /** + * Asserts that haystack does not include needle. + * + * T Type of haystack. + * @param haystack Object. + * @param needle Potential subset of the haystack's properties. + * @param message Message to display on error. + */ + notInclude(haystack: T, needle: Partial, message?: string): void; + + /** + * Asserts that haystack includes needle. Deep equality is used. + * + * @param haystack Container string. + * @param needle Potential substring of haystack. + * @param message Message to display on error. + * + * @deprecated Does not have any effect on string. Use {@link Assert#include} instead. + */ + deepInclude(haystack: string, needle: string, message?: string): void; + + /** + * Asserts that haystack includes needle. Deep equality is used. + * + * T Type of values in haystack. + * @param haystack Container array, set or map. + * @param needle Potential value contained in haystack. + * @param message Message to display on error. + */ + deepInclude( + haystack: readonly T[] | ReadonlySet | ReadonlyMap, + needle: T, + message?: string, + ): void; + + /** + * Asserts that haystack includes needle. Deep equality is used. + * + * T Type of haystack. + * @param haystack Object. + * @param needle Potential subset of the haystack's properties. + * @param message Message to display on error. + */ + deepInclude(haystack: T, needle: T extends WeakSet ? never : Partial, message?: string): void; + + /** + * Asserts that haystack does not include needle. Deep equality is used. + * + * @param haystack Container string. + * @param needle Potential substring of haystack. + * @param message Message to display on error. + * + * @deprecated Does not have any effect on string. Use {@link Assert#notInclude} instead. + */ + notDeepInclude(haystack: string, needle: string, message?: string): void; + + /** + * Asserts that haystack does not include needle. Deep equality is used. + * + * T Type of values in haystack. + * @param haystack Container array, set or map. + * @param needle Potential value contained in haystack. + * @param message Message to display on error. + */ + notDeepInclude( + haystack: readonly T[] | ReadonlySet | ReadonlyMap, + needle: T, + message?: string, + ): void; + + /** + * Asserts that haystack does not include needle. Deep equality is used. + * + * T Type of haystack. + * @param haystack Object. + * @param needle Potential subset of the haystack's properties. + * @param message Message to display on error. + */ + notDeepInclude(haystack: T, needle: T extends WeakSet ? never : Partial, message?: string): void; + + /** + * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object. + * + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. + * Can be used to assert the inclusion of a subset of properties in an object. + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + nestedInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object. + * + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. + * Can be used to assert the inclusion of a subset of properties in an object. + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + notNestedInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while checking for deep equality + * + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. + * Can be used to assert the inclusion of a subset of properties in an object. + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + deepNestedInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object while checking for deep equality. + * + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. + * Can be used to assert the inclusion of a subset of properties in an object. + * Enables the use of dot- and bracket-notation for referencing nested properties. + * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + notDeepNestedInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + ownInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + notOwnInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties and checking for deep + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + deepOwnInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties and checking for deep equality. + * + * @param haystack + * @param needle + * @param message Message to display on error. + */ + notDeepOwnInclude(haystack: any, needle: any, message?: string): void; + + /** + * Asserts that value matches the regular expression regexp. + * + * @param value Actual value. + * @param regexp Potential match of value. + * @param message Message to display on error. + */ + match(value: string, regexp: RegExp, message?: string): void; + + /** + * Asserts that value does not match the regular expression regexp. + * + * @param value Actual value. + * @param regexp Potential match of value. + * @param message Message to display on error. + */ + notMatch(expected: any, regexp: RegExp, message?: string): void; + + /** + * Asserts that object has a property named by property. + * + * T Type of object. + * @param object Container object. + * @param property Potential contained property of object. + * @param message Message to display on error. + */ + property(object: T, property: string, /* keyof T */ message?: string): void; + + /** + * Asserts that object does not have a property named by property. + * + * T Type of object. + * @param object Container object. + * @param property Potential contained property of object. + * @param message Message to display on error. + */ + notProperty(object: T, property: string, /* keyof T */ message?: string): void; + + /** + * Asserts that object has a property named by property, which can be a string + * using dot- and bracket-notation for deep reference. + * + * T Type of object. + * @param object Container object. + * @param property Potential contained property of object. + * @param message Message to display on error. + */ + deepProperty(object: T, property: string, message?: string): void; + + /** + * Asserts that object does not have a property named by property, which can be a + * string using dot- and bracket-notation for deep reference. + * + * T Type of object. + * @param object Container object. + * @param property Potential contained property of object. + * @param message Message to display on error. + */ + notDeepProperty(object: T, property: string, message?: string): void; + + /** + * Asserts that object has a property named by property with value given by value. + * + * T Type of object. + * V Type of value. + * @param object Container object. + * @param property Potential contained property of object. + * @param value Potential expected property value. + * @param message Message to display on error. + */ + propertyVal(object: T, property: string, /* keyof T */ value: V, message?: string): void; + + /** + * Asserts that object has a property named by property with value given by value. + * + * T Type of object. + * V Type of value. + * @param object Container object. + * @param property Potential contained property of object. + * @param value Potential expected property value. + * @param message Message to display on error. + */ + notPropertyVal(object: T, property: string, /* keyof T */ value: V, message?: string): void; + + /** + * Asserts that object has a property named by property, which can be a string + * using dot- and bracket-notation for deep reference. + * + * T Type of object. + * V Type of value. + * @param object Container object. + * @param property Potential contained property of object. + * @param value Potential expected property value. + * @param message Message to display on error. + */ + deepPropertyVal(object: T, property: string, value: V, message?: string): void; + + /** + * Asserts that object does not have a property named by property, which can be a + * string using dot- and bracket-notation for deep reference. + * + * T Type of object. + * V Type of value. + * @param object Container object. + * @param property Potential contained property of object. + * @param value Potential expected property value. + * @param message Message to display on error. + */ + notDeepPropertyVal(object: T, property: string, value: V, message?: string): void; + + /** + * Asserts that object has a length property with the expected value. + * + * T Type of object. + * @param object Container object. + * @param length Potential expected length of object. + * @param message Message to display on error. + */ + lengthOf( + object: T, + length: number, + message?: string, + ): void; + + /** + * Asserts that fn will throw an error. + * + * @param fn Function that may throw. + * @param errMsgMatcher Expected error message matcher. + * @param ignored Ignored parameter. + * @param message Message to display on error. + */ + throw(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void; + + /** + * Asserts that fn will throw an error. + * + * @param fn Function that may throw. + * @param errorLike Expected error constructor or error instance. + * @param errMsgMatcher Expected error message matcher. + * @param message Message to display on error. + */ + throw( + fn: () => void, + errorLike?: ErrorConstructor | Error | null, + errMsgMatcher?: RegExp | string | null, + message?: string, + ): void; + + /** + * Asserts that fn will throw an error. + * + * @param fn Function that may throw. + * @param errMsgMatcher Expected error message matcher. + * @param ignored Ignored parameter. + * @param message Message to display on error. + */ + throws(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void; + + /** + * Asserts that fn will throw an error. + * + * @param fn Function that may throw. + * @param errorLike Expected error constructor or error instance. + * @param errMsgMatcher Expected error message matcher. + * @param message Message to display on error. + */ + throws( + fn: () => void, + errorLike?: ErrorConstructor | Error | null, + errMsgMatcher?: RegExp | string | null, + message?: string, + ): void; + + /** + * Asserts that fn will throw an error. + * + * @param fn Function that may throw. + * @param errMsgMatcher Expected error message matcher. + * @param ignored Ignored parameter. + * @param message Message to display on error. + */ + Throw(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void; + + /** + * Asserts that fn will throw an error. + * + * @param fn Function that may throw. + * @param errorLike Expected error constructor or error instance. + * @param errMsgMatcher Expected error message matcher. + * @param message Message to display on error. + */ + Throw( + fn: () => void, + errorLike?: ErrorConstructor | Error | null, + errMsgMatcher?: RegExp | string | null, + message?: string, + ): void; + + /** + * Asserts that fn will not throw an error. + * + * @param fn Function that may throw. + * @param errMsgMatcher Expected error message matcher. + * @param ignored Ignored parameter. + * @param message Message to display on error. + */ + doesNotThrow(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void; + + /** + * Asserts that fn will not throw an error. + * + * @param fn Function that may throw. + * @param errorLike Expected error constructor or error instance. + * @param errMsgMatcher Expected error message matcher. + * @param message Message to display on error. + */ + doesNotThrow( + fn: () => void, + errorLike?: ErrorConstructor | Error | null, + errMsgMatcher?: RegExp | string | null, + message?: string, + ): void; + + /** + * Compares two values using operator. + * + * @param val1 Left value during comparison. + * @param operator Comparison operator. + * @param val2 Right value during comparison. + * @param message Message to display on error. + */ + operator(val1: OperatorComparable, operator: Operator, val2: OperatorComparable, message?: string): void; + + /** + * Asserts that the target is equal to expected, to within a +/- delta range. + * + * @param actual Actual value + * @param expected Potential expected value. + * @param delta Maximum differenced between values. + * @param message Message to display on error. + */ + closeTo(actual: number, expected: number, delta: number, message?: string): void; + + /** + * Asserts that the target is equal to expected, to within a +/- delta range. + * + * @param actual Actual value + * @param expected Potential expected value. + * @param delta Maximum differenced between values. + * @param message Message to display on error. + */ + approximately(act: number, exp: number, delta: number, message?: string): void; + + /** + * Asserts that set1 and set2 have the same members. Order is not take into account. + * + * T Type of set values. + * @param set1 Actual set of values. + * @param set2 Potential expected set of values. + * @param message Message to display on error. + */ + sameMembers(set1: T[], set2: T[], message?: string): void; + + /** + * Asserts that set1 and set2 have the same members using deep equality checking. + * Order is not take into account. + * + * T Type of set values. + * @param set1 Actual set of values. + * @param set2 Potential expected set of values. + * @param message Message to display on error. + */ + sameDeepMembers(set1: T[], set2: T[], message?: string): void; + + /** + * Asserts that `set1` and `set2` don't have the same members in any order. + * Uses a deep equality check. + * + * T Type of set values. + * @param set1 + * @param set2 + * @param message + */ + notSameDeepMembers(set1: T[], set2: T[], message?: string): void; + + /** + * Asserts that set1 and set2 have the same members in the same order. + * Uses a strict equality check (===). + * + * T Type of set values. + * @param set1 Actual set of values. + * @param set2 Potential expected set of values. + * @param message Message to display on error. + */ + sameOrderedMembers(set1: T[], set2: T[], message?: string): void; + + /** + * Asserts that set1 and set2 don’t have the same members in the same order. + * Uses a strict equality check (===). + * + * T Type of set values. + * @param set1 Actual set of values. + * @param set2 Potential expected set of values. + * @param message Message to display on error. + */ + notSameOrderedMembers(set1: T[], set2: T[], message?: string): void; + + /** + * Asserts that set1 and set2 have the same members in the same order. + * Uses a deep equality check. + * + * T Type of set values. + * @param set1 Actual set of values. + * @param set2 Potential expected set of values. + * @param message Message to display on error. + */ + sameDeepOrderedMembers(set1: T[], set2: T[], message?: string): void; + + /** + * Asserts that set1 and set2 don’t have the same members in the same order. + * Uses a deep equality check. + * + * T Type of set values. + * @param set1 Actual set of values. + * @param set2 Potential expected set of values. + * @param message Message to display on error. + */ + notSameDeepOrderedMembers(set1: T[], set2: T[], message?: string): void; + + /** + * Asserts that subset is included in superset in the same order beginning with the first element in superset. + * Uses a strict equality check (===). + * + * T Type of set values. + * @param superset Actual set of values. + * @param subset Potential contained set of values. + * @param message Message to display on error. + */ + includeOrderedMembers(superset: T[], subset: T[], message?: string): void; + + /** + * Asserts that subset isn’t included in superset in the same order beginning with the first element in superset. + * Uses a strict equality check (===). + * + * T Type of set values. + * @param superset Actual set of values. + * @param subset Potential contained set of values. + * @param message Message to display on error. + */ + notIncludeOrderedMembers(superset: T[], subset: T[], message?: string): void; + + /** + * Asserts that subset is included in superset in the same order beginning with the first element in superset. + * Uses a deep equality check. + * + * T Type of set values. + * @param superset Actual set of values. + * @param subset Potential contained set of values. + * @param message Message to display on error. + */ + includeDeepOrderedMembers(superset: T[], subset: T[], message?: string): void; + + /** + * Asserts that subset isn’t included in superset in the same order beginning with the first element in superset. + * Uses a deep equality check. + * + * T Type of set values. + * @param superset Actual set of values. + * @param subset Potential contained set of values. + * @param message Message to display on error. + */ + notIncludeDeepOrderedMembers(superset: T[], subset: T[], message?: string): void; + + /** + * Asserts that subset is included in superset. Order is not take into account. + * + * T Type of set values. + * @param superset Actual set of values. + * @param subset Potential contained set of values. + * @param message Message to display on error. + */ + includeMembers(superset: T[], subset: T[], message?: string): void; + + /** + * Asserts that subset isn’t included in superset in any order. + * Uses a strict equality check (===). Duplicates are ignored. + * + * T Type of set values. + * @param superset Actual set of values. + * @param subset Potential not contained set of values. + * @param message Message to display on error. + */ + notIncludeMembers(superset: T[], subset: T[], message?: string): void; + + /** + * Asserts that subset is included in superset using deep equality checking. + * Order is not take into account. + * + * T Type of set values. + * @param superset Actual set of values. + * @param subset Potential contained set of values. + * @param message Message to display on error. + */ + includeDeepMembers(superset: T[], subset: T[], message?: string): void; + + /** + * Asserts that `subset` isn't included in `superset` in any order. Uses a + * deep equality check. Duplicates are ignored. + * + * assert.notIncludeDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { f: 5 } ], 'not include deep members'); + * + * T Type of set values. + * @param superset Actual set of values. + * @param subset Potential contained set of values. + * @param message Message to display on error. + */ + notIncludeDeepMembers(superset: T[], subset: T[], message?: string): void; + + /** + * Asserts that non-object, non-array value inList appears in the flat array list. + * + * T Type of list values. + * @param inList Value expected to be in the list. + * @param list List of values. + * @param message Message to display on error. + */ + oneOf(inList: T, list: T[], message?: string): void; + + /** + * Asserts that a function changes the value of a property. + * + * T Type of object. + * @param modifier Function to run. + * @param object Container object. + * @param property Property of object expected to be modified. + * @param message Message to display on error. + */ + changes(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void; + + /** + * Asserts that a function changes the value of a property by an amount (delta). + * + * @param modifier function + * @param object or getter function + * @param property name _optional_ + * @param change amount (delta) + * @param message _optional_ + */ + changesBy( + modifier: Function, + object: T, + property: string, + /* keyof T */ change: number, + message?: string, + ): void; + changesBy(modifier: Function, object: T, change: number, message?: string): void; + + /** + * Asserts that a function does not change the value of a property. + * + * T Type of object. + * @param modifier Function to run. + * @param object Container object. + * @param property Property of object expected not to be modified. + * @param message Message to display on error. + */ + doesNotChange(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void; + + /** + * Asserts that a function increases an object property. + * + * T Type of object. + * @param modifier Function to run. + * @param object Container object. + * @param property Property of object expected to be increased. + * @param message Message to display on error. + */ + increases(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void; + + /** + * Asserts that a function increases a numeric object property or a function's return value by an amount (delta). + * + * T Type of object or function. + * @param modifier function + * @param object or getter function + * @param property name _optional_ + * @param change amount (delta) + * @param message _optional_ + */ + increasesBy( + modifier: Function, + object: T, + property: string, + /* keyof T */ change: number, + message?: string, + ): void; + increasesBy(modifier: Function, object: T, change: number, message?: string): void; + + /** + * Asserts that a function does not increase an object property. + * + * T Type of object. + * @param modifier Function to run. + * @param object Container object. + * @param property Property of object expected not to be increased. + * @param message Message to display on error. + */ + doesNotIncrease(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void; + + /** + * Asserts that a function does not increase a numeric object property or function's return value by an amount (delta). + * + * T Type of object or function. + * @param modifier function + * @param object or getter function + * @param property name _optional_ + * @param change amount (delta) + * @param message _optional_ + */ + + increasesButNotBy( + modifier: Function, + object: T, + property: string, + /* keyof T */ change: number, + message?: string, + ): void; + increasesButNotBy(modifier: Function, object: T, change: number, message?: string): void; + + /** + * Asserts that a function decreases an object property. + * + * T Type of object. + * @param modifier Function to run. + * @param object Container object. + * @param property Property of object expected to be decreased. + * @param message Message to display on error. + */ + decreases(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void; + + /** + * Asserts that a function decreases a numeric object property or a function's return value by an amount (delta) + * + * T Type of object or function. + * @param modifier function + * @param object or getter function + * @param property name _optional_ + * @param change amount (delta) + * @param message _optional_ + */ + + decreasesBy( + modifier: Function, + object: T, + property: string, + /* keyof T */ change: number, + message?: string, + ): void; + decreasesBy(modifier: Function, object: T, change: number, message?: string): void; + + /** + * Asserts that a function does not decrease an object property. + * + * T Type of object. + * @param modifier Function to run. + * @param object Container object. + * @param property Property of object expected not to be decreased. + * @param message Message to display on error. + */ + doesNotDecrease(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void; + + /** + * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta) + * + * T Type of object or function. + * @param modifier function + * @param object or getter function + * @param property name _optional_ + * @param change amount (delta) + * @param message _optional_ + */ + + doesNotDecreaseBy( + modifier: Function, + object: T, + property: string, + /* keyof T */ change: number, + message?: string, + ): void; + doesNotDecreaseBy(modifier: Function, object: T, change: number, message?: string): void; + + /** + * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta) + * + * T Type of object or function. + * @param modifier function + * @param object or getter function + * @param property name _optional_ + * @param change amount (delta) + * @param message _optional_ + */ + + decreasesButNotBy( + modifier: Function, + object: T, + property: string, + /* keyof T */ change: number, + message?: string, + ): void; + decreasesButNotBy(modifier: Function, object: T, change: number, message?: string): void; + + /** + * Asserts if value is not a false value, and throws if it is a true value. + * + * T Type of object. + * @param object Actual value. + * @param message Message to display on error. + * @remarks This is added to allow for chai to be a drop-in replacement for + * Node’s assert class. + */ + ifError(object: T, message?: string): void; + + /** + * Asserts that object is extensible (can have new properties added to it). + * + * T Type of object + * @param object Actual value. + * @param message Message to display on error. + */ + isExtensible(object: T, message?: string): void; + + /** + * Asserts that object is extensible (can have new properties added to it). + * + * T Type of object + * @param object Actual value. + * @param message Message to display on error. + */ + extensible(object: T, message?: string): void; + + /** + * Asserts that object is not extensible. + * + * T Type of object + * @param object Actual value. + * @param message Message to display on error. + */ + isNotExtensible(object: T, message?: string): void; + + /** + * Asserts that object is not extensible. + * + * T Type of object + * @param object Actual value. + * @param message Message to display on error. + */ + notExtensible(object: T, message?: string): void; + + /** + * Asserts that object is sealed (can have new properties added to it + * and its existing properties cannot be removed). + * + * T Type of object + * @param object Actual value. + * @param message Message to display on error. + */ + isSealed(object: T, message?: string): void; + + /** + * Asserts that object is sealed (can have new properties added to it + * and its existing properties cannot be removed). + * + * T Type of object + * @param object Actual value. + * @param message Message to display on error. + */ + sealed(object: T, message?: string): void; + + /** + * Asserts that object is not sealed. + * + * T Type of object + * @param object Actual value. + * @param message Message to display on error. + */ + isNotSealed(object: T, message?: string): void; + + /** + * Asserts that object is not sealed. + * + * T Type of object + * @param object Actual value. + * @param message Message to display on error. + */ + notSealed(object: T, message?: string): void; + + /** + * Asserts that object is frozen (cannot have new properties added to it + * and its existing properties cannot be removed). + * + * T Type of object + * @param object Actual value. + * @param message Message to display on error. + */ + isFrozen(object: T, message?: string): void; + + /** + * Asserts that object is frozen (cannot have new properties added to it + * and its existing properties cannot be removed). + * + * T Type of object + * @param object Actual value. + * @param message Message to display on error. + */ + frozen(object: T, message?: string): void; + + /** + * Asserts that object is not frozen (cannot have new properties added to it + * and its existing properties cannot be removed). + * + * T Type of object + * @param object Actual value. + * @param message Message to display on error. + */ + isNotFrozen(object: T, message?: string): void; + + /** + * Asserts that object is not frozen (cannot have new properties added to it + * and its existing properties cannot be removed). + * + * T Type of object + * @param object Actual value. + * @param message Message to display on error. + */ + notFrozen(object: T, message?: string): void; + + /** + * Asserts that the target does not contain any values. For arrays and + * strings, it checks the length property. For Map and Set instances, it + * checks the size property. For non-function objects, it gets the count + * of own enumerable string keys. + * + * T Type of object + * @param object Actual value. + * @param message Message to display on error. + */ + isEmpty(object: T, message?: string): void; + + /** + * Asserts that the target contains values. For arrays and strings, it checks + * the length property. For Map and Set instances, it checks the size property. + * For non-function objects, it gets the count of own enumerable string keys. + * + * T Type of object. + * @param object Object to test. + * @param message Message to display on error. + */ + isNotEmpty(object: T, message?: string): void; + + /** + * Asserts that `object` has at least one of the `keys` provided. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * T Type of object. + * @param object Object to test. + * @param keys Keys to check + * @param message Message to display on error. + */ + hasAnyKeys(object: T, keys: Array | { [key: string]: any }, message?: string): void; + + /** + * Asserts that `object` has all and only all of the `keys` provided. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * T Type of object. + * @param object Object to test. + * @param keys Keys to check + * @param message Message to display on error. + */ + hasAllKeys(object: T, keys: Array | { [key: string]: any }, message?: string): void; + + /** + * Asserts that `object` has all of the `keys` provided but may have more keys not listed. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * T Type of object. + * @param object Object to test. + * @param keys Keys to check + * @param message Message to display on error. + */ + containsAllKeys( + object: T, + keys: Array | { [key: string]: any }, + message?: string, + ): void; + + /** + * Asserts that `object` has none of the `keys` provided. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * T Type of object. + * @param object Object to test. + * @param keys Keys to check + * @param message Message to display on error. + */ + doesNotHaveAnyKeys( + object: T, + keys: Array | { [key: string]: any }, + message?: string, + ): void; + + /** + * Asserts that `object` does not have at least one of the `keys` provided. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * T Type of object. + * @param object Object to test. + * @param keys Keys to check + * @param message Message to display on error. + */ + doesNotHaveAllKeys( + object: T, + keys: Array | { [key: string]: any }, + message?: string, + ): void; + + /** + * Asserts that `object` has at least one of the `keys` provided. + * Since Sets and Maps can have objects as keys you can use this assertion to perform + * a deep comparison. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * T Type of object. + * @param object Object to test. + * @param keys Keys to check + * @param message Message to display on error. + */ + hasAnyDeepKeys(object: T, keys: Array | { [key: string]: any }, message?: string): void; + + /** + * Asserts that `object` has all and only all of the `keys` provided. + * Since Sets and Maps can have objects as keys you can use this assertion to perform + * a deep comparison. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * T Type of object. + * @param object Object to test. + * @param keys Keys to check + * @param message Message to display on error. + */ + hasAllDeepKeys(object: T, keys: Array | { [key: string]: any }, message?: string): void; + + /** + * Asserts that `object` contains all of the `keys` provided. + * Since Sets and Maps can have objects as keys you can use this assertion to perform + * a deep comparison. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * T Type of object. + * @param object Object to test. + * @param keys Keys to check + * @param message Message to display on error. + */ + containsAllDeepKeys( + object: T, + keys: Array | { [key: string]: any }, + message?: string, + ): void; + + /** + * Asserts that `object` contains all of the `keys` provided. + * Since Sets and Maps can have objects as keys you can use this assertion to perform + * a deep comparison. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * T Type of object. + * @param object Object to test. + * @param keys Keys to check + * @param message Message to display on error. + */ + doesNotHaveAnyDeepKeys( + object: T, + keys: Array | { [key: string]: any }, + message?: string, + ): void; + + /** + * Asserts that `object` contains all of the `keys` provided. + * Since Sets and Maps can have objects as keys you can use this assertion to perform + * a deep comparison. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * T Type of object. + * @param object Object to test. + * @param keys Keys to check + * @param message Message to display on error. + */ + doesNotHaveAllDeepKeys( + object: T, + keys: Array | { [key: string]: any }, + message?: string, + ): void; + + /** + * Asserts that object has a direct or inherited property named by property, + * which can be a string using dot- and bracket-notation for nested reference. + * + * T Type of object. + * @param object Object to test. + * @param property Property to test. + * @param message Message to display on error. + */ + nestedProperty(object: T, property: string, message?: string): void; + + /** + * Asserts that object does not have a property named by property, + * which can be a string using dot- and bracket-notation for nested reference. + * The property cannot exist on the object nor anywhere in its prototype chain. + * + * T Type of object. + * @param object Object to test. + * @param property Property to test. + * @param message Message to display on error. + */ + notNestedProperty(object: T, property: string, message?: string): void; + + /** + * Asserts that object has a property named by property with value given by value. + * property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===). + * + * T Type of object. + * @param object Object to test. + * @param property Property to test. + * @param value Value to test. + * @param message Message to display on error. + */ + nestedPropertyVal(object: T, property: string, value: any, message?: string): void; + + /** + * Asserts that object does not have a property named by property with value given by value. + * property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===). + * + * T Type of object. + * @param object Object to test. + * @param property Property to test. + * @param value Value to test. + * @param message Message to display on error. + */ + notNestedPropertyVal(object: T, property: string, value: any, message?: string): void; + + /** + * Asserts that object has a property named by property with a value given by value. + * property can use dot- and bracket-notation for nested reference. Uses a deep equality check. + * + * T Type of object. + * @param object Object to test. + * @param property Property to test. + * @param value Value to test. + * @param message Message to display on error. + */ + deepNestedPropertyVal(object: T, property: string, value: any, message?: string): void; + + /** + * Asserts that object does not have a property named by property with value given by value. + * property can use dot- and bracket-notation for nested reference. Uses a deep equality check. + * + * T Type of object. + * @param object Object to test. + * @param property Property to test. + * @param value Value to test. + * @param message Message to display on error. + */ + notDeepNestedPropertyVal(object: T, property: string, value: any, message?: string): void; + } + + export interface Config { + /** + * Default: false + */ + includeStack: boolean; + + /** + * Default: true + */ + showDiff: boolean; + + /** + * Default: 40 + */ + truncateThreshold: number; + + /** + * Default: true + */ + useProxy: boolean; + + /** + * Default: ['then', 'catch', 'inspect', 'toJSON'] + */ + proxyExcludedKeys: string[]; + + deepEqual: (expected: L, actual: R) => void; + } + + export type { ImportedAssertionError as AssertionError }; + } +} + +export function use(fn: Chai.ChaiPlugin): Chai.ChaiStatic; + +export const util: Chai.ChaiUtils; +export const config: Chai.Config; +export const Assertion: Chai.AssertionStatic; +export const AssertionError: typeof ImportedAssertionError; +export function should(): Chai.Should; +export function Should(): Chai.Should; +export const assert: Chai.AssertStatic; +export const expect: Chai.ExpectStatic; diff --git a/node_modules/@types/chai/package.json b/node_modules/@types/chai/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7aec8d1c6a5bb77179f810e2bdf2c560f613aa69 --- /dev/null +++ b/node_modules/@types/chai/package.json @@ -0,0 +1,75 @@ +{ + "name": "@types/chai", + "version": "5.2.3", + "description": "TypeScript definitions for chai", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chai", + "license": "MIT", + "contributors": [ + { + "name": "Bart van der Schoor", + "githubUsername": "Bartvds", + "url": "https://github.com/Bartvds" + }, + { + "name": "Andrew Brown", + "githubUsername": "AGBrown", + "url": "https://github.com/AGBrown" + }, + { + "name": "Olivier Chevet", + "githubUsername": "olivr70", + "url": "https://github.com/olivr70" + }, + { + "name": "Matt Wistrand", + "githubUsername": "mwistrand", + "url": "https://github.com/mwistrand" + }, + { + "name": "Shaun Luttin", + "githubUsername": "shaunluttin", + "url": "https://github.com/shaunluttin" + }, + { + "name": "Satana Charuwichitratana", + "githubUsername": "micksatana", + "url": "https://github.com/micksatana" + }, + { + "name": "Erik Schierboom", + "githubUsername": "ErikSchierboom", + "url": "https://github.com/ErikSchierboom" + }, + { + "name": "Bogdan Paranytsia", + "githubUsername": "bparan", + "url": "https://github.com/bparan" + }, + { + "name": "CXuesong", + "githubUsername": "CXuesong", + "url": "https://github.com/CXuesong" + }, + { + "name": "Joey Kilpatrick", + "githubUsername": "joeykilpatrick", + "url": "https://github.com/joeykilpatrick" + } + ], + "type": "module", + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/chai" + }, + "scripts": {}, + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + }, + "peerDependencies": {}, + "typesPublisherContentHash": "d9d83f1594f42010e624e46e4c8cfeee284bdd04cb05eb0730aec14140f2a833", + "typeScriptVersion": "5.2" +} \ No newline at end of file diff --git a/node_modules/@types/chai/register-should.d.ts b/node_modules/@types/chai/register-should.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1e14f93b30749b96cc8153df52e4ab247597114c --- /dev/null +++ b/node_modules/@types/chai/register-should.d.ts @@ -0,0 +1,7 @@ +declare global { + interface Object { + should: Chai.Assertion; + } +} + +export {}; diff --git a/node_modules/@types/connect/LICENSE b/node_modules/@types/connect/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9e841e7a26e4eb057b24511e7b92d42b257a80e5 --- /dev/null +++ b/node_modules/@types/connect/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/connect/README.md b/node_modules/@types/connect/README.md new file mode 100644 index 0000000000000000000000000000000000000000..1746fab041cf010a873df90aa8b34561e4f08b5f --- /dev/null +++ b/node_modules/@types/connect/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/connect` + +# Summary +This package contains type definitions for connect (https://github.com/senchalabs/connect). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/connect. + +### Additional Details + * Last updated: Mon, 06 Nov 2023 22:41:05 GMT + * Dependencies: [@types/node](https://npmjs.com/package/@types/node) + +# Credits +These definitions were written by [Maxime LUCE](https://github.com/SomaticIT), and [Evan Hahn](https://github.com/EvanHahn). diff --git a/node_modules/@types/connect/index.d.ts b/node_modules/@types/connect/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8355d781a4b678f8d2fe260d180ae3522446bc6c --- /dev/null +++ b/node_modules/@types/connect/index.d.ts @@ -0,0 +1,91 @@ +/// + +import * as http from "http"; + +/** + * Create a new connect server. + */ +declare function createServer(): createServer.Server; + +declare namespace createServer { + export type ServerHandle = HandleFunction | http.Server; + + export class IncomingMessage extends http.IncomingMessage { + originalUrl?: http.IncomingMessage["url"] | undefined; + } + + type NextFunction = (err?: any) => void; + + export type SimpleHandleFunction = (req: IncomingMessage, res: http.ServerResponse) => void; + export type NextHandleFunction = (req: IncomingMessage, res: http.ServerResponse, next: NextFunction) => void; + export type ErrorHandleFunction = ( + err: any, + req: IncomingMessage, + res: http.ServerResponse, + next: NextFunction, + ) => void; + export type HandleFunction = SimpleHandleFunction | NextHandleFunction | ErrorHandleFunction; + + export interface ServerStackItem { + route: string; + handle: ServerHandle; + } + + export interface Server extends NodeJS.EventEmitter { + (req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void; + + route: string; + stack: ServerStackItem[]; + + /** + * Utilize the given middleware `handle` to the given `route`, + * defaulting to _/_. This "route" is the mount-point for the + * middleware, when given a value other than _/_ the middleware + * is only effective when that segment is present in the request's + * pathname. + * + * For example if we were to mount a function at _/admin_, it would + * be invoked on _/admin_, and _/admin/settings_, however it would + * not be invoked for _/_, or _/posts_. + */ + use(fn: NextHandleFunction): Server; + use(fn: HandleFunction): Server; + use(route: string, fn: NextHandleFunction): Server; + use(route: string, fn: HandleFunction): Server; + + /** + * Handle server requests, punting them down + * the middleware stack. + */ + handle(req: http.IncomingMessage, res: http.ServerResponse, next: Function): void; + + /** + * Listen for connections. + * + * This method takes the same arguments + * as node's `http.Server#listen()`. + * + * HTTP and HTTPS: + * + * If you run your application both as HTTP + * and HTTPS you may wrap them individually, + * since your Connect "server" is really just + * a JavaScript `Function`. + * + * var connect = require('connect') + * , http = require('http') + * , https = require('https'); + * + * var app = connect(); + * + * http.createServer(app).listen(80); + * https.createServer(options, app).listen(443); + */ + listen(port: number, hostname?: string, backlog?: number, callback?: Function): http.Server; + listen(port: number, hostname?: string, callback?: Function): http.Server; + listen(path: string, callback?: Function): http.Server; + listen(handle: any, listeningListener?: Function): http.Server; + } +} + +export = createServer; diff --git a/node_modules/@types/connect/package.json b/node_modules/@types/connect/package.json new file mode 100644 index 0000000000000000000000000000000000000000..207078e56ca3258219af0367008602c2ea46ef17 --- /dev/null +++ b/node_modules/@types/connect/package.json @@ -0,0 +1,32 @@ +{ + "name": "@types/connect", + "version": "3.4.38", + "description": "TypeScript definitions for connect", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/connect", + "license": "MIT", + "contributors": [ + { + "name": "Maxime LUCE", + "githubUsername": "SomaticIT", + "url": "https://github.com/SomaticIT" + }, + { + "name": "Evan Hahn", + "githubUsername": "EvanHahn", + "url": "https://github.com/EvanHahn" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/connect" + }, + "scripts": {}, + "dependencies": { + "@types/node": "*" + }, + "typesPublisherContentHash": "8990242237504bdec53088b79e314b94bec69286df9de56db31f22de403b4092", + "typeScriptVersion": "4.5" +} \ No newline at end of file diff --git a/node_modules/@types/cookie-parser/LICENSE b/node_modules/@types/cookie-parser/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9e841e7a26e4eb057b24511e7b92d42b257a80e5 --- /dev/null +++ b/node_modules/@types/cookie-parser/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/cookie-parser/README.md b/node_modules/@types/cookie-parser/README.md new file mode 100644 index 0000000000000000000000000000000000000000..4cb4a6a0d2de97536f452c92dc3576edb5839e0e --- /dev/null +++ b/node_modules/@types/cookie-parser/README.md @@ -0,0 +1,61 @@ +# Installation +> `npm install --save @types/cookie-parser` + +# Summary +This package contains type definitions for cookie-parser (https://github.com/expressjs/cookie-parser). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie-parser. +## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie-parser/index.d.ts) +````ts +import express = require("express"); + +declare module "express" { + // Inject additional properties on express.Request + interface Request { + /** + * This request's secret. + * Optionally set by cookie-parser if secret(s) are provided. Can be used by other middleware. + * [Declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html) can be used to add your own properties. + */ + secret?: string | undefined; + /** Parsed cookies that have not been signed */ + cookies: Record; + /** Parsed cookies that have been signed */ + signedCookies: Record; + } +} + +declare function cookieParser( + secret?: string | string[], + options?: cookieParser.CookieParseOptions, +): express.RequestHandler; + +declare namespace cookieParser { + interface CookieParseOptions { + decode?(val: string): string; + } + + function JSONCookie(jsonCookie: string): object | undefined; + + function JSONCookies(jsonCookies: T): { [P in keyof T]: object | undefined }; + + function signedCookie(cookie: string, secret: string | string[]): string | false; + + function signedCookies( + cookies: T, + secret: string | string[], + ): { [P in keyof T]?: string | false }; +} + +export = cookieParser; + +```` + +### Additional Details + * Last updated: Fri, 24 Oct 2025 04:02:41 GMT + * Dependencies: none + * Peer dependencies: [@types/express](https://npmjs.com/package/@types/express) + +# Credits +These definitions were written by [Santi Albo](https://github.com/santialbo), [BendingBender](https://github.com/BendingBender), and [Sebastian Beltran](https://github.com/bjohansebas). diff --git a/node_modules/@types/cookie-parser/index.d.ts b/node_modules/@types/cookie-parser/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..29d7afe3c3432f10743a6df96127d3bce8ae204e --- /dev/null +++ b/node_modules/@types/cookie-parser/index.d.ts @@ -0,0 +1,41 @@ +import express = require("express"); + +declare module "express" { + // Inject additional properties on express.Request + interface Request { + /** + * This request's secret. + * Optionally set by cookie-parser if secret(s) are provided. Can be used by other middleware. + * [Declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html) can be used to add your own properties. + */ + secret?: string | undefined; + /** Parsed cookies that have not been signed */ + cookies: Record; + /** Parsed cookies that have been signed */ + signedCookies: Record; + } +} + +declare function cookieParser( + secret?: string | string[], + options?: cookieParser.CookieParseOptions, +): express.RequestHandler; + +declare namespace cookieParser { + interface CookieParseOptions { + decode?(val: string): string; + } + + function JSONCookie(jsonCookie: string): object | undefined; + + function JSONCookies(jsonCookies: T): { [P in keyof T]: object | undefined }; + + function signedCookie(cookie: string, secret: string | string[]): string | false; + + function signedCookies( + cookies: T, + secret: string | string[], + ): { [P in keyof T]?: string | false }; +} + +export = cookieParser; diff --git a/node_modules/@types/cookie-parser/package.json b/node_modules/@types/cookie-parser/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0e1d5529361b553172ed6f0a6895c19daf3633be --- /dev/null +++ b/node_modules/@types/cookie-parser/package.json @@ -0,0 +1,38 @@ +{ + "name": "@types/cookie-parser", + "version": "1.4.10", + "description": "TypeScript definitions for cookie-parser", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie-parser", + "license": "MIT", + "contributors": [ + { + "name": "Santi Albo", + "githubUsername": "santialbo", + "url": "https://github.com/santialbo" + }, + { + "name": "BendingBender", + "githubUsername": "BendingBender", + "url": "https://github.com/BendingBender" + }, + { + "name": "Sebastian Beltran", + "githubUsername": "bjohansebas", + "url": "https://github.com/bjohansebas" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/cookie-parser" + }, + "scripts": {}, + "dependencies": {}, + "peerDependencies": { + "@types/express": "*" + }, + "typesPublisherContentHash": "2084e147e6529a1c84dc4645ec42b321c2b0165db9aac73e158e4bc9950ffe35", + "typeScriptVersion": "5.2" +} \ No newline at end of file diff --git a/node_modules/@types/cookiejar/LICENSE b/node_modules/@types/cookiejar/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9e841e7a26e4eb057b24511e7b92d42b257a80e5 --- /dev/null +++ b/node_modules/@types/cookiejar/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/cookiejar/README.md b/node_modules/@types/cookiejar/README.md new file mode 100644 index 0000000000000000000000000000000000000000..117eee55bedd9d995a33269812d4f26b166ba0b8 --- /dev/null +++ b/node_modules/@types/cookiejar/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/cookiejar` + +# Summary +This package contains type definitions for cookiejar (https://github.com/bmeck/node-cookiejar). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookiejar. + +### Additional Details + * Last updated: Mon, 20 Nov 2023 23:36:24 GMT + * Dependencies: none + +# Credits +These definitions were written by [Rafal Proszowski](https://github.com/paroxp), and [Charles Samborski](https://github.com/demurgos). diff --git a/node_modules/@types/cookiejar/index.d.ts b/node_modules/@types/cookiejar/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..13fed3b6e2a6dfc6c378a090968e8c781d35d6a6 --- /dev/null +++ b/node_modules/@types/cookiejar/index.d.ts @@ -0,0 +1,110 @@ +export class CookieAccessInfo { + /** + * Class to determine matching qualities of a cookie + * @param domain string domain to match + * @param path string path to match + * @param secure boolean access is secure (ssl generally) + * @param script boolean access is from a script + */ + constructor(domain: string, path?: string, secure?: boolean, script?: boolean); + + static All: CookieAccessInfo; + domain: string; // domain to match + path: string; // path to match + secure: boolean; // access is secure (ssl generally) + script: boolean; // access is from a script +} + +export class Cookie { + name: string; // name of the cookie + value: string; // string associated with the cookie + domain: string; // domain to match (on a cookie a '.' at the start means a wildcard matching anything ending in the rest) + explicit_domain: boolean; // if the domain was explicitly set via the cookie string + path: string; // base path to match (matches any path starting with this '/' is root) + explicit_path: boolean; // if the path was explicitly set via the cookie string + noscript: boolean; // if it should be kept from scripts + secure: boolean; // should it only be transmitted over secure means + expiration_date: number; // number of millis since 1970 at which this should be removed + + /** + * It turns input into a Cookie (singleton if given a Cookie), the + * request_domain argument is used to default the domain if it is not + * explicit in the cookie string, the request_path argument is used to set + * the path if it is not explicit in a cookie String. + * + * Explicit domains/paths will cascade, implied domains/paths must exactly + * match (see http://en.wikipedia.org/wiki/HTTP_cookie#Domain_and_Pat). + * @param cookie string or a cookie to work on + * @param requestDomain string argument is used to default the domain if it is not explicit in the cookie string + * @param requestPath string argument is used to set the path if it is not explicit in a cookie String + */ + constructor(cookie: string | Cookie, requestDomain?: string, requestPath?: string); + + /** + * the set-cookie: string for this cookie + */ + toString(): string; + + /** + * the cookie: string for this cookie + */ + toValueString(): string; + + /** + * parses the string onto this cookie or a new one if called directly + * @param cookie string to be parsed into a Cookie + * @param requestDomain string definind the requesting domain + * @param requestPath string defining the requesting path + */ + parse(cookie: string, requestDomain?: string, requestPath?: string): Cookie; + + /** + * returns true if the access_info allows retrieval of this cookie + * @param accessInfo CookieAccessInfo + */ + matches(accessInfo: CookieAccessInfo): boolean; + + /** + * returns true if the cookies cannot exist in the same space + * (domain and path match) + * @param cookie Cookie + */ + collidesWith(cookie: Cookie): boolean; +} + +export class CookieJar { + /** + * class to hold numerous cookies from multiple domains correctly + */ + constructor(); + + /** + * modify (or add if not already-existing) a cookie to the jar + * @param cookie string | Cookie + * @param requestDomain string argument is used to default the domain if it is not explicit in the cookie string + * @param requestPath string argument is used to set the path if it is not explicit in a cookie String + */ + setCookie(cookie: string | Cookie, requestDomain?: string, requestPath?: string): Cookie | false; + + /** + * modify (or add if not already-existing) a large number of cookies to the + * jar + * @param cookie string or list of strings defining cookies + * @param requestDomain string argument is used to default the domain if it is not explicit in the cookie string + * @param requestPath string argument is used to set the path if it is not explicit in a cookie String + */ + setCookies(cookie: string | readonly string[], requestDomain?: string, requestPath?: string): Cookie[]; + + /** + * get a cookie with the name and access_info matching + * @param cookieName string to be parsed into a Cookie + * @param accessInfo CookieAccessInfo + */ + getCookie(cookieName: string, accessInfo: CookieAccessInfo): Cookie | undefined; + + /** + * grab all cookies matching this access_info + * @param accessInfo CookieAccessInfo + */ + getCookies(accessInfo: CookieAccessInfo): readonly Cookie[] & { toValueString(): string }; +} diff --git a/node_modules/@types/cookiejar/package.json b/node_modules/@types/cookiejar/package.json new file mode 100644 index 0000000000000000000000000000000000000000..e493db99089f52b38d8825f201ce40e7b3a9490c --- /dev/null +++ b/node_modules/@types/cookiejar/package.json @@ -0,0 +1,30 @@ +{ + "name": "@types/cookiejar", + "version": "2.1.5", + "description": "TypeScript definitions for cookiejar", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookiejar", + "license": "MIT", + "contributors": [ + { + "name": "Rafal Proszowski", + "githubUsername": "paroxp", + "url": "https://github.com/paroxp" + }, + { + "name": "Charles Samborski", + "githubUsername": "demurgos", + "url": "https://github.com/demurgos" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/cookiejar" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "551e326993669a1935321e02c337463332b2f28f70d829872d1eb8e3b594596b", + "typeScriptVersion": "4.5" +} \ No newline at end of file diff --git a/node_modules/@types/cors/LICENSE b/node_modules/@types/cors/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9e841e7a26e4eb057b24511e7b92d42b257a80e5 --- /dev/null +++ b/node_modules/@types/cors/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/cors/README.md b/node_modules/@types/cors/README.md new file mode 100644 index 0000000000000000000000000000000000000000..b1834a3e9e69b6f90a5fbd5cbdd80aab3f9d4ebb --- /dev/null +++ b/node_modules/@types/cors/README.md @@ -0,0 +1,75 @@ +# Installation +> `npm install --save @types/cors` + +# Summary +This package contains type definitions for cors (https://github.com/expressjs/cors/). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cors. +## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cors/index.d.ts) +````ts +/// + +import { IncomingHttpHeaders } from "http"; + +type StaticOrigin = boolean | string | RegExp | Array; + +type CustomOrigin = ( + requestOrigin: string | undefined, + callback: (err: Error | null, origin?: StaticOrigin) => void, +) => void; + +declare namespace e { + interface CorsRequest { + method?: string | undefined; + headers: IncomingHttpHeaders; + } + interface CorsOptions { + /** + * @default '*' + */ + origin?: StaticOrigin | CustomOrigin | undefined; + /** + * @default 'GET,HEAD,PUT,PATCH,POST,DELETE' + */ + methods?: string | string[] | undefined; + allowedHeaders?: string | string[] | undefined; + exposedHeaders?: string | string[] | undefined; + credentials?: boolean | undefined; + maxAge?: number | undefined; + /** + * @default false + */ + preflightContinue?: boolean | undefined; + /** + * @default 204 + */ + optionsSuccessStatus?: number | undefined; + } + type CorsOptionsDelegate = ( + req: T, + callback: (err: Error | null, options?: CorsOptions) => void, + ) => void; +} + +declare function e( + options?: e.CorsOptions | e.CorsOptionsDelegate, +): ( + req: T, + res: { + statusCode?: number | undefined; + setHeader(key: string, value: string): any; + end(): any; + }, + next: (err?: any) => any, +) => void; +export = e; + +```` + +### Additional Details + * Last updated: Sat, 07 Jun 2025 02:15:25 GMT + * Dependencies: [@types/node](https://npmjs.com/package/@types/node) + +# Credits +These definitions were written by [Alan Plum](https://github.com/pluma), [Gaurav Sharma](https://github.com/gtpan77), and [Sebastian Beltran](https://github.com/bjohansebas). diff --git a/node_modules/@types/cors/index.d.ts b/node_modules/@types/cors/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5ab0dcf5f07af2f765150e974e83d1d5607f4e73 --- /dev/null +++ b/node_modules/@types/cors/index.d.ts @@ -0,0 +1,56 @@ +/// + +import { IncomingHttpHeaders } from "http"; + +type StaticOrigin = boolean | string | RegExp | Array; + +type CustomOrigin = ( + requestOrigin: string | undefined, + callback: (err: Error | null, origin?: StaticOrigin) => void, +) => void; + +declare namespace e { + interface CorsRequest { + method?: string | undefined; + headers: IncomingHttpHeaders; + } + interface CorsOptions { + /** + * @default '*' + */ + origin?: StaticOrigin | CustomOrigin | undefined; + /** + * @default 'GET,HEAD,PUT,PATCH,POST,DELETE' + */ + methods?: string | string[] | undefined; + allowedHeaders?: string | string[] | undefined; + exposedHeaders?: string | string[] | undefined; + credentials?: boolean | undefined; + maxAge?: number | undefined; + /** + * @default false + */ + preflightContinue?: boolean | undefined; + /** + * @default 204 + */ + optionsSuccessStatus?: number | undefined; + } + type CorsOptionsDelegate = ( + req: T, + callback: (err: Error | null, options?: CorsOptions) => void, + ) => void; +} + +declare function e( + options?: e.CorsOptions | e.CorsOptionsDelegate, +): ( + req: T, + res: { + statusCode?: number | undefined; + setHeader(key: string, value: string): any; + end(): any; + }, + next: (err?: any) => any, +) => void; +export = e; diff --git a/node_modules/@types/cors/package.json b/node_modules/@types/cors/package.json new file mode 100644 index 0000000000000000000000000000000000000000..4824a1766b616cf9655c4c0b3b06a71231192261 --- /dev/null +++ b/node_modules/@types/cors/package.json @@ -0,0 +1,38 @@ +{ + "name": "@types/cors", + "version": "2.8.19", + "description": "TypeScript definitions for cors", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cors", + "license": "MIT", + "contributors": [ + { + "name": "Alan Plum", + "githubUsername": "pluma", + "url": "https://github.com/pluma" + }, + { + "name": "Gaurav Sharma", + "githubUsername": "gtpan77", + "url": "https://github.com/gtpan77" + }, + { + "name": "Sebastian Beltran", + "githubUsername": "bjohansebas", + "url": "https://github.com/bjohansebas" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/cors" + }, + "scripts": {}, + "dependencies": { + "@types/node": "*" + }, + "peerDependencies": {}, + "typesPublisherContentHash": "a090e558c5f443573318c2955deecddc840bd8dfaac7cdedf31c7f6ede8d0b47", + "typeScriptVersion": "5.1" +} \ No newline at end of file diff --git a/node_modules/@types/deep-eql/LICENSE b/node_modules/@types/deep-eql/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9e841e7a26e4eb057b24511e7b92d42b257a80e5 --- /dev/null +++ b/node_modules/@types/deep-eql/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/deep-eql/README.md b/node_modules/@types/deep-eql/README.md new file mode 100644 index 0000000000000000000000000000000000000000..48d96fc640646ee93d86361629362e069b02d943 --- /dev/null +++ b/node_modules/@types/deep-eql/README.md @@ -0,0 +1,57 @@ +# Installation +> `npm install --save @types/deep-eql` + +# Summary +This package contains type definitions for deep-eql (https://github.com/chaijs/deep-eql). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/deep-eql. +## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/deep-eql/index.d.ts) +````ts +declare namespace deepEqual { + /** + * Memoization class used to speed up comparison. + */ + class MemoizeMap extends WeakMap {} + + interface DeepEqualOptions { + /** + * Override default algorithm, determining custom equality. + */ + comparator?: (leftHandOperand: T1, rightHandOperand: T2) => boolean | null; + + /** + * Provide a custom memoization object which will cache the results of + * complex objects for a speed boost. + * + * By passing `false` you can disable memoization, but this will cause circular + * references to blow the stack. + */ + memoize?: MemoizeMap | false; + } +} + +/** + * Assert deeply nested sameValue equality between two objects of any type. + * + * @param leftHandOperand + * @param rightHandOperand + * @param [options] Additional options + * @return equal match + */ +declare function deepEqual( + leftHandOperand: T1, + rightHandOperand: T2, + options?: deepEqual.DeepEqualOptions, +): boolean; + +export = deepEqual; + +```` + +### Additional Details + * Last updated: Mon, 06 Nov 2023 22:41:05 GMT + * Dependencies: none + +# Credits +These definitions were written by [Rodrigo Pietnechuk](https://github.com/ghnoob). diff --git a/node_modules/@types/deep-eql/index.d.ts b/node_modules/@types/deep-eql/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0cdbefe9301da39d735b3ea6f4a49b89fe7e3a53 --- /dev/null +++ b/node_modules/@types/deep-eql/index.d.ts @@ -0,0 +1,38 @@ +declare namespace deepEqual { + /** + * Memoization class used to speed up comparison. + */ + class MemoizeMap extends WeakMap {} + + interface DeepEqualOptions { + /** + * Override default algorithm, determining custom equality. + */ + comparator?: (leftHandOperand: T1, rightHandOperand: T2) => boolean | null; + + /** + * Provide a custom memoization object which will cache the results of + * complex objects for a speed boost. + * + * By passing `false` you can disable memoization, but this will cause circular + * references to blow the stack. + */ + memoize?: MemoizeMap | false; + } +} + +/** + * Assert deeply nested sameValue equality between two objects of any type. + * + * @param leftHandOperand + * @param rightHandOperand + * @param [options] Additional options + * @return equal match + */ +declare function deepEqual( + leftHandOperand: T1, + rightHandOperand: T2, + options?: deepEqual.DeepEqualOptions, +): boolean; + +export = deepEqual; diff --git a/node_modules/@types/deep-eql/package.json b/node_modules/@types/deep-eql/package.json new file mode 100644 index 0000000000000000000000000000000000000000..876158157acfa7714bd4716d9a49781d906b682a --- /dev/null +++ b/node_modules/@types/deep-eql/package.json @@ -0,0 +1,25 @@ +{ + "name": "@types/deep-eql", + "version": "4.0.2", + "description": "TypeScript definitions for deep-eql", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/deep-eql", + "license": "MIT", + "contributors": [ + { + "name": "Rodrigo Pietnechuk", + "githubUsername": "ghnoob", + "url": "https://github.com/ghnoob" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/deep-eql" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "3b8981ce557947fc00ca08cbd93b4206bfc0943360956867381a0a3f6b1eabf5", + "typeScriptVersion": "4.5" +} \ No newline at end of file diff --git a/node_modules/@types/esrecurse/LICENSE b/node_modules/@types/esrecurse/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9e841e7a26e4eb057b24511e7b92d42b257a80e5 --- /dev/null +++ b/node_modules/@types/esrecurse/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/esrecurse/README.md b/node_modules/@types/esrecurse/README.md new file mode 100644 index 0000000000000000000000000000000000000000..b3ca69aa596852eeda9afabf4cdfd8f4ff94e1cb --- /dev/null +++ b/node_modules/@types/esrecurse/README.md @@ -0,0 +1,72 @@ +# Installation +> `npm install --save @types/esrecurse` + +# Summary +This package contains type definitions for esrecurse (https://github.com/estools/esrecurse). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/esrecurse. +## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/esrecurse/index.d.ts) +````ts +/** + * Options for the Visitor constructor and visit function. + */ +interface VisitorOptions { + /** + * Fallback strategy for unknown node types. + * @default 'iteration' + */ + fallback?: "iteration" | ((node: any) => string[]); + + /** + * Custom keys for child nodes by node type. + * @default {} + */ + childVisitorKeys?: Record; +} + +/** + * A visitor class for recursively traversing ECMAScript AST. + */ +declare class Visitor { + /** + * Creates a new Visitor instance. + * @param options Configuration options for the visitor. + */ + constructor(visitor?: Visitor | null, options?: VisitorOptions | null); + + /** + * Visits a node, invoking the appropriate handler. + * @param node The AST node to visit. + */ + visit(node: any): void; + + /** + * Visits the children of a node based on childVisitorKeys. + * @param node The AST node whose children to visit. + */ + visitChildren(node: any): void; +} + +/** + * Visits an AST node with the specified visitor. + * @param ast The AST node to traverse. + * @param visitor A visitor instance or visitor object. + * @param options Configuration options for the traversal. + */ +declare function visit( + ast: any, + visitor?: Visitor | Record void> | null, + options?: VisitorOptions, +): void; + +export { visit, Visitor, type VisitorOptions }; + +```` + +### Additional Details + * Last updated: Sat, 19 Jul 2025 03:47:05 GMT + * Dependencies: none + +# Credits +These definitions were written by [Jimmy Leung](https://github.com/hkleungai). diff --git a/node_modules/@types/esrecurse/index.d.ts b/node_modules/@types/esrecurse/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3f236058874e03e08f366b8f8183c37b64026a08 --- /dev/null +++ b/node_modules/@types/esrecurse/index.d.ts @@ -0,0 +1,53 @@ +/** + * Options for the Visitor constructor and visit function. + */ +interface VisitorOptions { + /** + * Fallback strategy for unknown node types. + * @default 'iteration' + */ + fallback?: "iteration" | ((node: any) => string[]); + + /** + * Custom keys for child nodes by node type. + * @default {} + */ + childVisitorKeys?: Record; +} + +/** + * A visitor class for recursively traversing ECMAScript AST. + */ +declare class Visitor { + /** + * Creates a new Visitor instance. + * @param options Configuration options for the visitor. + */ + constructor(visitor?: Visitor | null, options?: VisitorOptions | null); + + /** + * Visits a node, invoking the appropriate handler. + * @param node The AST node to visit. + */ + visit(node: any): void; + + /** + * Visits the children of a node based on childVisitorKeys. + * @param node The AST node whose children to visit. + */ + visitChildren(node: any): void; +} + +/** + * Visits an AST node with the specified visitor. + * @param ast The AST node to traverse. + * @param visitor A visitor instance or visitor object. + * @param options Configuration options for the traversal. + */ +declare function visit( + ast: any, + visitor?: Visitor | Record void> | null, + options?: VisitorOptions, +): void; + +export { visit, Visitor, type VisitorOptions }; diff --git a/node_modules/@types/esrecurse/package.json b/node_modules/@types/esrecurse/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0e5bc852ac93c05ee4ca302103f8664dd72a6067 --- /dev/null +++ b/node_modules/@types/esrecurse/package.json @@ -0,0 +1,26 @@ +{ + "name": "@types/esrecurse", + "version": "4.3.1", + "description": "TypeScript definitions for esrecurse", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/esrecurse", + "license": "MIT", + "contributors": [ + { + "name": "Jimmy Leung", + "githubUsername": "hkleungai", + "url": "https://github.com/hkleungai" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/esrecurse" + }, + "scripts": {}, + "dependencies": {}, + "peerDependencies": {}, + "typesPublisherContentHash": "0e4ed7e0fe84b6879532ce29fdfe397c1fc205d0c9dbc17172b64f3016ae0065", + "typeScriptVersion": "5.1" +} \ No newline at end of file diff --git a/node_modules/@types/estree/LICENSE b/node_modules/@types/estree/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9e841e7a26e4eb057b24511e7b92d42b257a80e5 --- /dev/null +++ b/node_modules/@types/estree/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/estree/README.md b/node_modules/@types/estree/README.md new file mode 100644 index 0000000000000000000000000000000000000000..3e3e70f01583cd5430652cfa6db8f08d309d37b5 --- /dev/null +++ b/node_modules/@types/estree/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/estree` + +# Summary +This package contains type definitions for estree (https://github.com/estree/estree). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree. + +### Additional Details + * Last updated: Wed, 06 May 2026 21:01:00 GMT + * Dependencies: none + +# Credits +These definitions were written by [RReverser](https://github.com/RReverser). diff --git a/node_modules/@types/estree/flow.d.ts b/node_modules/@types/estree/flow.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9d001a92b55a9323e827ee90ef353df47f3c2fa0 --- /dev/null +++ b/node_modules/@types/estree/flow.d.ts @@ -0,0 +1,167 @@ +declare namespace ESTree { + interface FlowTypeAnnotation extends Node {} + + interface FlowBaseTypeAnnotation extends FlowTypeAnnotation {} + + interface FlowLiteralTypeAnnotation extends FlowTypeAnnotation, Literal {} + + interface FlowDeclaration extends Declaration {} + + interface AnyTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface ArrayTypeAnnotation extends FlowTypeAnnotation { + elementType: FlowTypeAnnotation; + } + + interface BooleanLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} + + interface BooleanTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface ClassImplements extends Node { + id: Identifier; + typeParameters?: TypeParameterInstantiation | null; + } + + interface ClassProperty { + key: Expression; + value?: Expression | null; + typeAnnotation?: TypeAnnotation | null; + computed: boolean; + static: boolean; + } + + interface DeclareClass extends FlowDeclaration { + id: Identifier; + typeParameters?: TypeParameterDeclaration | null; + body: ObjectTypeAnnotation; + extends: InterfaceExtends[]; + } + + interface DeclareFunction extends FlowDeclaration { + id: Identifier; + } + + interface DeclareModule extends FlowDeclaration { + id: Literal | Identifier; + body: BlockStatement; + } + + interface DeclareVariable extends FlowDeclaration { + id: Identifier; + } + + interface FunctionTypeAnnotation extends FlowTypeAnnotation { + params: FunctionTypeParam[]; + returnType: FlowTypeAnnotation; + rest?: FunctionTypeParam | null; + typeParameters?: TypeParameterDeclaration | null; + } + + interface FunctionTypeParam { + name: Identifier; + typeAnnotation: FlowTypeAnnotation; + optional: boolean; + } + + interface GenericTypeAnnotation extends FlowTypeAnnotation { + id: Identifier | QualifiedTypeIdentifier; + typeParameters?: TypeParameterInstantiation | null; + } + + interface InterfaceExtends extends Node { + id: Identifier | QualifiedTypeIdentifier; + typeParameters?: TypeParameterInstantiation | null; + } + + interface InterfaceDeclaration extends FlowDeclaration { + id: Identifier; + typeParameters?: TypeParameterDeclaration | null; + extends: InterfaceExtends[]; + body: ObjectTypeAnnotation; + } + + interface IntersectionTypeAnnotation extends FlowTypeAnnotation { + types: FlowTypeAnnotation[]; + } + + interface MixedTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface NullableTypeAnnotation extends FlowTypeAnnotation { + typeAnnotation: TypeAnnotation; + } + + interface NumberLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} + + interface NumberTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface StringLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} + + interface StringTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface TupleTypeAnnotation extends FlowTypeAnnotation { + types: FlowTypeAnnotation[]; + } + + interface TypeofTypeAnnotation extends FlowTypeAnnotation { + argument: FlowTypeAnnotation; + } + + interface TypeAlias extends FlowDeclaration { + id: Identifier; + typeParameters?: TypeParameterDeclaration | null; + right: FlowTypeAnnotation; + } + + interface TypeAnnotation extends Node { + typeAnnotation: FlowTypeAnnotation; + } + + interface TypeCastExpression extends Expression { + expression: Expression; + typeAnnotation: TypeAnnotation; + } + + interface TypeParameterDeclaration extends Node { + params: Identifier[]; + } + + interface TypeParameterInstantiation extends Node { + params: FlowTypeAnnotation[]; + } + + interface ObjectTypeAnnotation extends FlowTypeAnnotation { + properties: ObjectTypeProperty[]; + indexers: ObjectTypeIndexer[]; + callProperties: ObjectTypeCallProperty[]; + } + + interface ObjectTypeCallProperty extends Node { + value: FunctionTypeAnnotation; + static: boolean; + } + + interface ObjectTypeIndexer extends Node { + id: Identifier; + key: FlowTypeAnnotation; + value: FlowTypeAnnotation; + static: boolean; + } + + interface ObjectTypeProperty extends Node { + key: Expression; + value: FlowTypeAnnotation; + optional: boolean; + static: boolean; + } + + interface QualifiedTypeIdentifier extends Node { + qualification: Identifier | QualifiedTypeIdentifier; + id: Identifier; + } + + interface UnionTypeAnnotation extends FlowTypeAnnotation { + types: FlowTypeAnnotation[]; + } + + interface VoidTypeAnnotation extends FlowBaseTypeAnnotation {} +} diff --git a/node_modules/@types/estree/index.d.ts b/node_modules/@types/estree/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7d4ab36f42613e5314fec0a386ac49aa5262b172 --- /dev/null +++ b/node_modules/@types/estree/index.d.ts @@ -0,0 +1,694 @@ +// This definition file follows a somewhat unusual format. ESTree allows +// runtime type checks based on the `type` parameter. In order to explain this +// to typescript we want to use discriminated union types: +// https://github.com/Microsoft/TypeScript/pull/9163 +// +// For ESTree this is a bit tricky because the high level interfaces like +// Node or Function are pulling double duty. We want to pass common fields down +// to the interfaces that extend them (like Identifier or +// ArrowFunctionExpression), but you can't extend a type union or enforce +// common fields on them. So we've split the high level interfaces into two +// types, a base type which passes down inherited fields, and a type union of +// all types which extend the base type. Only the type union is exported, and +// the union is how other types refer to the collection of inheriting types. +// +// This makes the definitions file here somewhat more difficult to maintain, +// but it has the notable advantage of making ESTree much easier to use as +// an end user. + +export interface BaseNodeWithoutComments { + // Every leaf interface that extends BaseNode must specify a type property. + // The type property should be a string literal. For example, Identifier + // has: `type: "Identifier"` + type: string; + loc?: SourceLocation | null | undefined; + range?: [number, number] | undefined; +} + +export interface BaseNode extends BaseNodeWithoutComments { + leadingComments?: Comment[] | undefined; + trailingComments?: Comment[] | undefined; +} + +export interface NodeMap { + AssignmentProperty: AssignmentProperty; + CatchClause: CatchClause; + Class: Class; + ClassBody: ClassBody; + Expression: Expression; + Function: Function; + Identifier: Identifier; + Literal: Literal; + MethodDefinition: MethodDefinition; + ModuleDeclaration: ModuleDeclaration; + ModuleSpecifier: ModuleSpecifier; + Pattern: Pattern; + PrivateIdentifier: PrivateIdentifier; + Program: Program; + Property: Property; + PropertyDefinition: PropertyDefinition; + SpreadElement: SpreadElement; + Statement: Statement; + Super: Super; + SwitchCase: SwitchCase; + TemplateElement: TemplateElement; + VariableDeclarator: VariableDeclarator; +} + +export type Node = NodeMap[keyof NodeMap]; + +export interface Comment extends BaseNodeWithoutComments { + type: "Line" | "Block"; + value: string; +} + +export interface SourceLocation { + source?: string | null | undefined; + start: Position; + end: Position; +} + +export interface Position { + /** >= 1 */ + line: number; + /** >= 0 */ + column: number; +} + +export interface Program extends BaseNode { + type: "Program"; + sourceType: "script" | "module"; + body: Array; + comments?: Comment[] | undefined; +} + +export interface Directive extends BaseNode { + type: "ExpressionStatement"; + expression: Literal; + directive: string; +} + +export interface BaseFunction extends BaseNode { + params: Pattern[]; + generator?: boolean | undefined; + async?: boolean | undefined; + // The body is either BlockStatement or Expression because arrow functions + // can have a body that's either. FunctionDeclarations and + // FunctionExpressions have only BlockStatement bodies. + body: BlockStatement | Expression; +} + +export type Function = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression; + +export type Statement = + | ExpressionStatement + | BlockStatement + | StaticBlock + | EmptyStatement + | DebuggerStatement + | WithStatement + | ReturnStatement + | LabeledStatement + | BreakStatement + | ContinueStatement + | IfStatement + | SwitchStatement + | ThrowStatement + | TryStatement + | WhileStatement + | DoWhileStatement + | ForStatement + | ForInStatement + | ForOfStatement + | Declaration; + +export interface BaseStatement extends BaseNode {} + +export interface EmptyStatement extends BaseStatement { + type: "EmptyStatement"; +} + +export interface BlockStatement extends BaseStatement { + type: "BlockStatement"; + body: Statement[]; + innerComments?: Comment[] | undefined; +} + +export interface StaticBlock extends Omit { + type: "StaticBlock"; +} + +export interface ExpressionStatement extends BaseStatement { + type: "ExpressionStatement"; + expression: Expression; +} + +export interface IfStatement extends BaseStatement { + type: "IfStatement"; + test: Expression; + consequent: Statement; + alternate?: Statement | null | undefined; +} + +export interface LabeledStatement extends BaseStatement { + type: "LabeledStatement"; + label: Identifier; + body: Statement; +} + +export interface BreakStatement extends BaseStatement { + type: "BreakStatement"; + label?: Identifier | null | undefined; +} + +export interface ContinueStatement extends BaseStatement { + type: "ContinueStatement"; + label?: Identifier | null | undefined; +} + +export interface WithStatement extends BaseStatement { + type: "WithStatement"; + object: Expression; + body: Statement; +} + +export interface SwitchStatement extends BaseStatement { + type: "SwitchStatement"; + discriminant: Expression; + cases: SwitchCase[]; +} + +export interface ReturnStatement extends BaseStatement { + type: "ReturnStatement"; + argument?: Expression | null | undefined; +} + +export interface ThrowStatement extends BaseStatement { + type: "ThrowStatement"; + argument: Expression; +} + +export interface TryStatement extends BaseStatement { + type: "TryStatement"; + block: BlockStatement; + handler?: CatchClause | null | undefined; + finalizer?: BlockStatement | null | undefined; +} + +export interface WhileStatement extends BaseStatement { + type: "WhileStatement"; + test: Expression; + body: Statement; +} + +export interface DoWhileStatement extends BaseStatement { + type: "DoWhileStatement"; + body: Statement; + test: Expression; +} + +export interface ForStatement extends BaseStatement { + type: "ForStatement"; + init?: VariableDeclaration | Expression | null | undefined; + test?: Expression | null | undefined; + update?: Expression | null | undefined; + body: Statement; +} + +export interface BaseForXStatement extends BaseStatement { + left: VariableDeclaration | Pattern; + right: Expression; + body: Statement; +} + +export interface ForInStatement extends BaseForXStatement { + type: "ForInStatement"; +} + +export interface DebuggerStatement extends BaseStatement { + type: "DebuggerStatement"; +} + +export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration; + +export interface BaseDeclaration extends BaseStatement {} + +export interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration { + type: "FunctionDeclaration"; + /** It is null when a function declaration is a part of the `export default function` statement */ + id: Identifier | null; + body: BlockStatement; +} + +export interface FunctionDeclaration extends MaybeNamedFunctionDeclaration { + id: Identifier; +} + +export interface VariableDeclaration extends BaseDeclaration { + type: "VariableDeclaration"; + declarations: VariableDeclarator[]; + kind: "var" | "let" | "const" | "using" | "await using"; +} + +export interface VariableDeclarator extends BaseNode { + type: "VariableDeclarator"; + id: Pattern; + init?: Expression | null | undefined; +} + +export interface ExpressionMap { + ArrayExpression: ArrayExpression; + ArrowFunctionExpression: ArrowFunctionExpression; + AssignmentExpression: AssignmentExpression; + AwaitExpression: AwaitExpression; + BinaryExpression: BinaryExpression; + CallExpression: CallExpression; + ChainExpression: ChainExpression; + ClassExpression: ClassExpression; + ConditionalExpression: ConditionalExpression; + FunctionExpression: FunctionExpression; + Identifier: Identifier; + ImportExpression: ImportExpression; + Literal: Literal; + LogicalExpression: LogicalExpression; + MemberExpression: MemberExpression; + MetaProperty: MetaProperty; + NewExpression: NewExpression; + ObjectExpression: ObjectExpression; + SequenceExpression: SequenceExpression; + TaggedTemplateExpression: TaggedTemplateExpression; + TemplateLiteral: TemplateLiteral; + ThisExpression: ThisExpression; + UnaryExpression: UnaryExpression; + UpdateExpression: UpdateExpression; + YieldExpression: YieldExpression; +} + +export type Expression = ExpressionMap[keyof ExpressionMap]; + +export interface BaseExpression extends BaseNode {} + +export type ChainElement = SimpleCallExpression | MemberExpression; + +export interface ChainExpression extends BaseExpression { + type: "ChainExpression"; + expression: ChainElement; +} + +export interface ThisExpression extends BaseExpression { + type: "ThisExpression"; +} + +export interface ArrayExpression extends BaseExpression { + type: "ArrayExpression"; + elements: Array; +} + +export interface ObjectExpression extends BaseExpression { + type: "ObjectExpression"; + properties: Array; +} + +export interface PrivateIdentifier extends BaseNode { + type: "PrivateIdentifier"; + name: string; +} + +export interface Property extends BaseNode { + type: "Property"; + key: Expression; + value: Expression | Pattern; // Could be an AssignmentProperty + kind: "init" | "get" | "set"; + method: boolean; + shorthand: boolean; + computed: boolean; +} + +export interface PropertyDefinition extends BaseNode { + type: "PropertyDefinition"; + key: Expression | PrivateIdentifier; + value?: Expression | null | undefined; + computed: boolean; + static: boolean; +} + +export interface FunctionExpression extends BaseFunction, BaseExpression { + id?: Identifier | null | undefined; + type: "FunctionExpression"; + body: BlockStatement; +} + +export interface SequenceExpression extends BaseExpression { + type: "SequenceExpression"; + expressions: Expression[]; +} + +export interface UnaryExpression extends BaseExpression { + type: "UnaryExpression"; + operator: UnaryOperator; + prefix: true; + argument: Expression; +} + +export interface BinaryExpression extends BaseExpression { + type: "BinaryExpression"; + operator: BinaryOperator; + left: Expression | PrivateIdentifier; + right: Expression; +} + +export interface AssignmentExpression extends BaseExpression { + type: "AssignmentExpression"; + operator: AssignmentOperator; + left: Pattern | MemberExpression; + right: Expression; +} + +export interface UpdateExpression extends BaseExpression { + type: "UpdateExpression"; + operator: UpdateOperator; + argument: Expression; + prefix: boolean; +} + +export interface LogicalExpression extends BaseExpression { + type: "LogicalExpression"; + operator: LogicalOperator; + left: Expression; + right: Expression; +} + +export interface ConditionalExpression extends BaseExpression { + type: "ConditionalExpression"; + test: Expression; + alternate: Expression; + consequent: Expression; +} + +export interface BaseCallExpression extends BaseExpression { + callee: Expression | Super; + arguments: Array; +} +export type CallExpression = SimpleCallExpression | NewExpression; + +export interface SimpleCallExpression extends BaseCallExpression { + type: "CallExpression"; + optional: boolean; +} + +export interface NewExpression extends BaseCallExpression { + type: "NewExpression"; +} + +export interface MemberExpression extends BaseExpression, BasePattern { + type: "MemberExpression"; + object: Expression | Super; + property: Expression | PrivateIdentifier; + computed: boolean; + optional: boolean; +} + +export type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression; + +export interface BasePattern extends BaseNode {} + +export interface SwitchCase extends BaseNode { + type: "SwitchCase"; + test?: Expression | null | undefined; + consequent: Statement[]; +} + +export interface CatchClause extends BaseNode { + type: "CatchClause"; + param: Pattern | null; + body: BlockStatement; +} + +export interface Identifier extends BaseNode, BaseExpression, BasePattern { + type: "Identifier"; + name: string; +} + +export type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral; + +export interface SimpleLiteral extends BaseNode, BaseExpression { + type: "Literal"; + value: string | boolean | number | null; + raw?: string | undefined; +} + +export interface RegExpLiteral extends BaseNode, BaseExpression { + type: "Literal"; + value?: RegExp | null | undefined; + regex: { + pattern: string; + flags: string; + }; + raw?: string | undefined; +} + +export interface BigIntLiteral extends BaseNode, BaseExpression { + type: "Literal"; + value?: bigint | null | undefined; + bigint: string; + raw?: string | undefined; +} + +export type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete"; + +export type BinaryOperator = + | "==" + | "!=" + | "===" + | "!==" + | "<" + | "<=" + | ">" + | ">=" + | "<<" + | ">>" + | ">>>" + | "+" + | "-" + | "*" + | "/" + | "%" + | "**" + | "|" + | "^" + | "&" + | "in" + | "instanceof"; + +export type LogicalOperator = "||" | "&&" | "??"; + +export type AssignmentOperator = + | "=" + | "+=" + | "-=" + | "*=" + | "/=" + | "%=" + | "**=" + | "<<=" + | ">>=" + | ">>>=" + | "|=" + | "^=" + | "&=" + | "||=" + | "&&=" + | "??="; + +export type UpdateOperator = "++" | "--"; + +export interface ForOfStatement extends BaseForXStatement { + type: "ForOfStatement"; + await: boolean; +} + +export interface Super extends BaseNode { + type: "Super"; +} + +export interface SpreadElement extends BaseNode { + type: "SpreadElement"; + argument: Expression; +} + +export interface ArrowFunctionExpression extends BaseExpression, BaseFunction { + type: "ArrowFunctionExpression"; + expression: boolean; + body: BlockStatement | Expression; +} + +export interface YieldExpression extends BaseExpression { + type: "YieldExpression"; + argument?: Expression | null | undefined; + delegate: boolean; +} + +export interface TemplateLiteral extends BaseExpression { + type: "TemplateLiteral"; + quasis: TemplateElement[]; + expressions: Expression[]; +} + +export interface TaggedTemplateExpression extends BaseExpression { + type: "TaggedTemplateExpression"; + tag: Expression; + quasi: TemplateLiteral; +} + +export interface TemplateElement extends BaseNode { + type: "TemplateElement"; + tail: boolean; + value: { + /** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */ + cooked?: string | null | undefined; + raw: string; + }; +} + +export interface AssignmentProperty extends Property { + value: Pattern; + kind: "init"; + method: boolean; // false +} + +export interface ObjectPattern extends BasePattern { + type: "ObjectPattern"; + properties: Array; +} + +export interface ArrayPattern extends BasePattern { + type: "ArrayPattern"; + elements: Array; +} + +export interface RestElement extends BasePattern { + type: "RestElement"; + argument: Pattern; +} + +export interface AssignmentPattern extends BasePattern { + type: "AssignmentPattern"; + left: Pattern; + right: Expression; +} + +export type Class = ClassDeclaration | ClassExpression; +export interface BaseClass extends BaseNode { + superClass?: Expression | null | undefined; + body: ClassBody; +} + +export interface ClassBody extends BaseNode { + type: "ClassBody"; + body: Array; +} + +export interface MethodDefinition extends BaseNode { + type: "MethodDefinition"; + key: Expression | PrivateIdentifier; + value: FunctionExpression; + kind: "constructor" | "method" | "get" | "set"; + computed: boolean; + static: boolean; +} + +export interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration { + type: "ClassDeclaration"; + /** It is null when a class declaration is a part of the `export default class` statement */ + id: Identifier | null; +} + +export interface ClassDeclaration extends MaybeNamedClassDeclaration { + id: Identifier; +} + +export interface ClassExpression extends BaseClass, BaseExpression { + type: "ClassExpression"; + id?: Identifier | null | undefined; +} + +export interface MetaProperty extends BaseExpression { + type: "MetaProperty"; + meta: Identifier; + property: Identifier; +} + +export type ModuleDeclaration = + | ImportDeclaration + | ExportNamedDeclaration + | ExportDefaultDeclaration + | ExportAllDeclaration; +export interface BaseModuleDeclaration extends BaseNode {} + +export type ModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier; +export interface BaseModuleSpecifier extends BaseNode { + local: Identifier; +} + +export interface ImportDeclaration extends BaseModuleDeclaration { + type: "ImportDeclaration"; + specifiers: Array; + attributes: ImportAttribute[]; + source: Literal; +} + +export interface ImportSpecifier extends BaseModuleSpecifier { + type: "ImportSpecifier"; + imported: Identifier | Literal; +} + +export interface ImportAttribute extends BaseNode { + type: "ImportAttribute"; + key: Identifier | Literal; + value: Literal; +} + +export interface ImportExpression extends BaseExpression { + type: "ImportExpression"; + source: Expression; + options?: Expression | null | undefined; +} + +export interface ImportDefaultSpecifier extends BaseModuleSpecifier { + type: "ImportDefaultSpecifier"; +} + +export interface ImportNamespaceSpecifier extends BaseModuleSpecifier { + type: "ImportNamespaceSpecifier"; +} + +export interface ExportNamedDeclaration extends BaseModuleDeclaration { + type: "ExportNamedDeclaration"; + declaration?: Declaration | null | undefined; + specifiers: ExportSpecifier[]; + attributes: ImportAttribute[]; + source?: Literal | null | undefined; +} + +export interface ExportSpecifier extends Omit { + type: "ExportSpecifier"; + local: Identifier | Literal; + exported: Identifier | Literal; +} + +export interface ExportDefaultDeclaration extends BaseModuleDeclaration { + type: "ExportDefaultDeclaration"; + declaration: MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration | Expression; +} + +export interface ExportAllDeclaration extends BaseModuleDeclaration { + type: "ExportAllDeclaration"; + exported: Identifier | Literal | null; + attributes: ImportAttribute[]; + source: Literal; +} + +export interface AwaitExpression extends BaseExpression { + type: "AwaitExpression"; + argument: Expression; +} diff --git a/node_modules/@types/estree/package.json b/node_modules/@types/estree/package.json new file mode 100644 index 0000000000000000000000000000000000000000..367a5d94af266a93e60d5c48d9400a948f120762 --- /dev/null +++ b/node_modules/@types/estree/package.json @@ -0,0 +1,27 @@ +{ + "name": "@types/estree", + "version": "1.0.9", + "description": "TypeScript definitions for estree", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree", + "license": "MIT", + "contributors": [ + { + "name": "RReverser", + "githubUsername": "RReverser", + "url": "https://github.com/RReverser" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/estree" + }, + "scripts": {}, + "dependencies": {}, + "peerDependencies": {}, + "typesPublisherContentHash": "db16da859cb0bee641414117047a4becba2e9f39d3e14a6745f887c47ef68482", + "typeScriptVersion": "5.3", + "nonNpm": true +} \ No newline at end of file diff --git a/node_modules/@types/express-serve-static-core/LICENSE b/node_modules/@types/express-serve-static-core/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9e841e7a26e4eb057b24511e7b92d42b257a80e5 --- /dev/null +++ b/node_modules/@types/express-serve-static-core/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/express-serve-static-core/README.md b/node_modules/@types/express-serve-static-core/README.md new file mode 100644 index 0000000000000000000000000000000000000000..9d3a9c32d128f910fd679b888201e98317ea21fe --- /dev/null +++ b/node_modules/@types/express-serve-static-core/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/express-serve-static-core` + +# Summary +This package contains type definitions for express-serve-static-core (http://expressjs.com). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-serve-static-core/v4. + +### Additional Details + * Last updated: Sat, 10 Jan 2026 09:35:12 GMT + * Dependencies: [@types/node](https://npmjs.com/package/@types/node), [@types/qs](https://npmjs.com/package/@types/qs), [@types/range-parser](https://npmjs.com/package/@types/range-parser), [@types/send](https://npmjs.com/package/@types/send) + +# Credits +These definitions were written by [Boris Yankov](https://github.com/borisyankov), [Satana Charuwichitratana](https://github.com/micksatana), [Jose Luis Leon](https://github.com/JoseLion), [David Stephens](https://github.com/dwrss), and [Shin Ando](https://github.com/andoshin11). diff --git a/node_modules/@types/express-serve-static-core/index.d.ts b/node_modules/@types/express-serve-static-core/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..878b4e8819be7e855ba024dcb7f3b7d91098889e --- /dev/null +++ b/node_modules/@types/express-serve-static-core/index.d.ts @@ -0,0 +1,1281 @@ +// This extracts the core definitions from express to prevent a circular dependency between express and serve-static +/// + +import { SendOptions } from "send"; + +declare global { + namespace Express { + // These open interfaces may be extended in an application-specific manner via declaration merging. + // See for example method-override.d.ts (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/method-override/index.d.ts) + interface Request {} + interface Response {} + interface Locals {} + interface Application {} + } +} + +import { EventEmitter } from "events"; +import * as http from "http"; +import { ParsedQs } from "qs"; +import { Options as RangeParserOptions, Ranges as RangeParserRanges, Result as RangeParserResult } from "range-parser"; + +export {}; + +export type Query = ParsedQs; + +export interface NextFunction { + (err?: any): void; + /** + * "Break-out" of a router by calling {next('router')}; + * @see {https://expressjs.com/en/guide/using-middleware.html#middleware.router} + */ + (deferToNext: "router"): void; + /** + * "Break-out" of a route by calling {next('route')}; + * @see {https://expressjs.com/en/guide/using-middleware.html#middleware.application} + */ + (deferToNext: "route"): void; +} + +export interface Dictionary { + [key: string]: T; +} + +export interface ParamsDictionary { + [key: string | number]: string; +} +export type Params = ParamsDictionary; + +export interface Locals extends Express.Locals {} + +export interface RequestHandler< + P = ParamsDictionary, + ResBody = any, + ReqBody = any, + ReqQuery = ParsedQs, + LocalsObj extends Record = Record, +> { + // tslint:disable-next-line callable-types (This is extended from and can't extend from a type alias in ts<2.2) + ( + req: Request, + res: Response, + next: NextFunction, + ): void; +} + +export type ErrorRequestHandler< + P = ParamsDictionary, + ResBody = any, + ReqBody = any, + ReqQuery = ParsedQs, + LocalsObj extends Record = Record, +> = ( + err: any, + req: Request, + res: Response, + next: NextFunction, +) => void; + +export type PathParams = string | RegExp | Array; + +export type RequestHandlerParams< + P = ParamsDictionary, + ResBody = any, + ReqBody = any, + ReqQuery = ParsedQs, + LocalsObj extends Record = Record, +> = + | RequestHandler + | ErrorRequestHandler + | Array | ErrorRequestHandler

>; + +type RemoveTail = S extends `${infer P}${Tail}` ? P : S; +type GetRouteParameter = RemoveTail< + RemoveTail, `-${string}`>, + `.${string}` +>; + +// prettier-ignore +export type RouteParameters = string extends Route ? ParamsDictionary + : Route extends `${string}(${string}` ? ParamsDictionary // TODO: handling for regex parameters + : Route extends `${string}:${infer Rest}` ? + & ( + GetRouteParameter extends never ? ParamsDictionary + : GetRouteParameter extends `${infer ParamName}?` ? { [P in ParamName]?: string } + : { [P in GetRouteParameter]: string } + ) + & (Rest extends `${GetRouteParameter}${infer Next}` ? RouteParameters : unknown) + : {}; + +/* eslint-disable @definitelytyped/no-unnecessary-generics */ +export interface IRouterMatcher< + T, + Method extends "all" | "get" | "post" | "put" | "delete" | "patch" | "options" | "head" = any, +> { + < + Route extends string, + P = RouteParameters, + ResBody = any, + ReqBody = any, + ReqQuery = ParsedQs, + LocalsObj extends Record = Record, + >( + // (it's used as the default type parameter for P) + path: Route, + // (This generic is meant to be passed explicitly.) + ...handlers: Array> + ): T; + < + Path extends string, + P = RouteParameters, + ResBody = any, + ReqBody = any, + ReqQuery = ParsedQs, + LocalsObj extends Record = Record, + >( + // (it's used as the default type parameter for P) + path: Path, + // (This generic is meant to be passed explicitly.) + ...handlers: Array> + ): T; + < + P = ParamsDictionary, + ResBody = any, + ReqBody = any, + ReqQuery = ParsedQs, + LocalsObj extends Record = Record, + >( + path: PathParams, + // (This generic is meant to be passed explicitly.) + ...handlers: Array> + ): T; + < + P = ParamsDictionary, + ResBody = any, + ReqBody = any, + ReqQuery = ParsedQs, + LocalsObj extends Record = Record, + >( + path: PathParams, + // (This generic is meant to be passed explicitly.) + ...handlers: Array> + ): T; + (path: PathParams, subApplication: Application): T; +} + +export interface IRouterHandler { + (...handlers: Array>>): T; + (...handlers: Array>>): T; + < + P = RouteParameters, + ResBody = any, + ReqBody = any, + ReqQuery = ParsedQs, + LocalsObj extends Record = Record, + >( + // (This generic is meant to be passed explicitly.) + // eslint-disable-next-line @definitelytyped/no-unnecessary-generics + ...handlers: Array> + ): T; + < + P = RouteParameters, + ResBody = any, + ReqBody = any, + ReqQuery = ParsedQs, + LocalsObj extends Record = Record, + >( + // (This generic is meant to be passed explicitly.) + // eslint-disable-next-line @definitelytyped/no-unnecessary-generics + ...handlers: Array> + ): T; + < + P = ParamsDictionary, + ResBody = any, + ReqBody = any, + ReqQuery = ParsedQs, + LocalsObj extends Record = Record, + >( + // (This generic is meant to be passed explicitly.) + // eslint-disable-next-line @definitelytyped/no-unnecessary-generics + ...handlers: Array> + ): T; + < + P = ParamsDictionary, + ResBody = any, + ReqBody = any, + ReqQuery = ParsedQs, + LocalsObj extends Record = Record, + >( + // (This generic is meant to be passed explicitly.) + // eslint-disable-next-line @definitelytyped/no-unnecessary-generics + ...handlers: Array> + ): T; +} +/* eslint-enable @definitelytyped/no-unnecessary-generics */ + +export interface IRouter extends RequestHandler { + /** + * Map the given param placeholder `name`(s) to the given callback(s). + * + * Parameter mapping is used to provide pre-conditions to routes + * which use normalized placeholders. For example a _:user_id_ parameter + * could automatically load a user's information from the database without + * any additional code, + * + * The callback uses the samesignature as middleware, the only differencing + * being that the value of the placeholder is passed, in this case the _id_ + * of the user. Once the `next()` function is invoked, just like middleware + * it will continue on to execute the route, or subsequent parameter functions. + * + * app.param('user_id', function(req, res, next, id){ + * User.find(id, function(err, user){ + * if (err) { + * next(err); + * } else if (user) { + * req.user = user; + * next(); + * } else { + * next(new Error('failed to load user')); + * } + * }); + * }); + */ + param(name: string, handler: RequestParamHandler): this; + + /** + * Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param() + * + * @deprecated since version 4.11 + */ + param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this; + + /** + * Special-cased "all" method, applying the given route `path`, + * middleware, and callback to _every_ HTTP method. + */ + all: IRouterMatcher; + get: IRouterMatcher; + post: IRouterMatcher; + put: IRouterMatcher; + delete: IRouterMatcher; + patch: IRouterMatcher; + options: IRouterMatcher; + head: IRouterMatcher; + + checkout: IRouterMatcher; + connect: IRouterMatcher; + copy: IRouterMatcher; + lock: IRouterMatcher; + merge: IRouterMatcher; + mkactivity: IRouterMatcher; + mkcol: IRouterMatcher; + move: IRouterMatcher; + "m-search": IRouterMatcher; + notify: IRouterMatcher; + propfind: IRouterMatcher; + proppatch: IRouterMatcher; + purge: IRouterMatcher; + report: IRouterMatcher; + search: IRouterMatcher; + subscribe: IRouterMatcher; + trace: IRouterMatcher; + unlock: IRouterMatcher; + unsubscribe: IRouterMatcher; + link: IRouterMatcher; + unlink: IRouterMatcher; + + use: IRouterHandler & IRouterMatcher; + + route(prefix: T): IRoute; + route(prefix: PathParams): IRoute; + /** + * Stack of configured routes + */ + stack: ILayer[]; +} + +export interface ILayer { + route?: IRoute; + name: string | ""; + params?: Record; + keys: string[]; + path?: string; + method: string; + regexp: RegExp; + handle: (req: Request, res: Response, next: NextFunction) => any; +} + +export interface IRoute { + path: string; + stack: ILayer[]; + all: IRouterHandler; + get: IRouterHandler; + post: IRouterHandler; + put: IRouterHandler; + delete: IRouterHandler; + patch: IRouterHandler; + options: IRouterHandler; + head: IRouterHandler; + + checkout: IRouterHandler; + copy: IRouterHandler; + lock: IRouterHandler; + merge: IRouterHandler; + mkactivity: IRouterHandler; + mkcol: IRouterHandler; + move: IRouterHandler; + "m-search": IRouterHandler; + notify: IRouterHandler; + purge: IRouterHandler; + report: IRouterHandler; + search: IRouterHandler; + subscribe: IRouterHandler; + trace: IRouterHandler; + unlock: IRouterHandler; + unsubscribe: IRouterHandler; +} + +export interface Router extends IRouter {} + +/** + * Options passed down into `res.cookie` + * @link https://expressjs.com/en/api.html#res.cookie + */ +export interface CookieOptions { + /** Convenient option for setting the expiry time relative to the current time in **milliseconds**. */ + maxAge?: number | undefined; + /** Indicates if the cookie should be signed. */ + signed?: boolean | undefined; + /** Expiry date of the cookie in GMT. If not specified or set to 0, creates a session cookie. */ + expires?: Date | undefined; + /** Flags the cookie to be accessible only by the web server. */ + httpOnly?: boolean | undefined; + /** Path for the cookie. Defaults to “/”. */ + path?: string | undefined; + /** Domain name for the cookie. Defaults to the domain name of the app. */ + domain?: string | undefined; + /** Marks the cookie to be used with HTTPS only. */ + secure?: boolean | undefined; + /** A synchronous function used for cookie value encoding. Defaults to encodeURIComponent. */ + encode?: ((val: string) => string) | undefined; + /** + * Value of the “SameSite” Set-Cookie attribute. + * @link https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-4.1.1. + */ + sameSite?: boolean | "lax" | "strict" | "none" | undefined; + /** + * Value of the “Priority” Set-Cookie attribute. + * @link https://datatracker.ietf.org/doc/html/draft-west-cookie-priority-00#section-4.3 + */ + priority?: "low" | "medium" | "high"; + /** Marks the cookie to use partioned storage. */ + partitioned?: boolean | undefined; +} + +export interface ByteRange { + start: number; + end: number; +} + +export interface RequestRanges extends RangeParserRanges {} + +export type Errback = (err: Error) => void; + +export interface Request< + P = ParamsDictionary, + ResBody = any, + ReqBody = any, + ReqQuery = ParsedQs, + LocalsObj extends Record = Record, +> extends http.IncomingMessage, Express.Request { + /** + * Return request header. + * + * The `Referrer` header field is special-cased, + * both `Referrer` and `Referer` are interchangeable. + * + * Examples: + * + * req.get('Content-Type'); + * // => "text/plain" + * + * req.get('content-type'); + * // => "text/plain" + * + * req.get('Something'); + * // => undefined + * + * Aliased as `req.header()`. + */ + get(name: "set-cookie"): string[] | undefined; + get(name: string): string | undefined; + + header(name: "set-cookie"): string[] | undefined; + header(name: string): string | undefined; + + /** + * Check if the given `type(s)` is acceptable, returning + * the best match when true, otherwise `undefined`, in which + * case you should respond with 406 "Not Acceptable". + * + * The `type` value may be a single mime type string + * such as "application/json", the extension name + * such as "json", a comma-delimted list such as "json, html, text/plain", + * or an array `["json", "html", "text/plain"]`. When a list + * or array is given the _best_ match, if any is returned. + * + * Examples: + * + * // Accept: text/html + * req.accepts('html'); + * // => "html" + * + * // Accept: text/*, application/json + * req.accepts('html'); + * // => "html" + * req.accepts('text/html'); + * // => "text/html" + * req.accepts('json, text'); + * // => "json" + * req.accepts('application/json'); + * // => "application/json" + * + * // Accept: text/*, application/json + * req.accepts('image/png'); + * req.accepts('png'); + * // => false + * + * // Accept: text/*;q=.5, application/json + * req.accepts(['html', 'json']); + * req.accepts('html, json'); + * // => "json" + */ + accepts(): string[]; + accepts(type: string): string | false; + accepts(type: string[]): string | false; + accepts(...type: string[]): string | false; + + /** + * Returns the first accepted charset of the specified character sets, + * based on the request's Accept-Charset HTTP header field. + * If none of the specified charsets is accepted, returns false. + * + * For more information, or if you have issues or concerns, see accepts. + */ + acceptsCharsets(): string[]; + acceptsCharsets(charset: string): string | false; + acceptsCharsets(charset: string[]): string | false; + acceptsCharsets(...charset: string[]): string | false; + + /** + * Returns the first accepted encoding of the specified encodings, + * based on the request's Accept-Encoding HTTP header field. + * If none of the specified encodings is accepted, returns false. + * + * For more information, or if you have issues or concerns, see accepts. + */ + acceptsEncodings(): string[]; + acceptsEncodings(encoding: string): string | false; + acceptsEncodings(encoding: string[]): string | false; + acceptsEncodings(...encoding: string[]): string | false; + + /** + * Returns the first accepted language of the specified languages, + * based on the request's Accept-Language HTTP header field. + * If none of the specified languages is accepted, returns false. + * + * For more information, or if you have issues or concerns, see accepts. + */ + acceptsLanguages(): string[]; + acceptsLanguages(lang: string): string | false; + acceptsLanguages(lang: string[]): string | false; + acceptsLanguages(...lang: string[]): string | false; + + /** + * Parse Range header field, capping to the given `size`. + * + * Unspecified ranges such as "0-" require knowledge of your resource length. In + * the case of a byte range this is of course the total number of bytes. + * If the Range header field is not given `undefined` is returned. + * If the Range header field is given, return value is a result of range-parser. + * See more ./types/range-parser/index.d.ts + * + * NOTE: remember that ranges are inclusive, so for example "Range: users=0-3" + * should respond with 4 users when available, not 3. + */ + range(size: number, options?: RangeParserOptions): RangeParserRanges | RangeParserResult | undefined; + + /** + * Return an array of Accepted media types + * ordered from highest quality to lowest. + */ + accepted: MediaType[]; + + /** + * @deprecated since 4.11 Use either req.params, req.body or req.query, as applicable. + * + * Return the value of param `name` when present or `defaultValue`. + * + * - Checks route placeholders, ex: _/user/:id_ + * - Checks body params, ex: id=12, {"id":12} + * - Checks query string params, ex: ?id=12 + * + * To utilize request bodies, `req.body` + * should be an object. This can be done by using + * the `connect.bodyParser()` middleware. + */ + param(name: string, defaultValue?: any): string; + + /** + * Check if the incoming request contains the "Content-Type" + * header field, and it contains the give mime `type`. + * + * Examples: + * + * // With Content-Type: text/html; charset=utf-8 + * req.is('html'); + * req.is('text/html'); + * req.is('text/*'); + * // => true + * + * // When Content-Type is application/json + * req.is('json'); + * req.is('application/json'); + * req.is('application/*'); + * // => true + * + * req.is('html'); + * // => false + */ + is(type: string | string[]): string | false | null; + + /** + * Return the protocol string "http" or "https" + * when requested with TLS. When the "trust proxy" + * setting is enabled the "X-Forwarded-Proto" header + * field will be trusted. If you're running behind + * a reverse proxy that supplies https for you this + * may be enabled. + */ + readonly protocol: string; + + /** + * Short-hand for: + * + * req.protocol == 'https' + */ + readonly secure: boolean; + + /** + * Return the remote address, or when + * "trust proxy" is `true` return + * the upstream addr. + * + * Value may be undefined if the `req.socket` is destroyed + * (for example, if the client disconnected). + */ + readonly ip: string | undefined; + + /** + * When "trust proxy" is `true`, parse + * the "X-Forwarded-For" ip address list. + * + * For example if the value were "client, proxy1, proxy2" + * you would receive the array `["client", "proxy1", "proxy2"]` + * where "proxy2" is the furthest down-stream. + */ + readonly ips: string[]; + + /** + * Return subdomains as an array. + * + * Subdomains are the dot-separated parts of the host before the main domain of + * the app. By default, the domain of the app is assumed to be the last two + * parts of the host. This can be changed by setting "subdomain offset". + * + * For example, if the domain is "tobi.ferrets.example.com": + * If "subdomain offset" is not set, req.subdomains is `["ferrets", "tobi"]`. + * If "subdomain offset" is 3, req.subdomains is `["tobi"]`. + */ + readonly subdomains: string[]; + + /** + * Short-hand for `url.parse(req.url).pathname`. + */ + readonly path: string; + + /** + * Parse the "Host" header field hostname. + */ + readonly hostname: string; + + /** + * @deprecated Use hostname instead. + */ + readonly host: string; + + /** + * Check if the request is fresh, aka + * Last-Modified and/or the ETag + * still match. + */ + readonly fresh: boolean; + + /** + * Check if the request is stale, aka + * "Last-Modified" and / or the "ETag" for the + * resource has changed. + */ + readonly stale: boolean; + + /** + * Check if the request was an _XMLHttpRequest_. + */ + readonly xhr: boolean; + + // body: { username: string; password: string; remember: boolean; title: string; }; + body: ReqBody; + + // cookies: { string; remember: boolean; }; + cookies: any; + + method: string; + + params: P; + + query: ReqQuery; + + route: any; + + signedCookies: any; + + originalUrl: string; + + url: string; + + baseUrl: string; + + app: Application; + + /** + * After middleware.init executed, Request will contain res and next properties + * See: express/lib/middleware/init.js + */ + res?: Response | undefined; + next?: NextFunction | undefined; +} + +export interface MediaType { + value: string; + quality: number; + type: string; + subtype: string; +} + +export type Send> = (body?: ResBody) => T; + +export interface SendFileOptions extends SendOptions { + /** Object containing HTTP headers to serve with the file. */ + headers?: Record; +} + +export interface DownloadOptions extends SendOptions { + /** Object containing HTTP headers to serve with the file. The header `Content-Disposition` will be overridden by the filename argument. */ + headers?: Record; +} + +export interface Response< + ResBody = any, + LocalsObj extends Record = Record, + StatusCode extends number = number, +> extends http.ServerResponse, Express.Response { + /** + * Set status `code`. + */ + status(code: StatusCode): this; + + /** + * Set the response HTTP status code to `statusCode` and send its string representation as the response body. + * @link http://expressjs.com/4x/api.html#res.sendStatus + * + * Examples: + * + * res.sendStatus(200); // equivalent to res.status(200).send('OK') + * res.sendStatus(403); // equivalent to res.status(403).send('Forbidden') + * res.sendStatus(404); // equivalent to res.status(404).send('Not Found') + * res.sendStatus(500); // equivalent to res.status(500).send('Internal Server Error') + */ + sendStatus(code: StatusCode): this; + + /** + * Set Link header field with the given `links`. + * + * Examples: + * + * res.links({ + * next: 'http://api.example.com/users?page=2', + * last: 'http://api.example.com/users?page=5' + * }); + */ + links(links: any): this; + + /** + * Send a response. + * + * Examples: + * + * res.send(new Buffer('wahoo')); + * res.send({ some: 'json' }); + * res.send('

some html

'); + * res.status(404).send('Sorry, cant find that'); + */ + send: Send; + + /** + * Send JSON response. + * + * Examples: + * + * res.json(null); + * res.json({ user: 'tj' }); + * res.status(500).json('oh noes!'); + * res.status(404).json('I dont have that'); + */ + json: Send; + + /** + * Send JSON response with JSONP callback support. + * + * Examples: + * + * res.jsonp(null); + * res.jsonp({ user: 'tj' }); + * res.status(500).jsonp('oh noes!'); + * res.status(404).jsonp('I dont have that'); + */ + jsonp: Send; + + /** + * Transfer the file at the given `path`. + * + * Automatically sets the _Content-Type_ response header field. + * The callback `fn(err)` is invoked when the transfer is complete + * or when an error occurs. Be sure to check `res.headersSent` + * if you wish to attempt responding, as the header and some data + * may have already been transferred. + * + * Options: + * + * - `maxAge` defaulting to 0 (can be string converted by `ms`) + * - `root` root directory for relative filenames + * - `headers` object of headers to serve with file + * - `dotfiles` serve dotfiles, defaulting to false; can be `"allow"` to send them + * + * Other options are passed along to `send`. + * + * Examples: + * + * The following example illustrates how `res.sendFile()` may + * be used as an alternative for the `static()` middleware for + * dynamic situations. The code backing `res.sendFile()` is actually + * the same code, so HTTP cache support etc is identical. + * + * app.get('/user/:uid/photos/:file', function(req, res){ + * var uid = req.params.uid + * , file = req.params.file; + * + * req.user.mayViewFilesFrom(uid, function(yes){ + * if (yes) { + * res.sendFile('/uploads/' + uid + '/' + file); + * } else { + * res.send(403, 'Sorry! you cant see that.'); + * } + * }); + * }); + * + * @api public + */ + sendFile(path: string, fn?: Errback): void; + sendFile(path: string, options: SendFileOptions, fn?: Errback): void; + + /** + * @deprecated Use sendFile instead. + */ + sendfile(path: string): void; + /** + * @deprecated Use sendFile instead. + */ + sendfile(path: string, options: SendFileOptions): void; + /** + * @deprecated Use sendFile instead. + */ + sendfile(path: string, fn: Errback): void; + /** + * @deprecated Use sendFile instead. + */ + sendfile(path: string, options: SendFileOptions, fn: Errback): void; + + /** + * Transfer the file at the given `path` as an attachment. + * + * Optionally providing an alternate attachment `filename`, + * and optional callback `fn(err)`. The callback is invoked + * when the data transfer is complete, or when an error has + * ocurred. Be sure to check `res.headersSent` if you plan to respond. + * + * The optional options argument passes through to the underlying + * res.sendFile() call, and takes the exact same parameters. + * + * This method uses `res.sendfile()`. + */ + download(path: string, fn?: Errback): void; + download(path: string, filename: string, fn?: Errback): void; + download(path: string, filename: string, options: DownloadOptions, fn?: Errback): void; + + /** + * Set _Content-Type_ response header with `type` through `mime.lookup()` + * when it does not contain "/", or set the Content-Type to `type` otherwise. + * + * Examples: + * + * res.type('.html'); + * res.type('html'); + * res.type('json'); + * res.type('application/json'); + * res.type('png'); + */ + contentType(type: string): this; + + /** + * Set _Content-Type_ response header with `type` through `mime.lookup()` + * when it does not contain "/", or set the Content-Type to `type` otherwise. + * + * Examples: + * + * res.type('.html'); + * res.type('html'); + * res.type('json'); + * res.type('application/json'); + * res.type('png'); + */ + type(type: string): this; + + /** + * Respond to the Acceptable formats using an `obj` + * of mime-type callbacks. + * + * This method uses `req.accepted`, an array of + * acceptable types ordered by their quality values. + * When "Accept" is not present the _first_ callback + * is invoked, otherwise the first match is used. When + * no match is performed the server responds with + * 406 "Not Acceptable". + * + * Content-Type is set for you, however if you choose + * you may alter this within the callback using `res.type()` + * or `res.set('Content-Type', ...)`. + * + * res.format({ + * 'text/plain': function(){ + * res.send('hey'); + * }, + * + * 'text/html': function(){ + * res.send('

hey

'); + * }, + * + * 'appliation/json': function(){ + * res.send({ message: 'hey' }); + * } + * }); + * + * In addition to canonicalized MIME types you may + * also use extnames mapped to these types: + * + * res.format({ + * text: function(){ + * res.send('hey'); + * }, + * + * html: function(){ + * res.send('

hey

'); + * }, + * + * json: function(){ + * res.send({ message: 'hey' }); + * } + * }); + * + * By default Express passes an `Error` + * with a `.status` of 406 to `next(err)` + * if a match is not made. If you provide + * a `.default` callback it will be invoked + * instead. + */ + format(obj: any): this; + + /** + * Set _Content-Disposition_ header to _attachment_ with optional `filename`. + */ + attachment(filename?: string): this; + + /** + * Set header `field` to `val`, or pass + * an object of header fields. + * + * Examples: + * + * res.set('Foo', ['bar', 'baz']); + * res.set('Accept', 'application/json'); + * res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' }); + * + * Aliased as `res.header()`. + */ + set(field: any): this; + set(field: string, value?: string | string[]): this; + + header(field: any): this; + header(field: string, value?: string | string[]): this; + + // Property indicating if HTTP headers has been sent for the response. + headersSent: boolean; + + /** Get value for header `field`. */ + get(field: string): string | undefined; + + /** Clear cookie `name`. */ + clearCookie(name: string, options?: CookieOptions): this; + + /** + * Set cookie `name` to `val`, with the given `options`. + * + * Options: + * + * - `maxAge` max-age in milliseconds, converted to `expires` + * - `signed` sign the cookie + * - `path` defaults to "/" + * + * Examples: + * + * // "Remember Me" for 15 minutes + * res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true }); + * + * // save as above + * res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true }) + */ + cookie(name: string, val: string, options: CookieOptions): this; + cookie(name: string, val: any, options: CookieOptions): this; + cookie(name: string, val: any): this; + + /** + * Set the location header to `url`. + * + * The given `url` can also be the name of a mapped url, for + * example by default express supports "back" which redirects + * to the _Referrer_ or _Referer_ headers or "/". + * + * Examples: + * + * res.location('/foo/bar').; + * res.location('http://example.com'); + * res.location('../login'); // /blog/post/1 -> /blog/login + * + * Mounting: + * + * When an application is mounted and `res.location()` + * is given a path that does _not_ lead with "/" it becomes + * relative to the mount-point. For example if the application + * is mounted at "/blog", the following would become "/blog/login". + * + * res.location('login'); + * + * While the leading slash would result in a location of "/login": + * + * res.location('/login'); + */ + location(url: string): this; + + /** + * Redirect to the given `url` with optional response `status` + * defaulting to 302. + * + * The resulting `url` is determined by `res.location()`, so + * it will play nicely with mounted apps, relative paths, + * `"back"` etc. + * + * Examples: + * + * res.redirect('back'); + * res.redirect('/foo/bar'); + * res.redirect('http://example.com'); + * res.redirect(301, 'http://example.com'); + * res.redirect('http://example.com', 301); + * res.redirect('../login'); // /blog/post/1 -> /blog/login + */ + redirect(url: string): void; + redirect(status: number, url: string): void; + /** @deprecated use res.redirect(status, url) instead */ + redirect(url: string, status: number): void; + + /** + * Render `view` with the given `options` and optional callback `fn`. + * When a callback function is given a response will _not_ be made + * automatically, otherwise a response of _200_ and _text/html_ is given. + * + * Options: + * + * - `cache` boolean hinting to the engine it should cache + * - `filename` filename of the view being rendered + */ + render(view: string, options?: object, callback?: (err: Error, html: string) => void): void; + render(view: string, callback?: (err: Error, html: string) => void): void; + + locals: LocalsObj & Locals; + + charset: string; + + /** + * Adds the field to the Vary response header, if it is not there already. + * Examples: + * + * res.vary('User-Agent').render('docs'); + */ + vary(field: string): this; + + app: Application; + + /** + * Appends the specified value to the HTTP response header field. + * If the header is not already set, it creates the header with the specified value. + * The value parameter can be a string or an array. + * + * Note: calling res.set() after res.append() will reset the previously-set header value. + * + * @since 4.11.0 + */ + append(field: string, value?: string[] | string): this; + + /** + * After middleware.init executed, Response will contain req property + * See: express/lib/middleware/init.js + */ + req: Request; +} + +export interface Handler extends RequestHandler {} + +export type RequestParamHandler = (req: Request, res: Response, next: NextFunction, value: any, name: string) => any; + +export type ApplicationRequestHandler = + & IRouterHandler + & IRouterMatcher + & ((...handlers: RequestHandlerParams[]) => T); + +export interface Application< + LocalsObj extends Record = Record, +> extends EventEmitter, IRouter, Express.Application { + /** + * Express instance itself is a request handler, which could be invoked without + * third argument. + */ + (req: Request | http.IncomingMessage, res: Response | http.ServerResponse): any; + + /** + * Initialize the server. + * + * - setup default configuration + * - setup default middleware + * - setup route reflection methods + */ + init(): void; + + /** + * Initialize application configuration. + */ + defaultConfiguration(): void; + + /** + * Register the given template engine callback `fn` + * as `ext`. + * + * By default will `require()` the engine based on the + * file extension. For example if you try to render + * a "foo.jade" file Express will invoke the following internally: + * + * app.engine('jade', require('jade').__express); + * + * For engines that do not provide `.__express` out of the box, + * or if you wish to "map" a different extension to the template engine + * you may use this method. For example mapping the EJS template engine to + * ".html" files: + * + * app.engine('html', require('ejs').renderFile); + * + * In this case EJS provides a `.renderFile()` method with + * the same signature that Express expects: `(path, options, callback)`, + * though note that it aliases this method as `ejs.__express` internally + * so if you're using ".ejs" extensions you dont need to do anything. + * + * Some template engines do not follow this convention, the + * [Consolidate.js](https://github.com/visionmedia/consolidate.js) + * library was created to map all of node's popular template + * engines to follow this convention, thus allowing them to + * work seamlessly within Express. + */ + engine( + ext: string, + fn: (path: string, options: object, callback: (e: any, rendered?: string) => void) => void, + ): this; + + /** + * Assign `setting` to `val`, or return `setting`'s value. + * + * app.set('foo', 'bar'); + * app.get('foo'); + * // => "bar" + * app.set('foo', ['bar', 'baz']); + * app.get('foo'); + * // => ["bar", "baz"] + * + * Mounted servers inherit their parent server's settings. + */ + set(setting: string, val: any): this; + get: ((name: string) => any) & IRouterMatcher; + + param(name: string | string[], handler: RequestParamHandler): this; + + /** + * Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param() + * + * @deprecated since version 4.11 + */ + param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this; + + /** + * Return the app's absolute pathname + * based on the parent(s) that have + * mounted it. + * + * For example if the application was + * mounted as "/admin", which itself + * was mounted as "/blog" then the + * return value would be "/blog/admin". + */ + path(): string; + + /** + * Check if `setting` is enabled (truthy). + * + * app.enabled('foo') + * // => false + * + * app.enable('foo') + * app.enabled('foo') + * // => true + */ + enabled(setting: string): boolean; + + /** + * Check if `setting` is disabled. + * + * app.disabled('foo') + * // => true + * + * app.enable('foo') + * app.disabled('foo') + * // => false + */ + disabled(setting: string): boolean; + + /** Enable `setting`. */ + enable(setting: string): this; + + /** Disable `setting`. */ + disable(setting: string): this; + + /** + * Render the given view `name` name with `options` + * and a callback accepting an error and the + * rendered template string. + * + * Example: + * + * app.render('email', { name: 'Tobi' }, function(err, html){ + * // ... + * }) + */ + render(name: string, options?: object, callback?: (err: Error, html: string) => void): void; + render(name: string, callback: (err: Error, html: string) => void): void; + + /** + * Listen for connections. + * + * A node `http.Server` is returned, with this + * application (which is a `Function`) as its + * callback. If you wish to create both an HTTP + * and HTTPS server you may do so with the "http" + * and "https" modules as shown here: + * + * var http = require('http') + * , https = require('https') + * , express = require('express') + * , app = express(); + * + * http.createServer(app).listen(80); + * https.createServer({ ... }, app).listen(443); + */ + listen(port: number, hostname: string, backlog: number, callback?: () => void): http.Server; + listen(port: number, hostname: string, callback?: () => void): http.Server; + listen(port: number, callback?: () => void): http.Server; + listen(callback?: () => void): http.Server; + listen(path: string, callback?: () => void): http.Server; + listen(handle: any, listeningListener?: () => void): http.Server; + + router: string; + + settings: any; + + resource: any; + + map: any; + + locals: LocalsObj & Locals; + + /** + * The app.routes object houses all of the routes defined mapped by the + * associated HTTP verb. This object may be used for introspection + * capabilities, for example Express uses this internally not only for + * routing but to provide default OPTIONS behaviour unless app.options() + * is used. Your application or framework may also remove routes by + * simply by removing them from this object. + */ + routes: any; + + /** + * Used to get all registered routes in Express Application + */ + _router: any; + + use: ApplicationRequestHandler; + + /** + * The mount event is fired on a sub-app, when it is mounted on a parent app. + * The parent app is passed to the callback function. + * + * NOTE: + * Sub-apps will: + * - Not inherit the value of settings that have a default value. You must set the value in the sub-app. + * - Inherit the value of settings with no default value. + */ + on: (event: "mount", callback: (parent: Application) => void) => this; + + /** + * The app.mountpath property contains one or more path patterns on which a sub-app was mounted. + */ + mountpath: string | string[]; +} + +export interface Express extends Application { + request: Request; + response: Response; +} diff --git a/node_modules/@types/express-serve-static-core/package.json b/node_modules/@types/express-serve-static-core/package.json new file mode 100644 index 0000000000000000000000000000000000000000..4933535da2aa040f5a4063d1dfad02da1cda93e5 --- /dev/null +++ b/node_modules/@types/express-serve-static-core/package.json @@ -0,0 +1,51 @@ +{ + "name": "@types/express-serve-static-core", + "version": "4.19.8", + "description": "TypeScript definitions for express-serve-static-core", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-serve-static-core", + "license": "MIT", + "contributors": [ + { + "name": "Boris Yankov", + "githubUsername": "borisyankov", + "url": "https://github.com/borisyankov" + }, + { + "name": "Satana Charuwichitratana", + "githubUsername": "micksatana", + "url": "https://github.com/micksatana" + }, + { + "name": "Jose Luis Leon", + "githubUsername": "JoseLion", + "url": "https://github.com/JoseLion" + }, + { + "name": "David Stephens", + "githubUsername": "dwrss", + "url": "https://github.com/dwrss" + }, + { + "name": "Shin Ando", + "githubUsername": "andoshin11", + "url": "https://github.com/andoshin11" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/express-serve-static-core" + }, + "scripts": {}, + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + }, + "peerDependencies": {}, + "typesPublisherContentHash": "239eaebf1ca974a76fca799db9b418767c926de37604da25b62ea51f1919676a", + "typeScriptVersion": "5.2" +} \ No newline at end of file diff --git a/node_modules/@types/express/LICENSE b/node_modules/@types/express/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9e841e7a26e4eb057b24511e7b92d42b257a80e5 --- /dev/null +++ b/node_modules/@types/express/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/express/README.md b/node_modules/@types/express/README.md new file mode 100644 index 0000000000000000000000000000000000000000..926f9a469a90ad99e8a9b1fcd9a71194ad71acc8 --- /dev/null +++ b/node_modules/@types/express/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/express` + +# Summary +This package contains type definitions for express (http://expressjs.com). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express/v4. + +### Additional Details + * Last updated: Mon, 27 Oct 2025 20:34:59 GMT + * Dependencies: [@types/body-parser](https://npmjs.com/package/@types/body-parser), [@types/express-serve-static-core](https://npmjs.com/package/@types/express-serve-static-core), [@types/qs](https://npmjs.com/package/@types/qs), [@types/serve-static](https://npmjs.com/package/@types/serve-static) + +# Credits +These definitions were written by [Boris Yankov](https://github.com/borisyankov), [Puneet Arora](https://github.com/puneetar), [Dylan Frankland](https://github.com/dfrankland), and [Sebastian Beltran](https://github.com/bjohansebas). diff --git a/node_modules/@types/express/index.d.ts b/node_modules/@types/express/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dc2934de94f5ed30e89895907fe8229def52ae80 --- /dev/null +++ b/node_modules/@types/express/index.d.ts @@ -0,0 +1,128 @@ +/* =================== USAGE =================== + + import express = require("express"); + var app = express(); + + =============================================== */ + +/// +/// + +import bodyParser = require("body-parser"); +import * as core from "express-serve-static-core"; +import * as qs from "qs"; +import serveStatic = require("serve-static"); + +/** + * Creates an Express application. The express() function is a top-level function exported by the express module. + */ +declare function e(): core.Express; + +declare namespace e { + /** + * This is a built-in middleware function in Express. It parses incoming requests with JSON payloads and is based on body-parser. + * @since 4.16.0 + */ + var json: typeof bodyParser.json; + + /** + * This is a built-in middleware function in Express. It parses incoming requests with Buffer payloads and is based on body-parser. + * @since 4.17.0 + */ + var raw: typeof bodyParser.raw; + + /** + * This is a built-in middleware function in Express. It parses incoming requests with text payloads and is based on body-parser. + * @since 4.17.0 + */ + var text: typeof bodyParser.text; + + /** + * These are the exposed prototypes. + */ + var application: Application; + var request: Request; + var response: Response; + + /** + * This is a built-in middleware function in Express. It serves static files and is based on serve-static. + */ + var static: serveStatic.RequestHandlerConstructor; + + /** + * This is a built-in middleware function in Express. It parses incoming requests with urlencoded payloads and is based on body-parser. + * @since 4.16.0 + */ + var urlencoded: typeof bodyParser.urlencoded; + + /** + * This is a built-in middleware function in Express. It parses incoming request query parameters. + */ + export function query(options: qs.IParseOptions | typeof qs.parse): Handler; + + export function Router(options?: RouterOptions): core.Router; + + interface RouterOptions { + /** + * Enable case sensitivity. + */ + caseSensitive?: boolean | undefined; + + /** + * Preserve the req.params values from the parent router. + * If the parent and the child have conflicting param names, the child’s value take precedence. + * + * @default false + * @since 4.5.0 + */ + mergeParams?: boolean | undefined; + + /** + * Enable strict routing. + */ + strict?: boolean | undefined; + } + + interface Application extends core.Application {} + interface CookieOptions extends core.CookieOptions {} + interface Errback extends core.Errback {} + interface ErrorRequestHandler< + P = core.ParamsDictionary, + ResBody = any, + ReqBody = any, + ReqQuery = core.Query, + Locals extends Record = Record, + > extends core.ErrorRequestHandler {} + interface Express extends core.Express {} + interface Handler extends core.Handler {} + interface IRoute extends core.IRoute {} + interface IRouter extends core.IRouter {} + interface IRouterHandler extends core.IRouterHandler {} + interface IRouterMatcher extends core.IRouterMatcher {} + interface MediaType extends core.MediaType {} + interface NextFunction extends core.NextFunction {} + interface Locals extends core.Locals {} + interface Request< + P = core.ParamsDictionary, + ResBody = any, + ReqBody = any, + ReqQuery = core.Query, + Locals extends Record = Record, + > extends core.Request {} + interface RequestHandler< + P = core.ParamsDictionary, + ResBody = any, + ReqBody = any, + ReqQuery = core.Query, + Locals extends Record = Record, + > extends core.RequestHandler {} + interface RequestParamHandler extends core.RequestParamHandler {} + interface Response< + ResBody = any, + Locals extends Record = Record, + > extends core.Response {} + interface Router extends core.Router {} + interface Send extends core.Send {} +} + +export = e; diff --git a/node_modules/@types/express/package.json b/node_modules/@types/express/package.json new file mode 100644 index 0000000000000000000000000000000000000000..9fc06fb04d90ece3ccf8ef260a13d00bf051be7d --- /dev/null +++ b/node_modules/@types/express/package.json @@ -0,0 +1,46 @@ +{ + "name": "@types/express", + "version": "4.17.25", + "description": "TypeScript definitions for express", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express", + "license": "MIT", + "contributors": [ + { + "name": "Boris Yankov", + "githubUsername": "borisyankov", + "url": "https://github.com/borisyankov" + }, + { + "name": "Puneet Arora", + "githubUsername": "puneetar", + "url": "https://github.com/puneetar" + }, + { + "name": "Dylan Frankland", + "githubUsername": "dfrankland", + "url": "https://github.com/dfrankland" + }, + { + "name": "Sebastian Beltran", + "githubUsername": "bjohansebas", + "url": "https://github.com/bjohansebas" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/express" + }, + "scripts": {}, + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "^1" + }, + "peerDependencies": {}, + "typesPublisherContentHash": "875cd41acf5e799aefe604cb91b2b033db9e38e44df52044870814402a054994", + "typeScriptVersion": "5.2" +} \ No newline at end of file diff --git a/node_modules/@types/http-errors/LICENSE b/node_modules/@types/http-errors/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9e841e7a26e4eb057b24511e7b92d42b257a80e5 --- /dev/null +++ b/node_modules/@types/http-errors/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/http-errors/README.md b/node_modules/@types/http-errors/README.md new file mode 100644 index 0000000000000000000000000000000000000000..dae07b4a25b1420c5417150f054e6f91080e5b7b --- /dev/null +++ b/node_modules/@types/http-errors/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/http-errors` + +# Summary +This package contains type definitions for http-errors (https://github.com/jshttp/http-errors). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/http-errors. + +### Additional Details + * Last updated: Sat, 07 Jun 2025 02:15:25 GMT + * Dependencies: none + +# Credits +These definitions were written by [Tanguy Krotoff](https://github.com/tkrotoff), [BendingBender](https://github.com/BendingBender), and [Sebastian Beltran](https://github.com/bjohansebas). diff --git a/node_modules/@types/http-errors/index.d.ts b/node_modules/@types/http-errors/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e7fb2a8da5861ac4c657b326c4b8e9af64d9ff73 --- /dev/null +++ b/node_modules/@types/http-errors/index.d.ts @@ -0,0 +1,77 @@ +export = createHttpError; + +declare const createHttpError: createHttpError.CreateHttpError & createHttpError.NamedConstructors & { + isHttpError: createHttpError.IsHttpError; +}; + +declare namespace createHttpError { + interface HttpError extends Error { + status: N; + statusCode: N; + expose: boolean; + headers?: { + [key: string]: string; + } | undefined; + [key: string]: any; + } + + type UnknownError = Error | string | { [key: string]: any }; + + interface HttpErrorConstructor { + (msg?: string): HttpError; + new(msg?: string): HttpError; + } + + interface CreateHttpError { + (arg: N, ...rest: UnknownError[]): HttpError; + (...rest: UnknownError[]): HttpError; + } + + type IsHttpError = (error: unknown) => error is HttpError; + + type NamedConstructors = + & { + HttpError: HttpErrorConstructor; + } + & Record<"BadRequest" | "400", HttpErrorConstructor<400>> + & Record<"Unauthorized" | "401", HttpErrorConstructor<401>> + & Record<"PaymentRequired" | "402", HttpErrorConstructor<402>> + & Record<"Forbidden" | "403", HttpErrorConstructor<403>> + & Record<"NotFound" | "404", HttpErrorConstructor<404>> + & Record<"MethodNotAllowed" | "405", HttpErrorConstructor<405>> + & Record<"NotAcceptable" | "406", HttpErrorConstructor<406>> + & Record<"ProxyAuthenticationRequired" | "407", HttpErrorConstructor<407>> + & Record<"RequestTimeout" | "408", HttpErrorConstructor<408>> + & Record<"Conflict" | "409", HttpErrorConstructor<409>> + & Record<"Gone" | "410", HttpErrorConstructor<410>> + & Record<"LengthRequired" | "411", HttpErrorConstructor<411>> + & Record<"PreconditionFailed" | "412", HttpErrorConstructor<412>> + & Record<"PayloadTooLarge" | "413", HttpErrorConstructor<413>> + & Record<"URITooLong" | "414", HttpErrorConstructor<414>> + & Record<"UnsupportedMediaType" | "415", HttpErrorConstructor<415>> + & Record<"RangeNotSatisfiable" | "416", HttpErrorConstructor<416>> + & Record<"ExpectationFailed" | "417", HttpErrorConstructor<417>> + & Record<"ImATeapot" | "418", HttpErrorConstructor<418>> + & Record<"MisdirectedRequest" | "421", HttpErrorConstructor<421>> + & Record<"UnprocessableEntity" | "422", HttpErrorConstructor<422>> + & Record<"Locked" | "423", HttpErrorConstructor<423>> + & Record<"FailedDependency" | "424", HttpErrorConstructor<424>> + & Record<"TooEarly" | "425", HttpErrorConstructor<425>> + & Record<"UpgradeRequired" | "426", HttpErrorConstructor<426>> + & Record<"PreconditionRequired" | "428", HttpErrorConstructor<428>> + & Record<"TooManyRequests" | "429", HttpErrorConstructor<429>> + & Record<"RequestHeaderFieldsTooLarge" | "431", HttpErrorConstructor<431>> + & Record<"UnavailableForLegalReasons" | "451", HttpErrorConstructor<451>> + & Record<"InternalServerError" | "500", HttpErrorConstructor<500>> + & Record<"NotImplemented" | "501", HttpErrorConstructor<501>> + & Record<"BadGateway" | "502", HttpErrorConstructor<502>> + & Record<"ServiceUnavailable" | "503", HttpErrorConstructor<503>> + & Record<"GatewayTimeout" | "504", HttpErrorConstructor<504>> + & Record<"HTTPVersionNotSupported" | "505", HttpErrorConstructor<505>> + & Record<"VariantAlsoNegotiates" | "506", HttpErrorConstructor<506>> + & Record<"InsufficientStorage" | "507", HttpErrorConstructor<507>> + & Record<"LoopDetected" | "508", HttpErrorConstructor<508>> + & Record<"BandwidthLimitExceeded" | "509", HttpErrorConstructor<509>> + & Record<"NotExtended" | "510", HttpErrorConstructor<510>> + & Record<"NetworkAuthenticationRequire" | "511", HttpErrorConstructor<511>>; +} diff --git a/node_modules/@types/http-errors/package.json b/node_modules/@types/http-errors/package.json new file mode 100644 index 0000000000000000000000000000000000000000..91d49cfc91cc061300e40da07d22c0e825bd7e06 --- /dev/null +++ b/node_modules/@types/http-errors/package.json @@ -0,0 +1,36 @@ +{ + "name": "@types/http-errors", + "version": "2.0.5", + "description": "TypeScript definitions for http-errors", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/http-errors", + "license": "MIT", + "contributors": [ + { + "name": "Tanguy Krotoff", + "githubUsername": "tkrotoff", + "url": "https://github.com/tkrotoff" + }, + { + "name": "BendingBender", + "githubUsername": "BendingBender", + "url": "https://github.com/BendingBender" + }, + { + "name": "Sebastian Beltran", + "githubUsername": "bjohansebas", + "url": "https://github.com/bjohansebas" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/http-errors" + }, + "scripts": {}, + "dependencies": {}, + "peerDependencies": {}, + "typesPublisherContentHash": "621b9125a6493a2fa928b9150e335cb57429fb00e3bc0257426f1173903f7a4a", + "typeScriptVersion": "5.1" +} \ No newline at end of file diff --git a/node_modules/@types/jsesc/LICENSE b/node_modules/@types/jsesc/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9e841e7a26e4eb057b24511e7b92d42b257a80e5 --- /dev/null +++ b/node_modules/@types/jsesc/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/jsesc/README.md b/node_modules/@types/jsesc/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6a7ab51fd7328eb39e1166b60470fc9383607dd6 --- /dev/null +++ b/node_modules/@types/jsesc/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/jsesc` + +# Summary +This package contains type definitions for jsesc (https://github.com/mathiasbynens/jsesc). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jsesc. + +### Additional Details + * Last updated: Wed, 20 May 2020 21:21:41 GMT + * Dependencies: none + * Global values: none + +# Credits +These definitions were written by [Bart van der Schoor](https://github.com/Bartvds), [Lyanbin](https://github.com/Lyanbin), and [Colin Reeder](https://github.com/vpzomtrrfrt). diff --git a/node_modules/@types/jsesc/index.d.ts b/node_modules/@types/jsesc/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..925a82579ff737f3f27a6c90a9ca10f8f06c3839 --- /dev/null +++ b/node_modules/@types/jsesc/index.d.ts @@ -0,0 +1,100 @@ +// Type definitions for jsesc 2.5.2 +// Project: https://github.com/mathiasbynens/jsesc +// Definitions by: Bart van der Schoor +// Lyanbin +// Colin Reeder +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + + +declare function jsesc(argument: any, opts?: jsesc.Opts): string; + +declare namespace jsesc { + var version: string; + + interface Opts { + /** + * The default value for the quotes option is 'single'. This means that any occurrences of ' in the input + * string are escaped as \', so that the output can be used in a string literal wrapped in single quotes. + */ + quotes?: 'single' | 'double' | 'backtick'; + + /** + * The default value for the numbers option is 'decimal'. This means that any numeric values are represented + * using decimal integer literals. Other valid options are binary, octal, and hexadecimal, which result in + * binary integer literals, octal integer literals, and hexadecimal integer literals, respectively. + */ + numbers?: 'binary' | 'octal' | 'decimal' | 'hexadecimal'; + + /** + * The wrap option takes a boolean value (true or false), and defaults to false (disabled). When enabled, the + * output is a valid JavaScript string literal wrapped in quotes. The type of quotes can be specified through + * the quotes setting. + */ + wrap?: boolean; + + /** + * The es6 option takes a boolean value (true or false), and defaults to false (disabled). When enabled, any + * astral Unicode symbols in the input are escaped using ECMAScript 6 Unicode code point escape sequences + * instead of using separate escape sequences for each surrogate half. If backwards compatibility with ES5 + * environments is a concern, don’t enable this setting. If the json setting is enabled, the value for the es6 + * setting is ignored (as if it was false). + */ + es6?: boolean; + + /** + * The escapeEverything option takes a boolean value (true or false), and defaults to false (disabled). When + * enabled, all the symbols in the output are escaped — even printable ASCII symbols. + */ + escapeEverything?: boolean; + + /** + * The minimal option takes a boolean value (true or false), and defaults to false (disabled). When enabled, + * only a limited set of symbols in the output are escaped: \0, \b, \t, \n, \f, \r, \\, \u2028, \u2029. + */ + minimal?: boolean; + + /** + * The isScriptContext option takes a boolean value (true or false), and defaults to false (disabled). When + * enabled, occurrences of or