Skip to content

Codebase quality improvements + more node api compt#29

Merged
cs01 merged 3 commits intomainfrom
be-improvements
Feb 22, 2026
Merged

Codebase quality improvements + more node api compt#29
cs01 merged 3 commits intomainfrom
be-improvements

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Feb 22, 2026

Summary

Large feature branch adding Node.js API compatibility, async I/O, and HTTP server improvements. 100 files changed, ~7800 lines added across 6 commits.

Interactive installer

  • install.sh rewritten with interactive y/n prompts, toolchain verification (llvm, clang, cmake), and automatic shell profile detection (~/.bashrc, ~/.zshrc, etc.)

HTTP server (picohttpparser + lws-bridge rewrite)

  • Replaced mongoose with lws-bridge.c backed by libuv for HTTP/WebSocket serving
  • Integrated picohttpparser for fast HTTP request parsing
  • Added benchmark suite (bench/) for HTTP and WebSocket throughput vs Node, Bun, Go, and C

Node.js API compatibility

Major push to match Node.js standard library surface area:

child_process module (sync + async)

  • child_process.execSync(cmd) — popen-based, returns stdout string
  • child_process.spawnSync(cmd, args?) — fork/exec with separate stdout/stderr pipes
  • child_process.exec(cmd) — async via uv_queue_work, returns Promise<{stdout, stderr, status}>
  • child_process.spawn(cmd, args?, onStdout, onStderr, onExit) — streaming callbacks via uv_spawn
  • C bridge split into sync (child-process-bridge.c, always linked) and async (child-process-spawn.c, conditionally linked with libuv)

Async filesystem

  • fs.readFile(path) and fs.writeFile(path, data) returning Promises via uv_queue_work
  • New AsyncFsGenerator with shared %FsWorkContext struct for all async fs/cp operations

Promise improvements

  • Promise.allSettled(), Promise.any(), Promise.finally()
  • New PromiseGenerator and extracted promise-handlers.ts sub-module

Path module expansion

  • path.extname(), path.isAbsolute(), path.normalize(), path.parse(), path.relative()

Date module

  • new Date() constructor, Date.now(), instance methods (.getTime(), .toISOString(), .toLocaleDateString(), etc.)

Math module expansion

  • Math.random(), Math.sign(), Math.trunc(), trig functions (sin, cos, tan, asin, acos, atan, atan2)

Crypto module

  • crypto.randomUUID() via OpenSSL's RAND_bytes

Console

  • console.time() / console.timeEnd() / console.timeLog() via uv_hrtime
  • Extracted to console-timers.ts sub-module

Array methods

  • findIndex(), indexOf(), reverse(), shift(), unshift(), sort(), splice()
  • Extracted into sub-modules: array/reorder.ts, array/search.ts, array/sort.ts, array/splice.ts

String methods

  • padEnd()

Set methods

  • Set.delete(), Set.clear(), Set.forEach()

fs module

  • fs.copyFileSync(), fs.renameSync()

CI fixes

  • Added child-process-bridge.o and child-process-spawn.o to release artifact packaging and vendor verification in all 3 build jobs (linux-musl, linux-glibc, macos)
  • Removed duplicate self-hosting test step in glibc job

Architecture

  • Extracted method-calls sub-modules: console.ts, promise-handlers.ts, string-methods.ts
  • Extracted array sub-modules: reorder.ts, search.ts, sort.ts, splice.ts
  • New standalone generators: async-fs.ts, child-process.ts, console-timers.ts, date.ts, promise.ts

Test plan

  • 339 unit tests pass (all existing + ~30 new fixture tests covering every new API)
  • Self-hosting verification passes (Stage 0 + Stage 1)
  • New test fixtures: cp-execsync, cp-bare-execsync, cp-spawnsync, cp-spawnsync-shell, cp-exec-async, cp-spawn, fs-readfile-async, fs-writefile-async, fs-copyfile, fs-rename, promise-allsettled, promise-any, promise-finally, date-instance, crypto-uuid, console-time, path-extname, path-isabsolute, path-normalize, path-parse, path-relative, math-random, math-sign, math-trig, math-trunc, array-findindex, array-indexof, array-reverse, array-shift-unshift, array-sort, array-splice, set-delete, string-padend

@cs01 cs01 changed the title Codebase quality improvements Codebase quality improvements + more node api compt Feb 22, 2026
@cs01 cs01 merged commit 020f81c into main Feb 22, 2026
14 checks passed
@cs01 cs01 deleted the be-improvements branch February 22, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant