Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Add support for "library" components which don't export `http_incoming`.
- Add non-shift adapter when user module is using wit-bindgen.
- Update to Wasmtime 39 ([#584](https://github.com/fastly/Viceroy/pull/584))
- Make "viceroy adapt" add "produced-by" metadata to its output. ([#586](https://github.com/fastly/Viceroy/pull/586))

## 0.16.4 (2026-01-26)

Expand Down
16 changes: 15 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ tracing-futures = { workspace = true }
url = { workspace = true }
wasmparser = { workspace = true }
wasm-encoder = { workspace = true }
# Disable the "serde" feature which we don't need.
wasm-metadata = { version = "0.244.0", default-features = false }
wit-component = { workspace = true }
wasmtime = { workspace = true }
wasmtime-wasi = { workspace = true }
Expand Down
16 changes: 15 additions & 1 deletion cli/tests/trap-test/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions src/adapt.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use anyhow::Context;

/// The full adapter.
const ADAPTER_BYTES: &[u8] = include_bytes!("../wasm_abi/data/viceroy-component-adapter.wasm");
const ADAPTER_NOSHIFT_BYTES: &[u8] =
Expand Down Expand Up @@ -56,6 +58,24 @@ pub fn adapt_bytes(bytes: &[u8]) -> anyhow::Result<Vec<u8>> {
.validate(true)
.encode()?;

// Add "viceroy" to the producers section.
let mut producers = wasm_metadata::Producers::empty();
let mut flags = Vec::with_capacity(2);
if library {
flags.push("library");
}
if needs_no_shift_adapter {
flags.push("noshift");
}
producers.add(
"processed-by",
"viceroy adapt",
&format!("{} ({})", env!("CARGO_PKG_VERSION"), flags.join(", ")),
);
let component = producers
.add_to_wasm(&component)
.context("failed to add viceroy producer metadata to wasm")?;

Ok(component)
}

Expand Down
Loading