[ANN] Js_of_ocaml / Wasm_of_ocaml 6.4

I’m pleased to announce the joint release of js_of_ocaml and wasm_of_ocaml 6.4.0.

Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environments like browsers and Node.js.

Wasm_of_ocaml is a compiler from OCaml bytecode to WebAssembly. It is highly compatible with js_of_ocaml, so you can compile your programs with wasm_of_ocaml instead of js_of_ocaml and experience overall better performance.

Most significant changes since version 6.3:

Toolchain

  • OCaml 5.5.0 support.
  • OxCaml support.

wasm_of_ocaml

  • WASI 0.1 support — target standalone WASI runtimes (wasmtime and friends), no JavaScript host required.
  • Dynlink and toplevel support — the OCaml toplevel now runs on the Wasm backend.
  • An alternative effects backend based on the Stack Switching proposal.
  • Pure-Wasm zstd and BLAKE2b — unmarshalling compressed values and Digest.BLAKE2{512,256,128} no longer need the JavaScript shims, so they work under WASI too.
  • The legacy num library now works on Wasm (the nat primitives were no-op stubs).

Library — new web APIs

  • Promise module — type-safe bindings to JS promises, with Lwt interop (Js_of_ocaml_lwt.Promise.{to_lwt,of_lwt}) and Promise-typed Dom_html bindings.
  • Fetch + Abort modules — the Fetch API with typed AbortController/AbortSignal cancellation.
  • Dom_svg aligned with SVG 2, the popover API, Intl.RelativeTimeFormat, a new Performance module, additional Console bindings, and many more Dom_html bindings.

Bug fixes

  • A large number of bug fixes across the compiler, runtime, library bindings, and PPX.

:warning: Breaking changes

A few changes are source-incompatible — mostly to fix incorrect bindings and behavior — and may require updating existing code. See the migration guide.

See the documentation and the full changelog.

We released Eliom 12.1 at the same time, bringing compatibility with both js_of_ocaml 6.4 and OCaml 5.5.