@vexil-lang/runtime
v0.5.2
Published
Runtime support for Vexil generated code — bit-level I/O and wire encoding primitives
Maintainers
Readme
@vexil-lang/runtime
The TypeScript wire runtime for code generated by
vexilc. It provides the bit reader, bit
writer, decoding limits, and handshake primitives used by generated TypeScript.
The package is ESM-only, has no runtime dependencies, and requires Node 22.12 or newer.
Install
npm install @vexil-lang/runtimePin a published runtime version that matches the generated code you ship. The version in this repository may be newer than the latest npm release.
Core API
import { BitReader, BitWriter } from '@vexil-lang/runtime';
const writer = new BitWriter();
writer.writeBits(5, 4);
writer.writeU16(1000);
writer.writeLeb128(42);
writer.writeZigZag(-7, 32);
writer.writeString('hello');
const bytes = writer.finish();
const reader = new BitReader(bytes);
const bits = reader.readBits(4);
const value = reader.readU16();Generated decoders accept the runtime's bounded reader. Configure limits at the application boundary when decoding untrusted data; the defaults cap recursion at 64 levels and byte arrays and strings at 64 MiB.
Vexil's compliance vectors provide the shared byte-level contract. They are the right starting point for verifying a new runtime or integration.
Licensed under either MIT or Apache-2.0, at your option.
