Does not appear to work under Firefox, getting a bunch of CORS-related errors (header ‘user-agent’ is not allowed according to header ‘Access-Control-Allow-Headers’ from CORS preflight response) on the /graphql endpoint.
This is awesome! I'm Syrus, from Wasmer. Would love to help you with this!
We are releasing soon a new version of wasmer-js, so it should be very easy to use it with webassembly.sh (note webassembly.sh and wasmer.sh share the same code)
Everything went smooth (just added a new comment on top of this thread for visibility!), only nit is that `convertEol` didn't work, so I had to manually convert `\n` to `\r\n`.
I'd go a bit further. If you want full POSIX support, perhaps WASIX is the best alternative.
It's WASI preview 1 + many missing features, such as: threads, fork, exec, dlopen, dlsym, longjmp, setjmp, ...
I don't think that's accurate, although it's true that needs extra work to work properly in JS based environments.
You can already create threads in Wasm environments (we got even fork working in WASIX!). However, there is an upcoming Wasm proposal that adds threads support natively to the spec: https://github.com/WebAssembly/shared-everything-threads
Right now you should be good to go to start using WASIX.
If you want to compile threaded code, things should already work (without waiting for any proposal in the Wasm space).
If you want to run it, there are few options: use wasmer-js for the browser (Wasmer using the Browser Wasm engine + WASIX) or using normal Wasmer to run it server-side.
No need to wait for the Wasm "proper" implementation. Things should already be runnable with no major issues.
Really impressive work. Would love to see it progress.
Some ways I can see it could improve:
1. setjmp/longjmp could implemented via Wasm Exceptions (this is how we do it on WASIX) - no need to wait on stack switching proposal
2. fork could work easily with asyncify (start/resume), per binary compiled
3. JIT could work via dlopen/dlsym (compiling the Wasm and linking it), even with runtime patching (using memory spaces on tables and updating them as you go to newly compiled code).
In general, I recommend taking an inspiration from WASIX [1] for those things, as we have spend quite a bit of time to make things work as much as possible!
This is very interesting! Would love to see it in play in Wasmer at some point.
I was aware of TinyGo, which allows compiling Go programs via LLVM (and targeting Wasm, for example). They have a very tiny footprint (programs could even run on the browser) https://tinygo.org/
thanks. it'd be great to have a quick tutorial on doing so.
this is close to my dream of creating Frankenstein apps with the web platform instead of graal :)
reply