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
//! `--target wasip2` — WASI 0.2 / Component Model output.
//!
//! Wraps a wasm-gc core module via `wit-component`. The core module
//! already imports canonical-ABI WIT functions (e.g. `wasi:cli/stdout`,
//! `wasi:filesystem/preopens`, `wasi:io/streams`) — there is no
//! preview-1 adapter, no shim layer; effects lower directly. Emits
//! `.component.wasm` plus a sibling `.wit`. Peer target with
//! `--target wasm-gc`, not a successor — the wasm-gc backend keeps
//! shipping for browsers / Workers / JS hosts via `aver/*` host
//! imports; `wasip2` is for wasmtime / Spin / NGINX Unit / wasmCloud
//! / every Component Model host via canonical WIT imports.
//!
//! Shipped in 0.18 "Span" — see `docs/wasip2.md` for the full
//! seven-point contract this module enforces and the effect map.
//!
//! # Architectural assumption
//!
//! GC values do not cross the component boundary. The component
//! contract guarantees per-instantiation `Map<K, V>` / `List<T>` /
//! `Vector<T>` / records / variants stay inside the user core
//! module; the public WIT surface uses canonical types only. The
//! POC tests in `tests/wasip2_poc.rs` pin this — a core module
//! that uses `struct.new` / `struct.get` / `struct.set` internally
//! validates as a Component as long as the boundary stays
//! canonical.
//!
//! # Sub-modules
//!
//! - `error.rs` — typed error enum, source-side diagnostics.
//! - `wrap.rs` — `wit-component::ComponentEncoder` invocation. No
//! adapters: the core module already speaks canonical ABI.
//! - `wit.rs` — WIT source emission via inline `format!` since the
//! world body is small and template-like. Switches to
//! `wit-encoder` (structured builder) only if per-effect imports
//! beyond the standard WASI worlds force it.
//! - `wasi_bundle.rs` — vendored WASI 0.2.4 WIT package set,
//! embedded via `include_str!` and pushed into the per-build
//! `Resolve` so the user world can `include wasi:cli/command;`.
pub use ;
pub use Wasip2Error;
pub use ;