Skip to content

running.md moved to wasmtime.md section and updated w custom invocations #268

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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: 0 additions & 1 deletion component-model/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
- [Creating and Consuming Components](./creating-and-consuming.md)
- [Authoring Components](./creating-and-consuming/authoring.md)
- [Composing Components](./creating-and-consuming/composing.md)
- [Running Components](./creating-and-consuming/running.md)
- [Distributing and Fetching Components and WIT](./creating-and-consuming/distributing.md)
- [Tutorial](./tutorial.md)

Expand Down
31 changes: 0 additions & 31 deletions component-model/src/creating-and-consuming/running.md
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does mdbook give us a way to keep a redirect here, just in case?

Also, I again have a bit of a concern re signposting. The "creating and consuming" section provides a kind of journey of I write my component and I compose it with other components and then I run it and then I publish it. And removing this leaves a gap. The reader now needs to know that "how do I run my component" lives in the "Runtime Support" section, the title of which feels like it's going to be a list of caveats and feature comparisons for different runtimes rather than "this is how you make your component go."

This file was deleted.

4 changes: 2 additions & 2 deletions component-model/src/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ The WebAssembly Component Model is a broad-reaching architecture for building in
| Understanding components | Building components | Using components |
|--------------------------|----------------------|-------------------|
| [Why Components?] | [C/C++] | [Composing] |
| [Components] | [C#] | [Running] |
| [Interfaces] | [Go] | [Distributing] |
| [Components] | [C#] | [Distributing] |
| [Interfaces] | [Go] | |
| [Worlds] | [JavaScript] | |
| | [Python] | |
| | [Rust] | |
Expand Down
3 changes: 1 addition & 2 deletions component-model/src/language-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,4 @@ working with WebAssembly modules and components.
You can "run" a component by calling one of its exports. Hosts and runtimes often only support
running components with certain exports. The [`wasmtime`](https://github.com/bytecodealliance/wasmtime) CLI can only run "command" components, so in
order to run the `add` function above, it first must be composed with a primary "command" component
that calls it. See [documentation on running components](./creating-and-consuming/running.md) for
more details.
that calls it. See [documentation on running components](./runtimes/wasmtime.md) for more details.
10 changes: 10 additions & 0 deletions component-model/src/runtimes/wasmtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,13 @@ Try out building and running HTTP components with one of these tutorials
1. [Hello WASI HTTP tutorial](https://github.com/sunfishcode/hello-wasi-http) - build and serve a simple Rust-based HTTP component

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

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


As an example, if your component exports a function `add` which takes two numeric arguments, you can make use of this feature with the following command.

`wasmtime run --invoke 'foo(1, 2)' <path-to-wasm-file>`

Make sure to wrap your invocation in single quotes abd 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).