-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add docs for extended wit dep fetching
Signed-off-by: Victor Adossi <[email protected]>
- Loading branch information
1 parent
af5bc44
commit da76e17
Showing
1 changed file
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,7 +93,89 @@ See the [`build` docs](https://github.com/wasmCloud/wasmCloud/tree/main/crates/w | |
| html_target | string | `./html` | Directory to output HTML | | ||
| codegen_config | string | `.` | Path to codegen.toml file | | ||
|
||
### Overrides config - `[overrides]` | ||
### WIT dependency fetch/pull configuration - `[registry].pull` | ||
|
||
When fetching or pulling [WIT][wit] interfaces (e.g. [`wasi:keyvalue`][wasi-keyvalue], [`wasi:http`][wasi-http]), it can be useful to provide and/or override default sources. | ||
This effect can be achieved with the `pull` member of the `[registry]` configuration section in `wasmcloud.toml`. | ||
|
||
Configuration for `[registry].pull` can be specified as a TOML table, as in the following example `wasmcloud.toml`: | ||
|
||
```toml | ||
name = "example-component" | ||
language = "rust" | ||
type = "component" | ||
|
||
[component] | ||
wasm_target = "wasm32-wasip2" | ||
|
||
[registry.pull] | ||
sources = [ | ||
{ target = "wasmcloud:bus", source = "oci://ghcr.io/wasmcloud/targets" }, | ||
{ target = "test-components:testing", source = "file://extra-wit/pingpong.wit" }, | ||
{ target = "wasi:config", source = "https://github.com/WebAssembly/wasi-config/archive/v0.2.0-draft.tar.gz" }, | ||
{ target = "wasi:blobstore", source = "git+https://github.com/WebAssembly/wasi-blobstore.git" }, | ||
{ target = "wasi:messaging", source = "git+ssh://github.com/WebAssembly/wasi-messaging.git" }, | ||
] | ||
``` | ||
|
||
Configuration for `registry.pull` can also be specified as a TOML array of tables, as in the following *equivalent* `wasmcloud.toml`: | ||
|
||
```toml | ||
name = "example-component" | ||
language = "rust" | ||
type = "component" | ||
|
||
[component] | ||
wasm_target = "wasm32-wasip2" | ||
|
||
[[registry.pull.sources]] | ||
target = "wasmcloud:bus" | ||
source = "oci://ghcr.io/wasmcloud/targets" | ||
|
||
[[registry.pull.sources]] | ||
target = "test-components:testing" | ||
source = "file://extra-wit/pingpong.wit" | ||
|
||
[[registry.pull.sources]] | ||
target = "wasi:config" | ||
source = "https://github.com/WebAssembly/wasi-config/archive/v0.2.0-draft.tar.gz" | ||
|
||
[[registry.pull.sources]] | ||
target = "wasi:blobstore" | ||
source = "git+https://github.com/WebAssembly/wasi-blobstore.git" | ||
|
||
[[registry.pull.sources]] | ||
target = "wasi:messaging" | ||
source = "git+ssh://github.com/WebAssembly/wasi-messaging.git" | ||
``` | ||
|
||
The two above configurations have an identical effect. | ||
|
||
The `target` used for an override can be at multiple levels: | ||
|
||
- Namespace (ex. `wasi`) | ||
- Package (ex. `wasi:config`) | ||
|
||
For advanced use cases, overrides can also be specified with versions like so: | ||
|
||
```toml | ||
[[registry.pull.sources]] | ||
target = "wasi:[email protected]" | ||
source = "git+ssh://github.com/WebAssembly/wasi-messaging.git" | ||
``` | ||
|
||
[wit]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md | ||
[wasi-keyvalue]: https://github.com/WebAssembly/wasi-keyvalue | ||
[wasi-http]: https://github.com/WebAssembly/wasi-http | ||
|
||
### Overrides config (local files only) - `[overrides]` | ||
|
||
:::warning[deprecated] | ||
The `[overrides]` section differs from `[registry].pull` in that it only intended for *local file based overrides*. The `[registry].pull` supports overriding OCI registries, | ||
files, and other sources for WIT packages. | ||
|
||
While projects that use `[overrides]` will continue to work, consider migrating to use `[registry].pull`. | ||
::: | ||
|
||
Overrides are key-value pairs that can be used to override locations of wit dependencies. The key name should match the package reference without a version (e.g. `wasi:http`). | ||
|
||
|