MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

add types for all builtins

+402 -2
+1 -1
meson.build
··· 96 96 build_date = run_command('date', '+%Y-%m-%d', check: true).stdout().strip() 97 97 98 98 version_conf = configuration_data() 99 - version_conf.set('ANT_VERSION', '0.3.3.7') 99 + version_conf.set('ANT_VERSION', '0.3.3.8') 100 100 version_conf.set('ANT_GIT_HASH', git_hash) 101 101 version_conf.set('ANT_BUILD_DATE', build_date) 102 102
+22
src/types/ant.d.ts
··· 50 50 typeof(t: unknown): number; 51 51 } 52 52 53 + interface HttpContext { 54 + request: { 55 + method: string; 56 + url: string; 57 + path: string; 58 + query: string; 59 + body: string; 60 + headers: Record<string, string>; 61 + }; 62 + response: { 63 + status(code: number): HttpContext['response']; 64 + header(name: string, value: string): HttpContext['response']; 65 + send(body: string): void; 66 + json(data: unknown): void; 67 + redirect(url: string, status?: number): void; 68 + }; 69 + store: Record<string, unknown>; 70 + } 71 + 53 72 interface AntStatic { 54 73 version: string; 55 74 revision: string; ··· 61 80 gc(): AntGcResult; 62 81 alloc(): AntAllocResult; 63 82 stats(): AntStatsResult; 83 + 64 84 signal(signum: number, handler: (signum: number) => void): void; 65 85 sleep(seconds: number): void; 66 86 msleep(milliseconds: number): void; 67 87 usleep(microseconds: number): void; 88 + 89 + serve(port: number, handler?: (ctx: HttpContext) => void | Promise<void>): number; 68 90 } 69 91 70 92 declare const Ant: AntStatic;
+13
src/types/buffer.d.ts
··· 1 + interface BufferStatic { 2 + from(data: string | ArrayLike<number>): Uint8Array & BufferMethods; 3 + alloc(size: number): Uint8Array & BufferMethods; 4 + allocUnsafe(size: number): Uint8Array & BufferMethods; 5 + } 6 + 7 + interface BufferMethods { 8 + toString(encoding?: 'utf8' | 'base64' | 'hex'): string; 9 + toBase64(): string; 10 + write(string: string, offset?: number, length?: number): number; 11 + } 12 + 13 + declare const Buffer: BufferStatic;
+14
src/types/fetch.d.ts
··· 1 + interface FetchResponse { 2 + status: number; 3 + ok: boolean; 4 + body: string; 5 + json(): unknown; 6 + } 7 + 8 + interface FetchOptions { 9 + method?: string; 10 + headers?: Record<string, string>; 11 + body?: string; 12 + } 13 + 14 + declare function fetch(url: string, options?: FetchOptions): Promise<FetchResponse>;
+16
src/types/index.d.ts
··· 1 + /// <reference path="ant.d.ts" /> 2 + /// <reference path="buffer.d.ts" /> 3 + /// <reference path="fetch.d.ts" /> 4 + /// <reference path="process.d.ts" /> 5 + /// <reference path="snapshot.d.ts" /> 6 + /// <reference path="timers.d.ts" /> 7 + /// <reference path="url.d.ts" /> 8 + 9 + /// <reference path="modules/fs.d.ts" /> 10 + /// <reference path="modules/path.d.ts" /> 11 + /// <reference path="modules/os.d.ts" /> 12 + /// <reference path="modules/child_process.d.ts" /> 13 + /// <reference path="modules/crypto.d.ts" /> 14 + /// <reference path="modules/events.d.ts" /> 15 + /// <reference path="modules/ffi.d.ts" /> 16 + /// <reference path="modules/shell.d.ts" />
+50
src/types/modules/child_process.d.ts
··· 1 + declare module 'child_process' { 2 + interface SpawnResult { 3 + stdout: string; 4 + stderr: string; 5 + exitCode: number; 6 + signalCode: number | null; 7 + pid: number; 8 + } 9 + 10 + interface ChildProcess { 11 + stdout: string; 12 + stderr: string; 13 + exitCode: number | null; 14 + signalCode: number | null; 15 + pid: number; 16 + killed: boolean; 17 + on(event: 'exit', listener: (code: number, signal: number | null) => void): ChildProcess; 18 + on(event: 'close', listener: (code: number, signal: number | null) => void): ChildProcess; 19 + on(event: 'error', listener: (err: Error) => void): ChildProcess; 20 + on(event: 'data', listener: (data: string) => void): ChildProcess; 21 + once(event: string, listener: (...args: unknown[]) => void): ChildProcess; 22 + kill(signal?: number): boolean; 23 + write(data: string): void; 24 + end(): void; 25 + } 26 + 27 + interface SpawnOptions { 28 + cwd?: string; 29 + shell?: boolean; 30 + detached?: boolean; 31 + } 32 + 33 + interface ExecOptions { 34 + cwd?: string; 35 + } 36 + 37 + interface SpawnSyncOptions { 38 + input?: string; 39 + } 40 + 41 + interface ForkOptions { 42 + execArgv?: string[]; 43 + } 44 + 45 + function spawn(command: string, args?: string[], options?: SpawnOptions): ChildProcess & Promise<SpawnResult>; 46 + function exec(command: string, options?: ExecOptions): Promise<SpawnResult>; 47 + function execSync(command: string): string; 48 + function spawnSync(command: string, args?: string[], options?: SpawnSyncOptions): SpawnResult; 49 + function fork(modulePath: string, options?: ForkOptions): ChildProcess & Promise<SpawnResult>; 50 + }
+15
src/types/modules/crypto.d.ts
··· 1 + declare module 'crypto' { 2 + interface WebCrypto { 3 + random(): number; 4 + randomBytes(length: number): number[]; 5 + randomUUID(): string; 6 + randomUUIDv7(): string; 7 + getRandomValues<T extends ArrayBufferView>(array: T): T; 8 + } 9 + 10 + const webcrypto: WebCrypto; 11 + 12 + function randomBytes(length: number): number[]; 13 + function randomUUID(): string; 14 + function getRandomValues<T extends ArrayBufferView>(array: T): T; 15 + }
+13
src/types/modules/events.d.ts
··· 1 + declare module 'events' { 2 + class EventEmitter { 3 + on(event: string, listener: (...args: unknown[]) => void): this; 4 + addListener(event: string, listener: (...args: unknown[]) => void): this; 5 + once(event: string, listener: (...args: unknown[]) => void): this; 6 + off(event: string, listener: (...args: unknown[]) => void): this; 7 + removeListener(event: string, listener: (...args: unknown[]) => void): this; 8 + emit(event: string, ...args: unknown[]): boolean; 9 + removeAllListeners(event?: string): this; 10 + listenerCount(event: string): number; 11 + eventNames(): string[]; 12 + } 13 + }
+55
src/types/modules/ffi.d.ts
··· 1 + declare module 'ffi' { 2 + type FFIType = 3 + | 'void' 4 + | 'int8' 5 + | 'int16' 6 + | 'int' 7 + | 'int64' 8 + | 'uint8' 9 + | 'uint16' 10 + | 'uint64' 11 + | 'float' 12 + | 'double' 13 + | 'pointer' 14 + | 'string' 15 + | '...'; 16 + 17 + interface FFITypeConstants { 18 + void: 'void'; 19 + int8: 'int8'; 20 + int16: 'int16'; 21 + int: 'int'; 22 + int64: 'int64'; 23 + uint8: 'uint8'; 24 + uint16: 'uint16'; 25 + uint64: 'uint64'; 26 + float: 'float'; 27 + double: 'double'; 28 + pointer: 'pointer'; 29 + string: 'string'; 30 + spread: '...'; 31 + } 32 + 33 + interface FunctionSignature { 34 + returns: FFIType; 35 + args: FFIType[]; 36 + } 37 + 38 + interface FFILibrary { 39 + define(name: string, signature: FunctionSignature | [FFIType, FFIType[]]): (...args: unknown[]) => unknown; 40 + call(name: string, ...args: unknown[]): unknown; 41 + } 42 + 43 + const suffix: 'dylib' | 'so' | 'dll'; 44 + const FFIType: FFITypeConstants; 45 + 46 + function dlopen(libraryPath: string): FFILibrary; 47 + function alloc(size: number): number; 48 + function free(ptr: number): void; 49 + function read(ptr: number, size: number, type?: FFIType): unknown; 50 + function write(ptr: number, value: unknown, type?: FFIType): void; 51 + function pointer(value: unknown): number; 52 + function callback(signature: FunctionSignature | [FFIType, FFIType[]], fn: (...args: unknown[]) => unknown): number; 53 + function freeCallback(ptr: number): void; 54 + function readPtr(ptr: number): number; 55 + }
+30
src/types/modules/fs.d.ts
··· 1 + declare module 'fs' { 2 + interface Stats { 3 + size: number; 4 + mode: number; 5 + isFile(): boolean; 6 + isDirectory(): boolean; 7 + } 8 + 9 + function readFile(path: string): Promise<string>; 10 + function readFileSync(path: string): string; 11 + function stream(path: string): Promise<string>; 12 + function open(path: string): string; 13 + function writeFile(path: string, data: string): Promise<void>; 14 + function writeFileSync(path: string, data: string): void; 15 + function appendFileSync(path: string, data: string): void; 16 + function copyFileSync(src: string, dest: string): void; 17 + function renameSync(oldPath: string, newPath: string): void; 18 + function unlink(path: string): Promise<void>; 19 + function unlinkSync(path: string): void; 20 + function mkdir(path: string, options?: { recursive?: boolean }): Promise<void>; 21 + function mkdirSync(path: string, options?: { recursive?: boolean }): void; 22 + function rmdir(path: string): Promise<void>; 23 + function rmdirSync(path: string): void; 24 + function stat(path: string): Promise<Stats>; 25 + function statSync(path: string): Stats; 26 + function exists(path: string): Promise<boolean>; 27 + function existsSync(path: string): boolean; 28 + function readdir(path: string): Promise<string[]>; 29 + function readdirSync(path: string): string[]; 30 + }
+108
src/types/modules/os.d.ts
··· 1 + declare module 'os' { 2 + interface CpuInfo { 3 + model: string; 4 + speed: number; 5 + times: { 6 + user: number; 7 + nice: number; 8 + sys: number; 9 + idle: number; 10 + irq: number; 11 + }; 12 + } 13 + 14 + interface NetworkInterfaceInfo { 15 + address: string; 16 + netmask: string; 17 + family: 'IPv4' | 'IPv6'; 18 + mac: string; 19 + internal: boolean; 20 + cidr: string | null; 21 + } 22 + 23 + interface UserInfo { 24 + username: string; 25 + uid: number; 26 + gid: number; 27 + shell: string; 28 + homedir: string; 29 + } 30 + 31 + interface OsConstants { 32 + signals: { 33 + SIGHUP?: number; 34 + SIGINT?: number; 35 + SIGQUIT?: number; 36 + SIGILL?: number; 37 + SIGTRAP?: number; 38 + SIGABRT?: number; 39 + SIGIOT?: number; 40 + SIGBUS?: number; 41 + SIGFPE?: number; 42 + SIGKILL?: number; 43 + SIGUSR1?: number; 44 + SIGUSR2?: number; 45 + SIGSEGV?: number; 46 + SIGPIPE?: number; 47 + SIGALRM?: number; 48 + SIGTERM?: number; 49 + SIGCHLD?: number; 50 + SIGCONT?: number; 51 + SIGSTOP?: number; 52 + SIGTSTP?: number; 53 + SIGTTIN?: number; 54 + SIGTTOU?: number; 55 + SIGURG?: number; 56 + SIGXCPU?: number; 57 + SIGXFSZ?: number; 58 + SIGVTALRM?: number; 59 + SIGPROF?: number; 60 + SIGWINCH?: number; 61 + SIGIO?: number; 62 + SIGSYS?: number; 63 + }; 64 + errno: Record<string, number>; 65 + priority: { 66 + PRIORITY_LOW: number; 67 + PRIORITY_BELOW_NORMAL: number; 68 + PRIORITY_NORMAL: number; 69 + PRIORITY_ABOVE_NORMAL: number; 70 + PRIORITY_HIGH: number; 71 + PRIORITY_HIGHEST: number; 72 + }; 73 + dlopen: { 74 + RTLD_LAZY?: number; 75 + RTLD_NOW?: number; 76 + RTLD_GLOBAL?: number; 77 + RTLD_LOCAL?: number; 78 + RTLD_DEEPBIND?: number; 79 + }; 80 + UV_UDP_REUSEADDR: number; 81 + } 82 + 83 + const EOL: string; 84 + const devNull: string; 85 + const constants: OsConstants; 86 + 87 + function arch(): string; 88 + function platform(): string; 89 + function type(): string; 90 + function release(): string; 91 + function version(): string; 92 + function machine(): string; 93 + function hostname(): string; 94 + function homedir(): string; 95 + function tmpdir(): string; 96 + function endianness(): 'BE' | 'LE'; 97 + function uptime(): number; 98 + function totalmem(): number; 99 + function freemem(): number; 100 + function availableParallelism(): number; 101 + function cpus(): CpuInfo[]; 102 + function loadavg(): [number, number, number]; 103 + function networkInterfaces(): Record<string, NetworkInterfaceInfo[]>; 104 + function userInfo(): UserInfo; 105 + function getPriority(pid?: number): number; 106 + function setPriority(priority: number): void; 107 + function setPriority(pid: number, priority: number): void; 108 + }
+23
src/types/modules/path.d.ts
··· 1 + declare module 'path' { 2 + interface ParsedPath { 3 + root: string; 4 + dir: string; 5 + base: string; 6 + ext: string; 7 + name: string; 8 + } 9 + 10 + const sep: string; 11 + const delimiter: string; 12 + 13 + function basename(path: string, ext?: string): string; 14 + function dirname(path: string): string; 15 + function extname(path: string): string; 16 + function join(...paths: string[]): string; 17 + function normalize(path: string): string; 18 + function resolve(...paths: string[]): string; 19 + function relative(from: string, to: string): string; 20 + function isAbsolute(path: string): boolean; 21 + function parse(path: string): ParsedPath; 22 + function format(pathObject: Partial<ParsedPath>): string; 23 + }
+12
src/types/modules/shell.d.ts
··· 1 + declare module 'shell' { 2 + interface ShellResult { 3 + stdout: string; 4 + stderr: string; 5 + exitCode: number; 6 + text(): string; 7 + lines(): string[]; 8 + } 9 + 10 + function $(strings: TemplateStringsArray, ...values: unknown[]): ShellResult; 11 + function $(command: string): ShellResult; 12 + }
+15
src/types/process.d.ts
··· 1 + type ProcessEnv = { 2 + [key: string]: string | undefined; 3 + } & { toObject(): Record<string, string> }; 4 + 5 + interface Process { 6 + env: ProcessEnv; 7 + argv: string[]; 8 + pid: number; 9 + platform: string; 10 + arch: string; 11 + exit(code?: number): never; 12 + cwd(): string; 13 + } 14 + 15 + declare const process: Process;
+7
src/types/timers.d.ts
··· 1 + declare function setTimeout(callback: () => void, delay: number): number; 2 + declare function clearTimeout(timerId: number): void; 3 + declare function setInterval(callback: () => void, delay: number): number; 4 + declare function clearInterval(timerId: number): void; 5 + declare function setImmediate(callback: () => void): number; 6 + declare function clearImmediate(immediateId: number): void; 7 + declare function queueMicrotask(callback: () => void): void;
+6
src/types/url.d.ts
··· 1 + declare function encodeURI(uri: string): string; 2 + declare function encodeURIComponent(component: string): string; 3 + declare function decodeURI(uri: string): string; 4 + declare function decodeURIComponent(component: string): string; 5 + declare function escape(str: string): string; 6 + declare function unescape(str: string): string;
+2 -1
tsconfig.json
··· 2 2 "compilerOptions": { 3 3 "noEmit": true, 4 4 "strict": true, 5 + "noUnusedLocals": false, 5 6 6 7 "target": "ES2024", 7 8 "module": "ESNext", ··· 9 10 "lib": ["ES2024", "DOM", "DOM.Iterable"], 10 11 "typeRoots": ["./node_modules/@types", "./src/types"] 11 12 }, 12 - "include": ["src/types/**/*.d.ts", "src/core/**/*"] 13 + "include": ["src/types/**/*.d.ts", "src/core/**/*", "examples/**/*"] 13 14 }