Skip to content

Conversation

@eduardomourar
Copy link
Contributor

@eduardomourar eduardomourar commented Feb 18, 2023

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.

Copy link
Collaborator

@guybedford guybedford left a 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.

@guybedford
Copy link
Collaborator

guybedford commented Feb 19, 2023

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!).

@eduardomourar
Copy link
Contributor Author

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?

@eduardomourar eduardomourar changed the title feat: add wasi-common shim for browser and nodejs feat: add wasi preview2 shim for browser and nodejs Feb 19, 2023
@eduardomourar eduardomourar marked this pull request as ready for review February 19, 2023 02:27
@guybedford
Copy link
Collaborator

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!

@guybedford guybedford merged commit 7f06bda into bytecodealliance:main Feb 19, 2023
@eduardomourar
Copy link
Contributor Author

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!

@eduardomourar eduardomourar deleted the feat/wasi-common-library branch February 19, 2023 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants