@@ -42,14 +42,14 @@ To expand the exercise to add more components, add another operator world, expan
4242
4343## Building and running the example
4444
45- Use [ ` cargo-component ` ] ( https://github.com/bytecodealliance/cargo-component ) and [ ` wac ` ] ( https://github.com/bytecodealliance/wac ) to build and compose the calculator component.
45+ Use [ ` wac ` ] ( https://github.com/bytecodealliance/wac ) to build and compose the calculator component.
4646
4747``` sh
48- (cd calculator && cargo component build --release)
49- (cd adder && cargo component build --release)
50- (cd command && cargo component build --release)
51- wac plug calculator/target/wasm32-wasip1 /release/calculator.wasm --plug adder/target/wasm32-wasip1 /release/adder.wasm -o composed.wasm
52- wac plug command/target/wasm32-wasip1 /release/command.wasm --plug composed.wasm -o final.wasm
48+ (cd calculator && cargo build --target=wasm32-wasip2 --release)
49+ (cd adder && cargo build --target=wasm32-wasip2 --release)
50+ (cd command && cargo build --target=wasm32-wasip2 --release)
51+ wac plug calculator/target/wasm32-wasip2 /release/calculator.wasm --plug adder/target/wasm32-wasip2 /release/adder.wasm -o composed.wasm
52+ wac plug command/target/wasm32-wasip2 /release/command.wasm --plug composed.wasm -o final.wasm
5353```
5454
5555Now, run the component with Wasmtime:
@@ -67,9 +67,9 @@ wasmtime run final.wasm 1 2 add
6767
6868``` sh
6969mkdir -p deps/docs
70- cp adder/target/wasm32-wasip1 /release/adder.wasm deps/docs/adder-impl.wasm
71- cp calculator/target/wasm32-wasip1 /release/calculator.wasm deps/docs/calculator-impl.wasm
72- cp command/target/wasm32-wasip1 /release/command.wasm deps/docs/command-impl.wasm
70+ cp adder/target/wasm32-wasip2 /release/adder.wasm deps/docs/adder-impl.wasm
71+ cp calculator/target/wasm32-wasip2 /release/calculator.wasm deps/docs/calculator-impl.wasm
72+ cp command/target/wasm32-wasip2 /release/command.wasm deps/docs/command-impl.wasm
7373```
7474
7575Now we are ready to construct a WAC file to define our composition. Ours instantiates our three components, declaring
@@ -84,12 +84,12 @@ package example:composition;
8484let adder-instance = new docs:adder-impl { };
8585
8686// Instantiate the calculator-impl component that implements the calculator world.
87- // In the `new` expression, specify the source of the `add` import to be `adder-instance`'s `add` export.
87+ // In the `new` expression, specify the source of the `add` import to be `adder-instance`'s `add` export.
8888let calculator-instance = new docs:calculator-impl { add: adder-instance.add };
8989
9090// Instantiate a command-impl component that implements the app world.
91- // The command component might import other interfaces, such as WASI interfaces, but we want to leave
92- // those as imports in the final component, so supply `...` to allow those other imports to remain unresolved.
91+ // The command component might import other interfaces, such as WASI interfaces, but we want to leave
92+ // those as imports in the final component, so supply `...` to allow those other imports to remain unresolved.
9393// The command's exports (in this case, `wasi:cli/run`) remain unaffected in the resulting instance.
9494let command-instance = new docs:command-impl { calculate: calculator-instance.calculate,... };
9595
@@ -101,12 +101,12 @@ export command-instance["wasi:cli/run@0.2.0"];
101101Now, perform your composition by passing the WAC file to ` wac compose ` .
102102
103103``` sh
104- wac compose composition.wac -o final.wasm
104+ wac compose composition.wac -o final.wasm
105105```
106106
107107> Note, instead of moving all the components to a ` deps/docs ` directory, you can pass the paths to the components inline
108108> ``` sh
109- > wac compose --dep docs:adder-impl=./adder/target/wasm32-wasip1 /release/adder.wasm --dep docs:calculator-impl=./calculator/target/wasm32-wasip1 /release/calculator.wasm --dep docs:command-impl=./command/target/wasm32-wasip1 /release/command.wasm -o final.wasm composition.wac
109+ > wac compose --dep docs:adder-impl=./adder/target/wasm32-wasip2 /release/adder.wasm --dep docs:calculator-impl=./calculator/target/wasm32-wasip2 /release/calculator.wasm --dep docs:command-impl=./command/target/wasm32-wasip2 /release/command.wasm -o final.wasm composition.wac
110110> ` ` `
111111
112112Run the component with Wasmtime:
0 commit comments