# Keep the full WIT output as evidence, then check every declared import. def main [] { let repo = ($env.FILE_PWD | path dirname | path dirname) let artifacts = ($repo | path join userland target tools wasm32-wasip2 release) let evidence = (^mktemp -d --tmpdir=/tmp t14-imports.XXXXXXXX) for tool in [rg grep find xargs sed diffutils fd jaq env timeout] { let wasm = ($artifacts | path join $"($tool).wasm") let wit = (^wasm-tools component wit $wasm) $wit | save ($evidence | path join $"($tool).wit") let imports = ($wit | lines | where {|line| $line | str starts-with ' import ' }) for import in $imports { let allowed = ($import | str starts-with ' import wasi:') or (($tool in [find xargs env timeout]) and ($import | str starts-with ' import sausage:process/host@0.1.0;')) if not $allowed { error make {msg: $"Unexpected import: ($tool): ($import)"} } } print $"PASS imports ($tool): ((ls $wasm | get size | first | into int)) bytes" } print $"Full WIT evidence: ($evidence)" }