feat: add wasi preview2 shim for browser and nodejs#37
feat: add wasi preview2 shim for browser and nodejs#37guybedford merged 10 commits intobytecodealliance:mainfrom
Conversation
guybedford
left a comment
There was a problem hiding this comment.
Thanks for putting this together, it's almost entirely identical to what I've been using myself here.
Definitely agreed on the overall direction, just see the few comments.
Happy to merge and iterate from there.
|
We should probably be generating all the types directly from the WASI wit definitions as well to ensure we're in sync (although no need to worry for this PR!). |
Co-authored-by: Guy Bedford <guybedford@gmail.com>
|
I have made a commit with the experimental outbound HTTP request work I have been doing (related to this other PR here). I guess I should revert that, right? |
Co-authored-by: Guy Bedford <guybedford@gmail.com>
Co-authored-by: Guy Bedford <guybedford@gmail.com>
Co-authored-by: Guy Bedford <guybedford@gmail.com>
|
I'm more than happy to just ship things in any state here, as it is highly experimental and also because it is just a shim - so any iterative improvement in terms of things working will always be a win. I'm tempted to post a first npm publish later this afternoon, unless you can think of any reasons not to! |
Publishing to NPM will actually make my life so much easier! |
This a basic shim for WASI (preview2) in JavaScript. The browser part is almost as is from https://github.com/guybedford/wasi-command-export-printf/tree/main/wasi and for Node.js it implements a small percentage of the API. Keep in mind that this is packaged as an ES module to be consumed for both environments without any workaround or hack.