docs: add a WASI section to the WebAssembly page#3319
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The WebAssembly reference page had no mention of WASI, so anyone searching the
docs for "WASI" found nothing. This adds a "WebAssembly System Interface
(WASI)" section covering what WASI is, Deno's support for both generations, and
how to run modules, with working examples.
Everything in the section was built and run while writing it (Deno 2.8.3):
rustc --target wasm32-wasip1and ran the resulting.wasmwith thenode:wasimodule (therun.tsshown), confirming args and env reach theguest.
preopenslets theguest read a file from it, and that Deno requires
--allow-readand--allow-writefor the mapped path (so the permissions note is accurate).rustc --target wasm32-wasip2(a component,not a plain module) and confirmed both
deno run -A npm:@bytecodealliance/jco run hello.wasmruns it andjco transpileemits an importable ES module.Note:
node:wasiprints an experimental-feature warning, which the sectioncalls out. The old
@std/wasimodule is gone from JSR, so it is intentionallynot referenced.
Closes #3203.