bytecodealliance / bytecodealliance/wasm-tools

`package hello:wasm/subpackage@1.0.0` doesn't work

Open
#2,277 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.8k
Forks
351
Avg merge
16h 57m
Merged PRs (30d)
38

Description

In the WIT.md from https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md#package-declaration it seems to indicate that you can have package identifiers like this:

```wit
package hello:wasm/subpackage@1.0.0;
```

> ```ebnf
> package-decl ::= 'package' ( id ':' )+ id ( '/' id )* ('@' valid-semver)?
> ```

but that doesn't work with any of the wasm-tools or other tooling right now.

To reproduce:

1. create a wit folder
2. create wit/whatever.wit
3. add this code to it: `package hello:wasm/subpackage@1.0.0;`
4. try to `wasm-tools component wit ./wit`
5. it fails

```
error: failed to parse package: wit

Caused by:
0: expected '{', found `/`
--> wit/hello.wit:1:19
|
1 | package hello:wasm/subpackage@1.0.0;
| ^
```

☝ this same error pops up with `wkg wit fetch`, the vscode syntax highlighter, etc.

i don't know if it's the WIT.md that's wrong or the wit parser in this wasm-tools project or me understanding it incorrectly 😅

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.