Repository navigation
v0.6.0: platform-neutral Node.js runtime with pluggable APEHost
The generated Node.js package no longer requires Node.js to run a binding.
Process launch, runtime-owned files and stream handling move behind an
APEHost, so another JavaScript environment (for example a browser running
the APE in a WebAssembly Linux guest) can drive the same generated binding.
Generated Node.js package layout:
- _runtime.js: platform-neutral; imports nothing. APEClient(host,
operations, runtime) and ProcessSession(host, child, argv, options) take
a host. The APEHost / APEChild contract is declared in _runtime.d.ts. - _operations.js (new): platform-neutral OPERATIONS, RUNTIME, BINARY_URL,
BINARY_SHA256 and createBinding(host), which returns the typed operation
functions bound to that host. - _host_node.js (new): NodeAPEHost, holding everything Node-specific
(child_process, fs, Windows exit-code normalization, WSL interop
guidance). - client.js: binds createBinding() to NodeAPEHost; createClient() now
returns that binding (its APEClient is binding.client).
Other changes:
- JSONL event files are read incrementally by byte offset instead of
re-reading the whole file on every poll. - Fix a race where a fast-exiting APE could lose unread stdout/stderr: the
Node host now waits for the child's 'close' event, not 'exit'. - Hosts set their own polling interval and a ready-timeout factor for
slower execution environments. - The Node generator records the bundled APE's SHA-256 so a host that
downloads the binary can verify it.
Breaking (generated Node.js API): APEClient and ProcessSession take a host
as their first argument, and createClient() returns the binding object.
Tests: the runtime and operations modules are checked to import nothing
platform-specific, and a binding is run end to end on a host whose
streams are WHATWG ReadableStreams.