Node.js backend compatibility layer for moonbitlang/async in MoonBit, with native delegation and JS FFI implementations for process, fs, http, gzip, tls, socket, raw_fd, signal, sync primitives, websocket, stdio, pipe, and sys.
Dependencies
| Dependency | Version |
|---|---|
| moonbitlang/async | 0.20.5 |
| moonbitlang/x | 0.4.50 |
| moonbitlang/regexp | 0.3.5 |
| Package | Description |
|---|---|
| mizchi/x/process | Command execution (run, spawn, spawn_orphan, wait_pid, process pipes, file/stdio redirects, native pipe redirects, collect_output, collect_stdout, collect_stderr, collect_output_merged) |
| mizchi/x/fs | File system operations (open, create, File, read_file, write_file, tmpdir, walk, Watcher, exists, mkdir, readdir, opendir, Directory::next, rename, remove, rmdir) |
| mizchi/x/http | HTTP client/server (get, post, put, get_stream, post_stream, put_stream, Client, Server, Cookie) |
| mizchi/x/gzip | Gzip stream encoder/decoder (Encoder, Decoder) |
| mizchi/x/tls | TLS client/server streams (Tls::client, Tls::server_from_pair, peer certificate, channel binding, rand_bytes, sha1) |
| mizchi/x/socket | TCP/UDP sockets (Addr, Tcp, TcpServer, UdpClient, UdpServer) |
| mizchi/x/signal | Signal constants and global cancellation signal configuration (Signal, to_int, set_global_cancellation_signals) |
| mizchi/x/raw_fd | Raw file descriptor reads/writes (RawFd::read, RawFd::write, RawFd::close) |
| mizchi/x/aqueue | Async queue (Queue, Kind, put, get, try_put, try_get, close) |
| mizchi/x/cond_var | Async condition variable (Cond::wait, Cond::signal, Cond::broadcast) |
| mizchi/x/semaphore | Async semaphore (Semaphore::acquire, release, try_acquire) |
| mizchi/x/websocket | WebSocket client/server upgrade (connect, from_http_server, Conn::send_text, Conn::send_binary, Conn::recv, Conn::close) |
| mizchi/x/stdio | Standard I/O (stdin, stdout, stderr with @io.Reader/@io.Writer) |
| mizchi/x/pipe | In-memory pipes (pipe() → PipeRead/PipeWrite with @io.Reader/@io.Writer; native process redirect support) |
| mizchi/x/sys | Environment variables and CLI args (get_env_var, get_cli_args, exit) |
| mizchi/x/regexp | Regular expressions mirroring moonbitlang/regexp (compile, Regexp::execute, match_, group_by_name, group_count, group_names, MatchResult::matched/get/groups/results/before/after) |
| mizchi/x/json | JSON mirroring moonbitlang/core/json (parse, valid, stringify) over the builtin Json value type |
| mizchi/x/crypto | Hashes / HMAC / hex mirroring moonbitlang/x/crypto (md5, sha1, sha224, sha256, sm3, *_from_iter, hmac, MD5/SHA256/SM3 contexts, bytes_to_hex_string, uints_to_hex_string) |
| Package | native | js | wasm | wasm-gc |
|---|---|---|---|---|
| process | Yes | Yes | Yes* | stub |
| fs | Yes | Yes | Yes* | stub |
| http | Yes | Yes | Yes | stub |
| gzip | Yes | Yes | Yes | Yes |
| tls | Yes | Yes | Yes | stub |
| socket | TCP/UDP | TCP/UDP | TCP/UDP | stub |
| signal | Yes | constants/no-op | Yes | constants/no-op |
| raw_fd | Yes | Yes | stub | stub |
| aqueue | Yes | Yes | Yes | Yes |
| cond_var | Yes | Yes | Yes | Yes |
| semaphore | Yes | Yes | Yes | Yes |
| websocket | Yes | Yes | client | stub |
| stdio | Yes | Yes | Yes | stub |
| pipe | Yes | Yes | Yes | stub |
| sys | Yes | Yes | Yes | Yes* |
| regexp | Yes | Yes (FFI) | Yes | Yes |
| json | Yes | Yes (FFI) | Yes | Yes |
| crypto | Yes | Yes | Yes | Yes |
| Benchmark | mizchi/x (JS) | upstream (pure MoonBit) | Speedup |
|---|---|---|---|
| regexp execute (scan + match) | ~4.9 µs | ~167 µs | ~34× |
| regexp execute + capture | ~5.1 µs | ~181 µs | ~35× |
| regexp compile | ~0.95 µs | ~1.2 µs | ~1.3× |
| json valid | ~26 µs | ~73 µs | ~2.8× |
| json stringify | ~30 µs | ~66 µs | ~2.2× |
| json parse | ~67 µs | ~74 µs | ~on par |
| Upstream test | Status | Notes |
|---|---|---|
| http request | Covered | |
| https request | Covered | |
| passthrough mode | Covered | |
| passthrough mode remaining data | Covered | native |
| Parser/body/cookie/gzip/sender edge cases | Covered | http_upstream_test.mbt mirrors applicable upstream cases |
| request streaming | Covered | native and JS |
| Other 16 tests | Skip | Internal parser/sender/proxy tests |
| Upstream test | Status | Notes |
|---|---|---|
| one way | Covered | native and JS |
| echo | Covered | native and JS |
| `connect` accidental close | Covered | native and JS |
| `read` already closed | Covered | native and JS |
| client custom root certificate | Covered | native and JS |
| client custom root certificate rejects different root | Covered | native and JS |
| get_peer_certificate | Covered | native and JS |
| channel binding | Covered | native and JS |
| peer close connection | Covered | native and JS |
just # check + test
just fmt # format code
just check # type check
just test # run tests| Upstream test | Status | Notes |
|---|---|---|
| basic wait | Covered | |
| basic_ls | Covered | |
| collect_stdout | Covered | |
| collect_error | Covered | |
| collect_output | Covered | |
| collect_output blocked | Covered | |
| collect_output_merged | Covered | |
| wait exitcode | Covered | |
| set cwd | Covered | |
| set_env | Covered | |
| set_env no inherit | Covered | |
| wait_pid | Covered | |
| basic_cat | Covered | |
| cancel process | Covered | |
| cancel process hard | Covered | |
| cancel process timeout | Covered | |
| orphan process | Covered | |
| spawn_in_group wait | Covered | |
| spawn_in_group cancel | Covered | |
| Process::wait | Covered | |
| Process::try_wait | Covered | |
| Process:cancel | Covered | |
| merge stdout and stderr | Covered | |
| merge multiple | Covered | |
| redirect to file | Covered | |
| kill children on hard cancel | Skip | requires custom test program + Windows |
| do not kill orphan children on hard cancel | Covered | |
| windows command line arg escape | Skip | Windows-specific |
moon test --target js src/http --filter 'bench(js): graceful close time under concurrent sse'bench(js): sse_clients=24 graceful_close_ms=1507./scripts/k6/run_http_bench.shBASE_URL=http://127.0.0.1:18080 k6 run scripts/k6/http_ping.js
BASE_URL=http://127.0.0.1:18080 BODY_SIZE=16384 k6 run scripts/k6/http_consume.js
BASE_URL=http://127.0.0.1:18080 BODY_SIZE=16384 k6 run scripts/k6/http_discard.jsNode.js backend compatibility layer for moonbitlang/async in MoonBit, with native delegation and JS FFI implementations for process, fs, http, gzip, tls, socket, raw_fd, signal, sync primitives, websocket, stdio, pipe, and sys.
Dependencies