dprint / dprint

Pluggable and configurable code formatting platform written in Rust.

Home Page:https://dprint.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Programatic API for TS (Node/Bun/Deno/etc.)

jasonkuhrt opened this issue · comments

Hey @dsherret, I was wondering if there would ever be a programmatic api for embedding in code generation tools. I'd like to run output through a formatter before emitting and while I could use a child process that is less performant than some in memory thing. How hard would it be to have a few simple functions allowing dprint to be run in memory? Is it just a simple matter with WASM or more involved?

The Wasm plugins are all distributed as npm packages: https://www.npmjs.com/package/@dprint/typescript

See https://github.com/dprint/js-formatter -- Is that what you're looking for?

@dsherret yes! Thanks!