Composes components with WAC (WebAssembly Compositions).
Types
use type wasm
from componentized:component/types@0.1.0
The bytes of a WebAssembly binary, a component unless stated otherwise.
list<u8>
use variant error-code
from componentized:component/types@0.1.0
An error from a call.
malformed:malformedA value cannot be parsed to its expected type.
not-component:option<string>A wasm that must be a component is not, e.g. a core module. Calls accepting multiple wasms name the one that is not a component.
not-found:option<string>The item does not exist, optionally naming it, e.g. a path, URL, reference or package.
other:option<string>Any other error, with an optional message.
type package-name
string
type dependencysince 0.1.0
A component, named by the package a WAC composition refers to it as.
tuple<package-name, wasm>
variant plansince 0.1.0
How to compose components.
wac:stringA WAC script.
Functions
plug: async func(
socket: wasm,
plugs: list<wasm>,
) -> result<wasm, error-code>since 0.1.0
Plugs the exports of each of plugs into the matching imports of socket, returning the
composed component.
compose: async func(
plan: plan,
dependencies: list<dependency>,
) -> result<wasm, error-code>since 0.1.0
Composes the dependencies as described by plan, returning the composed component.
WIT
/// Composes components with WAC (WebAssembly Compositions).
@since(version = 0.1.0)
interface wac-loader {
use types.{wasm, error-code};
type package-name = string;
/// A component, named by the package a WAC composition refers to it as.
@since(version = 0.1.0)
type dependency = tuple<package-name, wasm>;
/// How to compose components.
@since(version = 0.1.0)
variant plan {
/// A WAC script.
wac(string),
}
/// Plugs the exports of each of `plugs` into the matching imports of `socket`, returning the
/// composed component.
@since(version = 0.1.0)
plug: async func(socket: wasm, plugs: list<wasm>) -> result<wasm, error-code>;
/// Composes the `dependencies` as described by `plan`, returning the composed component.
@since(version = 0.1.0)
compose: async func(plan: plan, dependencies: list<dependency>) -> result<wasm, error-code>;
}