bytecodealliance / bytecodealliance/wasm-tools

wasm-compose: non-interface exports

Open
#1,187 0 comments 1 reaction 0 assignees View on GitHub
wasm-compose
Dominant language
Rust
Stars
1.8k
Forks
351
Avg merge
16h 57m
Merged PRs (30d)
38

Description

Currently when using wasm-compose with a WIT definition that has non-interface imports or exports, this gives an error like:

```
Caused by:
component `obj/wasm-tools.component.wasm` has a non-instance import named `string-encoding`
```

even when composing in entirely unrelated exports that are interfaces (wasi virt).

The exact WIT for the above case is:

```
package local:wasm-tools

world wasm-tools {
enum string-encoding {
utf8,
utf16,
compact-utf16
}

type producers-fields = list>>>

/// Embed a WIT type into a component.
/// Only a singular WIT document without use resolutions is supported for this API.
record embed-opts {
binary: option>,
/// Pass an inline WIT source
wit-source: option,
/// Pass the file system path to WIT file
wit-path: option,
string-encoding: option,
dummy: option,
%world: option,
metadata: option
}

export component-embed: func(embed-opts: embed-opts) -> result, string>
}
```

Perhaps short of full composition support, it should be possible to at least support "pass through" of these kinds of WIT features to enable more WASI-Virt use cases.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.