Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/mdbook/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ runs:
id: book-build
env:
PUBLISH_DOMAIN: ${{ inputs.publish-domain }}
MDBOOK_OUTPUT__LINKCHECK2__FOLLOW_WEB_LINKS: 'true'
Comment thread
vados-cosmonic marked this conversation as resolved.
run: |
just build-book
echo "output-path=$(just print-book-dir)" >> $GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion component-model/src/design/component-model-concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ must be invoked in an environment that implements those interfaces.
A [_package_](./packages.md) is a set of WIT files
containing a related set of interfaces and worlds.

For example, the [wasi-http](https://github.com/WebAssembly/WASI/blob/main/proposals/http/wit/proxy.wit) package includes
For example, the [wasi-http](https://github.com/WebAssembly/WASI/blob/wasi-0.2/proposals/http/wit/proxy.wit) package includes
an `imports` world encapsulating the interfaces that an HTTP proxy depends on,
and a `proxy` world that depends on `imports`.

Expand Down
4 changes: 2 additions & 2 deletions component-model/src/design/interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ and imports anything imported by the "wall clock" interface.
Interfaces are defined using [the WIT language](./wit.md).

[wp-contract]: https://en.wikipedia.org/wiki/Design_by_contract
[wasi-http-handler]: https://github.com/WebAssembly/WASI/blob/main/proposals/http/wit/handler.wit
[wasi-clocks-wall-clock]: https://github.com/WebAssembly/WASI/blob/main/proposals/clocks/wit/wall-clock.wit
[wasi-http-handler]: https://github.com/WebAssembly/WASI/blob/wasi-0.2/proposals/http/wit/handler.wit
[wasi-clocks-wall-clock]: https://github.com/WebAssembly/WASI/blob/wasi-0.2/proposals/clocks/wit/wall-clock.wit

> For a more formal definition of an interface, take a look at the [WIT specification](https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md).
2 changes: 1 addition & 1 deletion component-model/src/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ A system or platform may expose some or all of the WASI APIs to components.

The current stable release of WASI is [WASI 0.2.0](https://github.com/WebAssembly/WASI/pull/577),
which was released on January 25, 2024.
WASI 0.2.0 is [a stable set of WIT definitions](https://github.com/WebAssembly/WASI/blob/main/docs/Preview2.md)
WASI 0.2.0 is [a stable set of WIT definitions](https://github.com/WebAssembly/WASI/blob/wasi-0.2/docs/Preview2.md)
that components can target.
WASI proposals will continue to evolve and new ones will be introduced;
however, users of the component model can now pin to any stable release >= `v0.2.0`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ that is, code which fulfills the definition of the interface function declared i

"P1" refers to [WASI Preview 1](https://github.com/WebAssembly/WASI/tree/wasi-0.1),
the initial version of the WASI APIs.
"P2" refers to [WASI Preview 2](https://github.com/WebAssembly/WASI/blob/main/docs/Preview2.md),
"P2" refers to [WASI Preview 2](https://github.com/WebAssembly/WASI/blob/wasi-0.2/docs/Preview2.md),
which introduced the component model.

While in the past building a P2 component required conversion from a P1 component,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ $ cargo run --release -- 1 2 ../../../go-adder/main.wasm

With this, we have successfully built and run a basic WebAssembly component with Go 🎉

[crates-wasmtime]: https://crates.io/crates/wasmtime
[crates-wasmtime]: https://docs.rs/wasmtime
[repo-component-docs]: https://github.com/bytecodealliance/component-docs
[docs-adder]: https://github.com/bytecodealliance/component-docs/tree/main/component-model/examples/tutorial/wit/adder/world.wit
[componentize-go]: https://github.com/bytecodealliance/componentize-go
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ available targets in the toolchain:
- `wasm32-wasip2` ([WASI P2][wasip2])

[wasm-core]: https://webassembly.github.io/spec/core/
[wasip1]: https://github.com/WebAssembly/WASI/tree/main/legacy
[wasip2]: https://github.com/WebAssembly/WASI/tree/main/wasip2
[wasip1]: https://github.com/WebAssembly/WASI/tree/wasi-0.1
[wasip2]: https://github.com/WebAssembly/WASI/tree/wasi-0.2

> [!NOTE]
> To use the targets above, ensure that they are enabled via the Rust toolchain (e.g. `rustup`).
Expand All @@ -31,7 +31,7 @@ cargo build --target wasm32-wasip2
> the project is in the process of being deprecated as native tooling can be used directly.

[rust]: https://rust-lang.org
[cargo-component]: https://crates.io/crates/cargo-component
[cargo-component]: https://github.com/bytecodealliance/cargo-component

## 1. Setup

Expand Down Expand Up @@ -138,8 +138,8 @@ types to a module that can be referred to later.

At present, the code won't *do* much, but that's because we haven't added our implementation yet.

[crates-wit-bindgen]: https://crates.io/crates/wit-bindgen
[crates-wit-bindgen-cli]: https://crates.io/crates/wit-bindgen-cli
[crates-wit-bindgen]: https://docs.rs/wit-bindgen
[crates-wit-bindgen-cli]: https://github.com/bytecodealliance/wit-bindgen#cli-installation
[rustdoc-wit-bindgen-generate]: https://docs.rs/wit-bindgen/latest/wit_bindgen/macro.generate.html

## 5. Implementing the `adder` world via the generated `Guest` Trait
Expand All @@ -163,7 +163,7 @@ There are a few points of note in the code listing above:
> To dive into the code generated by the `wit_bindgen::generate!` macro, you can use the [`cargo-expand` crate][crates-cargo-expand]

[export-macro]: https://docs.rs/wit-bindgen/latest/wit_bindgen/macro.generate.html#exports-the-export-macro
[crates-cargo-expand]: https://crates.io/crates/cargo-expand
[crates-cargo-expand]: https://github.com/dtolnay/cargo-expand

## 6. Building a Component

Expand Down Expand Up @@ -248,6 +248,6 @@ $ cargo run --release -- 1 2 ../add/target/wasm32-wasip2/release/adder.wasm

With this, we have successfully built and run a basic WebAssembly component with Rust 🎉

[crates-wasmtime]: https://crates.io/crates/wasmtime
[crates-wasmtime]: https://docs.rs/wasmtime
[repo-component-docs]: https://github.com/bytecodealliance/component-docs
[docs-adder]: https://github.com/bytecodealliance/component-docs/tree/main/component-model/examples/tutorial/wit/adder/world.wit
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This page has content for both **WASI 0.2** and **WASI 0.3**. Use the tabs below to switch between versions where they differ.

> **WASI 0.3 toolchain note.** Rust's [`wasm32-wasip3` target](https://doc.rust-lang.org/nightly/rustc/platform-support/wasm32-wasip3.html) is currently Tier 3 with no prebuilt artifacts; building for it requires constructing the standard library from source. The 0.3 example on this page therefore uses the library/reactor pattern targeting `wasm32-wasip2`, where [`wit-bindgen`](https://crates.io/crates/wit-bindgen)'s `async` feature handles the 0.3 binding generation. There is no Rust-idiomatic 0.3 path for the `fn main()` command-component pattern yet.
> **WASI 0.3 toolchain note.** Rust's [`wasm32-wasip3` target](https://doc.rust-lang.org/nightly/rustc/platform-support/wasm32-wasip3.html) is currently Tier 3 with no prebuilt artifacts; building for it requires constructing the standard library from source. The 0.3 example on this page therefore uses the library/reactor pattern targeting `wasm32-wasip2`, where [`wit-bindgen`](https://docs.rs/wit-bindgen)'s `async` feature handles the 0.3 binding generation. There is no Rust-idiomatic 0.3 path for the `fn main()` command-component pattern yet.

</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ which contains the `reverse-and-uppercase` function (in JavaScript, `reverseAndU
> Functionality is imported via the `interface`, *not* the `world`.
> `world`s can be included/used, but the syntax is slightly different for that.

The JavaScript to make this work ([`string-reverse-upper.mjs` in `jco/examples`][string-reverse-upper-mjs])
The JavaScript to make this work ([`string-reverse-upper.js` in `jco/examples`][string-reverse-upper-js])
Comment thread
vados-cosmonic marked this conversation as resolved.
looks like this:

```js
Expand Down Expand Up @@ -165,7 +165,7 @@ reverseAndUppercase('!dlroW olleH') = HELLO WORLD!

[wac]: https://github.com/bytecodealliance/wac
[jco-examples-string-reverse-upper]: https://github.com/bytecodealliance/jco/tree/main/examples/components/string-reverse-upper
[string-reverse-upper-mjs]: https://github.com/bytecodealliance/jco/blob/main/examples/components/string-reverse-upper/string-reverse-upper.mjs
[string-reverse-upper-js]: https://github.com/bytecodealliance/jco/blob/main/examples/components/string-reverse-upper/string-reverse-upper.js

## Using `jco transpile` to run components from Javsacript

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Add [`wstd`][wstd], a Rust async standard library for Wasm components as a depen
```console
cargo add wstd
```
`wstd` provides idiomatic Rust bindings for WASI standard interfaces [(`wasi:http`)](https://github.com/WebAssembly/WASI/tree/main/proposals/http) to increase ease-of-use for Rust WebAssembly components. Since we are using `wstd`, we will not need to add WIT files or depend on [`wit-bindgen`](https://crates.io/crates/wit-bindgen) directly.
`wstd` provides idiomatic Rust bindings for WASI standard interfaces [(`wasi:http`)](https://github.com/WebAssembly/WASI/tree/main/proposals/http) to increase ease-of-use for Rust WebAssembly components. Since we are using `wstd`, we will not need to add WIT files or depend on [`wit-bindgen`](https://docs.rs/wit-bindgen) directly.


> [!NOTE]
Expand Down
4 changes: 2 additions & 2 deletions component-model/src/reference/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ WebAssembly components can be expressed via both a binary and textual format (["
[wat]: https://webassembly.github.io/spec/core/text/index.html
[cabi]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md
[cm-binary-format]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Binary.md
[wasi-p1]: https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/witx/wasi_snapshot_preview1.witx
[wasi-p1]: https://github.com/WebAssembly/WASI/blob/wasi-0.1/preview1/witx/wasi_snapshot_preview1.witx
[wasm-core-spec]: https://webassembly.github.io/spec/core/

## Q: How can I tell if a WebAssembly binary is a component or a module?
Expand Down Expand Up @@ -81,7 +81,7 @@ expect to access—WASI enables building interfaces on top of a shared standard

Preview 1 refers to [the first iteration of the Component Model](https://github.com/WebAssembly/WASI/tree/wasi-0.1)
which was based on WITX and is now deprecated.
Preview 2 refers to [a newer iteration of the Component Model](https://github.com/WebAssembly/WASI/blob/main/docs/Preview2.md)
Preview 2 refers to [a newer iteration of the Component Model](https://github.com/WebAssembly/WASI/blob/wasi-0.2/docs/Preview2.md)
which uses WebAssembly Interface Types (WIT).
Preview 3 (WASI 0.3, released June 11, 2026) adds native async to the Component Model:
`async func`, `stream<T>`, and `future<T>` are now Canonical ABI primitives, and the `wasi:io` package is removed.
Expand Down
2 changes: 1 addition & 1 deletion component-model/src/reference/useful-links.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The following references are helpful in understanding the Component Model and re
- [Canonical ABI][canonical-abi]

[wasm-cm-repo]: https://github.com/WebAssembly/component-model
[wasi-p2]: https://github.com/WebAssembly/WASI/blob/main/docs/Preview2.md
[wasi-p2]: https://github.com/WebAssembly/WASI/blob/wasi-0.2/docs/Preview2.md
[ast-explainer]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md
[canonical-abi]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md
[wac]: https://github.com/bytecodealliance/wac
Expand Down
2 changes: 1 addition & 1 deletion component-model/src/running-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

There are two standard WIT worlds that runtimes support.
These worlds are the [`wasi:cli/command` world](https://github.com/WebAssembly/WASI/blob/main/proposals/cli/wit/command.wit)
and the [`wasi:http/proxy` world](https://github.com/WebAssembly/WASI/blob/main/proposals/http/wit/proxy.wit).
and the [`wasi:http/proxy` world](https://github.com/WebAssembly/WASI/blob/wasi-0.2/proposals/http/wit/proxy.wit).
All other WIT worlds and interfaces are considered to be custom.
In the following sections, you'll see how to run components that implement either world, as well as how to invoke custom exports.
4 changes: 2 additions & 2 deletions component-model/src/running-components/wasmtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This page has content for both **WASI 0.2** and **WASI 0.3**. Use the tabs below
{{#tab name="WASI 0.2" }}
[Wasmtime](https://github.com/bytecodealliance/wasmtime/) is the reference implementation of the Component Model.
It supports running components that implement the [`wasi:cli/command` world](https://github.com/WebAssembly/WASI/blob/main/proposals/cli/wit/command.wit)
and serving components that implement the [`wasi:http/proxy` world](https://github.com/WebAssembly/WASI/blob/main/proposals/http/wit/proxy.wit).
and serving components that implement the [`wasi:http/proxy` world](https://github.com/WebAssembly/WASI/blob/wasi-0.2/proposals/http/wit/proxy.wit).
Wasmtime can also invoke functions exported from a component.
{{#endtab }}
{{#tab name="WASI 0.3" }}
Expand Down Expand Up @@ -52,7 +52,7 @@ See the [Wasmtime guide](https://docs.wasmtime.dev/) for information on granting

{{#tabs global="wasi-version" }}
{{#tab name="WASI 0.2" }}
You can execute components that implement the [HTTP proxy world](https://github.com/WebAssembly/WASI/blob/main/proposals/http/wit/proxy.wit) with the `wasmtime serve` subcommand.
You can execute components that implement the [HTTP proxy world](https://github.com/WebAssembly/WASI/blob/wasi-0.2/proposals/http/wit/proxy.wit) with the `wasmtime serve` subcommand.
[The Wasmtime CLI](https://github.com/bytecodealliance/wasmtime) supports serving these components as of `v18.0.0`.

To run a HTTP component with Wasmtime, execute:
Expand Down
Loading