Skip to content

WASM/TypeScript consumption surface

State: open/planned · Kind: adapter · Audience: system

  • Each crate a TypeScript consumer needs gets its own wasm-bindgen binding with generated TypeScript types, browser and Node served by packaging. yaml-splice-wasm is shipped; solutions/agent-pants/crates/agent-adapt-wasm is the other in-repo example.
  • There is no markdown WASM crate. TypeScript owns the query plane and the markdown-contract API (D-9WKF-contract-authoring-and-runtime-ownership).
  • A new binding ships when a TypeScript consumer needs the Rust behaviour.

The fleet’s TS consumers — polish UI, sdlc tooling, determined apps, doc sites — reach Rust behaviour through a binding per crate: wasm-bindgen bindings, generated types, conditional main/browser/exports packaging with an environment-detecting loader — the shape oxc and biome converged on after abandoning dual wasm+native bindings. Data crosses as JSON; napi-rs is admitted later only under demonstrated performance need for large-vault batch work.

  • yaml-splice-wasm (D-W4SM-yaml-splice-wasm-typescript-binding): WASM artifact and typed wrapper for yaml-splice.
  • Dual node/browser entry, sync Node init and async browser init.
  • Generated .d.ts from the Rust type layer — no hand-maintained type mirrors (the 1709-line lint-rule table is the cautionary example).
  • Separate wasm packages don’t share binary payload, so each binding is a deliberate cut point, added only on proven consumer demand (the B-MDU7 promotion bar applied to npm).

Shipped: packages/rust/yaml-splice-wasm and solutions/agent-pants/crates/agent-adapt-wasm. Precedent: markdown-contract PR #249 (WASM spike, GO — 404 KiB brotli, JSON boundary, sync/async init findings reusable directly). Sequenced by M-F4RZ-wasm-ts-distribution. Packaging lesson source: oxc’s retrospective on abandoning dual bindings; biome’s @biomejs/js-api loader shim.


← Back to Capabilities