Skip to content

Commit ae804f1

Browse files
author
Peter Huene
committed
wit-component: clean up type exports.
This commit refactors encoding in `wit-component` to only export types from the default interface and stop exporting types from instance types used in imports. It also makes "type only" encodings more explicit with `InterfaceEncoder` that will encode the types from a single interface only.
1 parent d31c4e3 commit ae804f1

File tree

6 files changed

+151
-138
lines changed

6 files changed

+151
-138
lines changed

crates/wit-component/src/cli.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
#![deny(missing_docs)]
44

55
use crate::{
6-
decode_interface_component, encoding::ComponentEncoder, InterfacePrinter, StringEncoding,
6+
decode_interface_component, ComponentEncoder, InterfaceEncoder, InterfacePrinter,
7+
StringEncoding,
78
};
89
use anyhow::{bail, Context, Result};
910
use clap::Parser;
@@ -146,9 +147,7 @@ impl WitToWasmApp {
146147

147148
let interface = parse_interface(None, &self.interface)?;
148149

149-
let encoder = ComponentEncoder::default()
150-
.interface(&interface)
151-
.types_only(true);
150+
let encoder = InterfaceEncoder::new(&interface).validate(true);
152151

153152
let bytes = encoder.encode().with_context(|| {
154153
format!(

0 commit comments

Comments
 (0)