wasm-bindgen is a Rust library and CLI toolchain that facilitates high-level interoperability between Rust-generated WebAssembly modules and JavaScript. It provides a `#[wasm_bindgen]` procedural macro to import JS functions and export Rust functions/structs/enums to JS, along with a post-processing CLI (`wasm-bindgen`) that generates JavaScript and TypeScript glue code for multiple targets (bundler, web, Node.js, Deno, no-modules). The repository also includes runtime crates (`js-sys`, `web-sys`, `wasm-bindgen-futures`, `wasm-bindgen-test`) that offer comprehensive bindings to standard JavaScript APIs and browser Web APIs, generated from WebIDL definitions. The project is the de facto standard for Rust-to-Wasm development, with extensive examples, benchmarks, and a robust test suite covering browser, Node, Deno, and headless environments.
Melange is an OCaml-to-JavaScript compiler that compiles a large subset of OCaml (including the standard library and the Belt data structures library) to readable JavaScript. It is a fork of ReScript (formerly BuckleScript) with a focus on OCaml ecosystem compatibility, integration with Dune build system, and support for OCaml's module system (including first-class modules and virtual libraries). The compiler features a multi-pass lambda IR transformation pipeline, a PPX rewriter for Melange-specific attributes (e.g., [@mel.module], [@mel.send]), and extensive runtime support for JavaScript interop, including bindings for Node.js, DOM APIs, and ES module systems. The codebase is structured as a monorepo with several components: the compiler core (jscomp/core/), the PPX preprocessor (ppx/), the standard library fork (jscomp/stdlib/), the Belt library (belt/), runtime libraries (jscomp/runtime/), and a test suite with both unit tests (via the Mt framework) and blackbox tests (.t files). The build system uses Dune and opam, with an optional Nix flake for reproducible builds. The repository demonstrates strong craftsmanship in its compiler passes (alpha conversion, dead code elimination, arity analysis, constant folding) and in the design of JavaScript runtime primitives. However, there is some technical debt: several FIXME and TODO comments, conditional compilation for OCaml version compatibility, a few vendored components (Flow parser) that may drift from upstream, and some generated files that require regeneration when source definitions change.