ANSI and Styling for non-terminal target (wasm)
A detailed description of the feature you would like to see added.
It would be nice to move out terminal-related references from custom_styling feature to tty
Explain your usecase of the requested feature
I made a wasm wrapper for library to use it in JS application, but when I went to using ANSI coloring (Application shows logs from docker containers) I have a number of problems with sys::size(), sys::window_size() and other calls, that can't work with wasm target.
Alternatives
No response
Additional context
No response
I've drafted a commit https://github.com/alexgavrushenko/comfy-table/commit/593b07b27866efb02c3363e6797bf77bcad74037
Neat :D
I'm currently thinking about how we can test this. We would have to build this with wasm and run the tests on that. I've never interacted with wasm before, so this is definitely new territory for me!
I've built wasm wrapper and test suite here https://alexgavrushenko.github.io/comfy-table-wasm/test/comprehensive-test.html, but it's definitely out of scope, just shows how it works in browser)
I think the best way to test wasm is:
- Build for web and bundler targets
- Add tests for nodejs like https://github.com/alexgavrushenko/comfy-table-wasm/blob/main/test/test.js or mirror existing rust tests
Also complete testing web and bundler targets will require Selenium or other heavy things - so I don't think it is necessary
Thinking about it, it should be enough to simply test the logic with the correct feature flags :)
The wasm build shouldn't be something we need to test. As long as that logic works on another architecture, it should work on wasm as well :)
@alexgavrushenko Feel free to create a pull request for this one. Sorry for not being more direct, my previous comment was meant as a "Yeah, let's just go ahead and skip the tests.".