1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! WIT emission for the component artifact.
//!
//! Per the component contract (`docs/wasip2.md` point 5), every
//! `.component.wasm` we emit ships a sibling `.wit` whose contents
//! are the human-readable view of the import / export surface.
//!
//! Phase 1.2a transitional: emits an empty world in the `aver:user`
//! package. The wasm-gc core's `_start` and any internal exports
//! become private to the component (not surfaced through the world).
//! Phase 1.2b switches the body to `include wasi:cli/command@0.2.4;`
//! once the wasm-gc backend exports a matching `wasi:cli/run`. The
//! WASI WIT bundle that backs the include is already vendored under
//! `wit/wasi-0.2.4/` and loaded by `wasi_bundle::push_wasi_packages`.
//!
//! WIT emission is by inline `format!` while the surface is small
//! and template-shaped. Add `wit-encoder` (structured builder) only
//! if per-effect imports beyond the standard WASI worlds need it.
use Wasip2World;
/// Emit the WIT source that pairs with the component bytes. The
/// emitted source is also parsed by `wrap.rs` to build the
/// `component-type:<world>` metadata custom section, so this is the
/// single source of truth for what the component declares.
///
/// Phase 1 keeps the world body empty: Aver's effects do not yet
/// flow into WIT imports here. The wrap pipeline still validates
/// end-to-end on the empty world (component is a valid WASI 0.2
/// artifact, just with no public surface). Phase 1.2 turns this
/// into a meaningful world declaration.