Skip to content

Commit 49ce239

Browse files
committed
Allow full semver in versions
1 parent 4ebc4bb commit 49ce239

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

design/mvp/Binary.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,15 @@ id ::= len:<u32> n:<id-chars> => n (if len = |n
335335
336336
id-chars ::= ns:<label> ':' pkg:<label> '/' n:<label> v:<id-version> => ns:pkg/nv
337337
id-version ::= => ϵ
338-
| '@' major+:[0x30-0x39] '.' minor+:[0x30-0x39] => char(major)+.char(minor)+
338+
| '@' version:<version> pre:<verpre> build:<verbuild> => version pre build
339+
340+
version ::= major:<num> '.' minor:<num> '.' patch:<num> => major.minor.patch
341+
version-number ::= digit+:[0x30-0x39] => char(digit)+
342+
343+
verpre ::= => ϵ
344+
| '-' (a:<label> '.') b:<label> => -(a.*)b
345+
verbuild ::= => ϵ
346+
| '+' (a:<label> '.') b:<label> => +(a.*)b
339347
```
340348

341349
Notes:

design/mvp/WIT.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ package suitable for distribution.
2929

3030
## Package identifiers
3131

32-
All WIT packages are assigned an "ID". IDs look like `foo:[email protected]` and have
32+
All WIT packages are assigned an "ID". IDs look like `foo:[email protected].0` and have
3333
three components:
3434

3535
* A namespace, for example `foo` in `foo:bar`. This namespace is intended to
@@ -40,10 +40,7 @@ three components:
4040
together a set of interfaces and worlds that would otherwise be named with a
4141
common prefix.
4242

43-
* An optional version, specified as a major and minor number. Because WIT
44-
packages define *interfaces*, not *implementations*, there is not a patch
45-
number, as in full semver. Both version numbers must be unsigned integers.
46-
Note that the version field is optional, though.
43+
* An optional version, specified as [full semver](https://semver.org/).
4744

4845
Package identifiers are specified at the top of a WIT file via a `package`
4946
declaration:
@@ -55,7 +52,7 @@ package wasi:clocks
5552
or
5653

5754
```wit
58-
package wasi:[email protected]
55+
package wasi:[email protected].0
5956
```
6057

6158
WIT packages can be defined in a collection of files and at least one of them
@@ -369,12 +366,12 @@ so far it can get a bit repetitive to be referred to:
369366
package local:demo
370367
371368
interface my-interface {
372-
use wasi:http/[email protected].{request, response}
369+
use wasi:http/[email protected].0.{request, response}
373370
}
374371
375372
world my-world {
376-
import wasi:http/[email protected]
377-
export wasi:http/[email protected]
373+
import wasi:http/[email protected].0
374+
export wasi:http/[email protected].0
378375
}
379376
```
380377

@@ -386,8 +383,8 @@ rewritten as:
386383
```wit
387384
package local:demo
388385
389-
use wasi:http/[email protected]
390-
use wasi:http/[email protected]
386+
use wasi:http/[email protected].0
387+
use wasi:http/[email protected].0
391388
392389
interface my-interface {
393390
use types.{request, response}
@@ -428,8 +425,8 @@ multiple versions and renaming as different identifiers.
428425
```wit
429426
package local:demo
430427
431-
use wasi:http/[email protected] as http-types1
432-
use wasi:http/[email protected] as http-types2
428+
use wasi:http/[email protected].0 as http-types1
429+
use wasi:http/[email protected].0 as http-types2
433430
434431
// ...
435432
```
@@ -731,7 +728,10 @@ WIT files optionally start with a package declaration which defines the ID of
731728
the package.
732729

733730
```ebnf
734-
package-decl ::= 'package' id ':' id ('@' integer '.' integer)?
731+
package-decl ::= 'package' id ':' id ('@' version)?
732+
version ::= integer '.' integer '.' integer version-pre-release? version-build?
733+
version-pre-release ::= '-' (id '.')* id
734+
version-build ::= '+' (id '.')* id
735735
```
736736

737737
Note that the version, specified with `@`, is optional. Otherwise the first `id`

0 commit comments

Comments
 (0)