# v2.1.0

> The new `tidyrs-wasm` package, a WebAssembly fallback for `tidyrs`, and where each syntax error is.

## Features

- **`tidyrs-wasm`** is a new package. It's the same WebAssembly build that runs the [playground](/playground/), now on npm. It works in browsers, Workers, Node, Bun & Deno. It has the same `format` & `check` as `tidyrs`, plus `config()` to read a `tidy.json` or `tidy.toml`, and `version()`. See [WebAssembly](/docs/wasm/). ([c4afa35](https://github.com/lukeed/tidy/commit/c4afa35))

  ```js
  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 `tidyrs` when you can.

- **`tidyrs`** falls back to `tidyrs-wasm` when no native addon loads. This is opt-in: install `tidyrs-wasm` next to `tidyrs`, and `tidyrs` uses it only on a platform without an addon, such as a WebContainer. Set `TIDYRS_WASM=1` to use it everywhere. See [Platforms](/docs/node/#platforms). ([c4afa35](https://github.com/lukeed/tidy/commit/c4afa35))

- **`loc`** on a syntax error says where the error is, in the same shape as Prettier's errors. Both `line` & `column` start at 1. The message doesn't change. ([4ff6ba6](https://github.com/lukeed/tidy/commit/4ff6ba6))

  ```js
  try {
    format("let a = 1;\nlet = ;", { lang: "js" });
  } catch (err) {
    err.loc; //=> { start: { line: 2, column: 7 } }
  }
  ```

## Chore

- The bindings share one parser for their options and languages. ([a576623](https://github.com/lukeed/tidy/commit/a576623))
- The JavaScript benchmark reads the output of hyperfine 2. ([5b20334](https://github.com/lukeed/tidy/commit/5b20334))
