About this project

qzjs provides an embeddable QuickJS-ng runtime with a Platform Abstraction Layer (PAL) for C applications. It runs a full ES2023 engine on its own internal thread with a libuv event loop, eliminating the need for host-side event-loop pumping. The runtime implements 21 WinterTC-compatible modules including fetch, console, crypto.subtle, ReadableStream, setTimeout, fs, URL, TextEncoder, and more. Key capabilities: - ES2023 support with fast startup (~4.82ms median after lazy WAMR init) and low memory footprint - libuv-native execution: qzjs owns an internal thread + libuv loop; host never touches JS directly - Streaming HTTP/TLS via mbedTLS with chunked transfer decoding and certificate verification - Native extensions for compression (miniz), crypto (mbedTLS), text codecs (UTF-8/Base64), and WebAssembly (WAMR default, wasm3 alternative) - Multi-context execution with soft suspend/resume to disk; Web Workers run as real parallel threads or isolated processes (default since multi-process M-P2 milestone) - Thread-safe host ↔ runtime messaging via JSON (qz_post_message / message_cb) and postMessage/onmessage on JS side - Standalone CLI executable for running WinterTC Web APIs directly (no Node.js APIs) - DAP step-debugger built into the library (enable with -DQZ_BUILD_DEBUGGER=ON) - Comprehensive test suite with GoogleTest, mock_libuv for deterministic offline tests, and labeled test categories (offline, network, benchmark, test262) Build system uses CMake with feature toggles (QZ_WITH_*) for optional extensions, build profiles (minimal/standard), and targets for tests, examples, and debugger. All dependencies (QuickJS-ng, libuv, mbedTLS, miniz, WAMR, wasm3) are built from source as git submodules under strict C99. The polyfill rebuild uses npm devDependencies (esbuild, urlpattern-polyfill, @ungap/structured-clone, web-streams-polyfill) but they are not shipped in binaries. Architecture: host application communicates with qz_t runtime via thread-safe JSON messaging. The runtime runs on its own thread with libuv loop, JSContext, and I/O bridge. By default (QZ_PROCESS_MODEL=ISOLATED), host and runtime are separate processes communicating via FlatBuffers-framed envelopes over a socketpair for crash isolation. Licensed MIT.