Skip to content

Commit 5eaab37

Browse files
authored
refactor: "Running Components" section: minor style changes (#313)
For example, changing "wit" to "WIT" and "Wasm" to "WebAssembly".
1 parent c9a59fb commit 5eaab37

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
# Running Components
22

3-
There are two standard wit worlds that runtimes support. These worlds are the [`wasi:cli/command` world](https://github.com/WebAssembly/wasi-cli/blob/main/wit/command.wit) and the [`wasi:http/proxy` world](https://github.com/WebAssembly/wasi-http/blob/main/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.
3+
There are two standard WIT worlds that runtimes support.
4+
These worlds are the [`wasi:cli/command` world](https://github.com/WebAssembly/wasi-cli/blob/main/wit/command.wit)
5+
and the [`wasi:http/proxy` world](https://github.com/WebAssembly/wasi-http/blob/main/wit/proxy.wit).
6+
All other WIT worlds and interfaces are considered to be custom.
7+
In the following sections, you'll see how to run components that implement either world, as well as how to invoke custom exports.
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
# jco
22

3-
[jco](https://github.com/bytecodealliance/jco) is a fully native JavaScript tool for working with components in JavaScript. It supports the [`wasi:cli/command` world](https://github.com/WebAssembly/wasi-cli/blob/main/wit/command.wit). `jco` also provides features for transpiling Wasm components to ES modules, and for building Wasm components from JavaScript and WIT.
3+
[jco](https://github.com/bytecodealliance/jco) is a fully native JavaScript tool for working with components in JavaScript.
4+
It supports the [`wasi:cli/command` world](https://github.com/WebAssembly/wasi-cli/blob/main/wit/command.wit).
5+
`jco` also provides features for transpiling WebAssembly components to ECMAScript modules (ES modules),
6+
and for building WebAssembly components from JavaScript and WIT.
47

58
To run a component with `jco`, run:
69

710
```sh
811
jco run <path-to-wasm-file> <command-args...>
912
```
1013

11-
`jco`'s WASI implementation grants the component full access to the underlying system resources. For example, the component can read all environment variables of the `jco` process, or read and write files anywhere in the file system.
14+
`jco`'s WASI implementation grants the component full access to the underlying system resources.
15+
For example, the component can read all environment variables of the `jco` process,
16+
or read and write files anywhere in the file system.

component-model/src/running-components/wasmtime.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Wasmtime
22

3-
[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-cli/blob/main/wit/command.wit) and serving components that implement the [`wasi:http/proxy` world](https://github.com/WebAssembly/wasi-http/blob/main/wit/proxy.wit). Wasmtime can also invoke functions exported from a component.
3+
[Wasmtime](https://github.com/bytecodealliance/wasmtime/) is the reference implementation of the Component Model.
4+
It supports running components that implement the [`wasi:cli/command` world](https://github.com/WebAssembly/wasi-cli/blob/main/wit/command.wit)
5+
and serving components that implement the [`wasi:http/proxy` world](https://github.com/WebAssembly/wasi-http/blob/main/wit/proxy.wit).
6+
Wasmtime can also invoke functions exported from a component.
47

58
## Running command components with Wasmtime
69
To run a command component with Wasmtime, execute:
@@ -9,13 +12,17 @@ To run a command component with Wasmtime, execute:
912
wasmtime run <path-to-wasm-file>
1013
```
1114

12-
> If you are using an older version of `wasmtime`, you may need to add the `--wasm component-model` flag to specify that you are running a component rather than a core module.
15+
> If you are using an older version of `wasmtime`, you may need to add the `--wasm component-model` flag
16+
> to specify that you are running a component rather than a core module.
1317
14-
By default, Wasmtime denies the component access to all system resources. For example, the component cannot access the file system or environment variables. See the [Wasmtime guide](https://docs.wasmtime.dev/) for information on granting access, and for other Wasmtime features.
18+
By default, Wasmtime denies the component access to all system resources.
19+
For example, the component cannot access the file system or environment variables.
20+
See the [Wasmtime guide](https://docs.wasmtime.dev/) for information on granting access, and for other Wasmtime features.
1521

1622
## Running HTTP components with Wasmtime
1723

18-
You can now execute components that implement the [HTTP proxy world](https://github.com/WebAssembly/wasi-http/blob/main/wit/proxy.wit) with the `wasmtime serve` subcommand. [The Wasmtime CLI](https://github.com/bytecodealliance/wasmtime) supports serving these components as of `v14.0.3`.
24+
You can execute components that implement the [HTTP proxy world](https://github.com/WebAssembly/wasi-http/blob/main/wit/proxy.wit) with the `wasmtime serve` subcommand.
25+
[The Wasmtime CLI](https://github.com/bytecodealliance/wasmtime) supports serving these components as of `v14.0.3`.
1926

2027
To run a HTTP component with Wasmtime, execute:
2128
```sh
@@ -29,6 +36,7 @@ Try out building and running HTTP components with one of these tutorials
2936
2. [HTTP Auth Middleware tutorial](https://github.com/fermyon/http-auth-middleware#running-with-wasmtime) - compose a HTTP authentication middleware component with a business logic component
3037

3138
## Running components with custom exports
39+
3240
As of Wasmtime Version 33.0.0, there is [support for invoking components with custom exports](https://bytecodealliance.org/articles/invoking-component-functions-in-wasmtime-cli).
3341

3442

@@ -37,4 +45,7 @@ As an example, if your component exports a function `add` which takes two numeri
3745
```sh
3846
wasmtime run --invoke 'add(1, 2)' <path-to-wasm-file>
3947
```
40-
Make sure to wrap your invocation in single quotes and to include parentheses, even if your function doesn't take any arguments. For a full list of ways to represent the various wit types when passing arguments to your exported function, visit the [WAVE repo](https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-wave).
48+
49+
Make sure to wrap your invocation in single quotes and to include parentheses, even if your function doesn't take any arguments.
50+
For a full list of ways to represent the various WIT types when passing arguments to your exported function,
51+
visit the [WAVE repository](https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-wave).

0 commit comments

Comments
 (0)