-
Notifications
You must be signed in to change notification settings - Fork 90
feat: add wasi preview2 shim for browser and nodejs #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add wasi preview2 shim for browser and nodejs #37
Conversation
guybedford
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
|
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 <[email protected]>
Co-authored-by: Guy Bedford <[email protected]>
|
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.