Features
-
tidyrs-wasmis a new package. It's the same WebAssembly build that runs the playground, now on npm. It works in browsers, Workers, Node, Bun & Deno. It has the sameformat&checkastidyrs, plusconfig()to read atidy.jsonortidy.toml, andversion(). See WebAssembly. (c4afa35)import init, { format } from "tidyrs-wasm"; await init(); // fetches tidy_bg.wasm; a no-op in Node format("let a = {b:1}", { lang: "js" });Note: It's ~1.25 MB gzipped & about 2-3x slower than the native addon. Use
tidyrswhen you can. -
tidyrsfalls back totidyrs-wasmwhen no native addon loads. This is opt-in: installtidyrs-wasmnext totidyrs, andtidyrsuses it only on a platform without an addon, such as a WebContainer. SetTIDYRS_WASM=1to use it everywhere. See Platforms. (c4afa35) -
locon a syntax error says where the error is, in the same shape as Prettier's errors. Bothline&columnstart at 1. The message doesn't change. (4ff6ba6)try { format("let a = 1;\nlet = ;", { lang: "js" }); } catch (err) { err.loc; //=> { start: { line: 2, column: 7 } } }