typos icon indicating copy to clipboard operation
typos copied to clipboard

Is it possible to make wasm build of `typos` so it can be used from JavaScript?

Open coderaiser opened this issue 3 years ago • 4 comments

Would be great if typos can be used from JavaScript, in this case the processor can be written and typos can be run from 🐊Putout linter, it shows progress bar, and supports a lot of formatters so no need to run a couple different CLI to get linting result (or apply fixes).

Right now it can be spawned each time, but I think it will be much slower, isn't it? How hard would be to compile typos to wasm?

coderaiser avatar Sep 20 '22 15:09 coderaiser

I've be willing to accept contributions but I have little experience with the node/wasm ecosystem and don't have the time at the moment to devote to figuring all of this this.

epage avatar Sep 20 '22 16:09 epage

Here is how it can look like: putout-processor-typos, right now it spawns a new process on each file.

coderaiser avatar Sep 21 '22 18:09 coderaiser

That wont work for WASM compat - @epage it may be enough to just separate any extra logic that may be important for an external program using typos in its own library (if it isn't already), and add the wasm target to the CI to ensure that no wasm-breaking packages are being used.

If that's ok, I'll be happy to write a quick PR to add the WASM target to the CI and see if I run into issues while trying to use this crate as a git repo :+1:

tristan-f-r avatar Aug 02 '23 16:08 tristan-f-r

typos has the parser and the core traits. typos-dict has the dictionary. typos-cli pulls it all together into a binary.

So someone can use typos and typos-dict to build up a custom application that is agnostic of IO / OS / runtime

epage avatar Aug 02 '23 16:08 epage