Skip to content

Commit 14ff6ca

Browse files
feat(compose): enable all features during component validation (#2354)
This commit enables all wasm features (i.e. `WasmFeatures`) for the `wasm-tools compose` subcommand, so newer components with enabled features (e.g. p3 async components) can be composed. While wasm-tools compose is deprecated in favor of wac, it is currently the only composition tool of the two that supports p3.
1 parent 1cba20d commit 14ff6ca

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/bin/wasm-tools/compose.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use anyhow::{Context, Result};
44
use clap::Parser;
55
use std::path::{Path, PathBuf};
66
use wasm_compose::{composer::ComponentComposer, config::Config};
7-
use wasmparser::Validator;
7+
use wasmparser::{Validator, WasmFeatures};
88

99
/// WebAssembly component composer.
1010
///
@@ -68,13 +68,15 @@ impl Opts {
6868
if config.skip_validation {
6969
log::debug!("output validation was skipped");
7070
} else {
71-
Validator::new().validate_all(&bytes).with_context(|| {
72-
let output = match self.output.output_path() {
73-
Some(s) => format!(" `{}`", s.display()),
74-
None => String::new(),
75-
};
76-
format!("failed to validate output component{output}")
77-
})?;
71+
Validator::new_with_features(WasmFeatures::all())
72+
.validate_all(&bytes)
73+
.with_context(|| {
74+
let output = match self.output.output_path() {
75+
Some(s) => format!(" `{}`", s.display()),
76+
None => String::new(),
77+
};
78+
format!("failed to validate output component{output}")
79+
})?;
7880

7981
log::debug!("output component validated successfully");
8082
}

0 commit comments

Comments
 (0)