wit-breaking
Detects breaking changes between two versions of a WebAssembly
Component Model WIT interface — the equivalent of
buf breaking for protobuf or oasdiff for
OpenAPI.
What it does
Give it the WIT text from before a change and the WIT text after.
It walks every interface and function and classifies each difference.
The process exits 1 when anything breaking is found, and
0 otherwise.
| What changed | Verdict |
|---|---|
| A function was removed | Breaking |
| A function's parameters changed | Breaking |
| A function's return type changed | Breaking |
| A whole interface was removed | Breaking |
| A function was added | Safe |
| A whole interface was added | Safe |
Signature comparison is textual: any parameter or return-type change
is flagged as breaking. Extract WIT from a compiled component with
wasm-tools component wit, then diff the two text files.
Install
npm install --save-dev wit-breaking
Usage
Command line:
npx wit-breaking before.wit after.wit
Library:
import { parseWit, diffWit } from "wit-breaking";
const result = diffWit(parseWit(beforeSource), parseWit(afterSource));
if (result.breaking) {
process.exit(1);
}
GitHub Action:
- uses: jayblast-spec/wit-breaking@main
with:
before: before.wit
after: after.wit