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
numlibrary now works on Wasm (thenatprimitives were no-op stubs).
Library ā new web APIs
Promisemodule ā type-safe bindings to JS promises, with Lwt interop (Js_of_ocaml_lwt.Promise.{to_lwt,of_lwt}) and Promise-typedDom_htmlbindings.Fetch+Abortmodules ā the Fetch API with typedAbortController/AbortSignalcancellation.Dom_svgaligned with SVG 2, the popover API,Intl.RelativeTimeFormat, a newPerformancemodule, additionalConsolebindings, and many moreDom_htmlbindings.
Bug fixes
- A large number of bug fixes across the compiler, runtime, library bindings, and PPX.
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.