1#![feature(min_specialization)]
9#![feature(arbitrary_self_types)]
10#![feature(arbitrary_self_types_pointers)]
11
12use anyhow::{Context, Result};
13use turbo_rcstr::RcStr;
14use turbo_tasks::Vc;
15use turbo_tasks_hash::HashAlgorithm;
16use turbopack_core::asset::Asset;
17
18pub(crate) mod analysis;
19pub(crate) mod loader;
20pub mod module_asset;
21pub(crate) mod output_asset;
22pub mod raw;
23pub mod source;
24
25#[turbo_tasks::function]
26pub async fn wasm_edge_var_name(asset: Vc<Box<dyn Asset>>) -> Result<Vc<RcStr>> {
27 let hash = asset
28 .content()
29 .content_hash(HashAlgorithm::Xxh3Hash128Hex)
30 .await?;
31 let hash = hash
32 .as_ref()
33 .context("Missing content when trying to generate the content hash for a WASM asset")?;
34 Ok(Vc::cell(format!("wasm_{}", hash).into()))
35}