Skip to content

wasm-compose: non-interface exports #1187

Open
@guybedford

Description

@guybedford

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<tuple<string, list<tuple<string, string>>>>

  /// 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<list<u8>>,
    /// Pass an inline WIT source
    wit-source: option<string>,
    /// Pass the file system path to WIT file
    wit-path: option<string>,
    string-encoding: option<string-encoding>,
    dummy: option<bool>,
    %world: option<string>,
    metadata: option<producers-fields>
  }

  export component-embed: func(embed-opts: embed-opts) -> result<list<u8>, 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wasm-composeIssues related to the `wasm-compose` crate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions