You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Pastel text highlighting library uses Unix.isatty as part of the logic to determine whether the host terminal supports color. There aren't currently stubs for this so compiling with JSOO requires consumers to provide an implementation. You can see reasonml/reason-native#207 for an an example of this.
I see a couple possible naive approaches:
a) bind Unix.stdin, Unix.stdout, Unix.stderr to NodeJS's process.stdin, process.stdout, Process.stderr and implement unix_isatty as `stream => stream. isTTY)
b) use NodeJS's tty.isatty( ) along with numeric file descriptors
However I have noticed that runtime's fs implementation has both node based and a non non based (fake) modules that it uses, so I could see doing something like that as well to have different behavior in a browser environment (for example I've verified that ansi escape sequences work in chrome's developer console, however none of the node js modules/functions I described are available in that environment)
The text was updated successfully, but these errors were encountered:
ansi escape sequences work in chrome's developer console
Is that true ? I was not able to make this work.
When I was first playing with Rely and JSOO a few months ago in chrome I was able to get this colorized output
(the weird unicode character thing was fixed by #798, but I had the screenshot lying around).
Also for a simpler example
I would probably go for (b), PR welcome
Sounds good, I'll make some time for this in the next several days.
The Pastel text highlighting library uses Unix.isatty as part of the logic to determine whether the host terminal supports color. There aren't currently stubs for this so compiling with JSOO requires consumers to provide an implementation. You can see reasonml/reason-native#207 for an an example of this.
I see a couple possible naive approaches:
a) bind Unix.stdin, Unix.stdout, Unix.stderr to NodeJS's process.stdin, process.stdout, Process.stderr and implement unix_isatty as `stream => stream. isTTY)
b) use NodeJS's tty.isatty( ) along with numeric file descriptors
However I have noticed that runtime's fs implementation has both node based and a non non based (fake) modules that it uses, so I could see doing something like that as well to have different behavior in a browser environment (for example I've verified that ansi escape sequences work in chrome's developer console, however none of the node js modules/functions I described are available in that environment)
The text was updated successfully, but these errors were encountered: