Skip to content

Commit 2f62f66

Browse files
committed
Implement a composition graph library.
This commit implements a composition graph library that will serve as the basis for how WAC does AST resolution in the near future. The inspiration comes from the existing `CompositionGraph` API in `wasm-compose`, except this API is more flexible, allowing a composition graph to define its own types, have explicit exports, and export any node in the graph. The type representation present in `wac-parser` has been extracted to its own crate, `wac-types`. It will be shared in the future between the parser and the graph library. As a result, a chunk of this new code is just copied out of `wac-parser`. Once the graph library is merged, a follow-up commit will eliminate the duplicated code and change `wac-parser` to resolve ASTs to a `CompositionGraph`.
1 parent 7b2f728 commit 2f62f66

21 files changed

Lines changed: 6580 additions & 11 deletions

File tree

Cargo.lock

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ registry = ["wac-resolver/registry", "indicatif"]
4747
[workspace.dependencies]
4848
wac-parser = { path = "crates/wac-parser", default-features = false }
4949
wac-resolver = { path = "crates/wac-resolver", default-features = false }
50+
wac-graph = { path = "crates/wac-graph" }
51+
wac-types = { path = "crates/wac-types" }
5052
wit-parser = "0.201.0"
5153
wasmparser = "0.201.0"
5254
wit-component = "0.201.0"
@@ -77,3 +79,4 @@ secrecy = "0.8.0"
7779
futures = "0.3.30"
7880
indicatif = "0.17.8"
7981
pretty_assertions = "1.4.0"
82+
petgraph = "0.6.4"

crates/wac-graph/Cargo.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[package]
2+
name = "wac-graph"
3+
description = "A library for defining, encoding, and decoding WebAssembly composition graphs."
4+
version = { workspace = true }
5+
edition = { workspace = true }
6+
authors = { workspace = true }
7+
license = { workspace = true }
8+
categories = { workspace = true }
9+
keywords = { workspace = true }
10+
repository = { workspace = true }
11+
12+
[dependencies]
13+
wac-types = { workspace = true }
14+
id-arena = { workspace = true }
15+
anyhow = { workspace = true }
16+
thiserror = { workspace = true }
17+
petgraph = { workspace = true }
18+
indexmap = { workspace = true }
19+
wasmparser = { workspace = true }
20+
semver = { workspace = true }
21+
serde = { workspace = true, optional = true }
22+
wasm-encoder = { workspace = true }
23+
log = { workspace = true }
24+
25+
[dev-dependencies]
26+
pretty_assertions = { workspace = true }
27+
wasmprinter = { workspace = true }
28+
wat = { workspace = true }
29+
serde = { workspace = true }
30+
serde_json = { workspace = true }
31+
32+
[features]
33+
serde = ["dep:serde", "wac-types/serde"]

0 commit comments

Comments
 (0)