diffWit
diffWit(before, after)
Parses both WIT documents and classifies every interface/function change as breaking or safe.
The WebAssembly Component Model lets components compiled in different languages call each other through a shared WIT contract. If a new version silently changes a function's signature, every component importing the old interface fails to compose -- often far from the actual change.
wit-breaking answers one question: does this WIT interface change break every component that imports it?
Give it two WIT documents -- before and after -- and it walks every interface and function in both, classifying each difference as breaking (removed function, removed/reordered required param, changed return type) or safe (new optional capability, added function).
import { diffWit } from "wit-breaking";
const result = diffWit(beforeWit, afterWit);
if (result.breaking.length > 0) {
console.error(result.summary);
process.exit(1);
}
diffWit(before, after)
Parses both WIT documents and classifies every interface/function change as breaking or safe.
result.breaking: Change[]
Every change that would fail to compose with an existing importer.
result.safe: Change[]
Additive changes -- new functions, new optional capabilities.
Protobuf and OpenAPI solved this years ago with dedicated tools (buf breaking, oasdiff) that diff two versions of a schema and tell you, in plain language, what would break. WIT had no equivalent -- this project is that tool for WIT.
Also ships as a GitHub Action, published on the GitHub Marketplace, for CI use.
before.wit: func: func(a: string, b: u32) -> result
after.wit: func: func(a: string) -> result
diffWit() → breaking: param "b" removed