From 820f25bde476f944ed4b7e84d9b95d799c00c26f Mon Sep 17 00:00:00 2001 From: Daniel Macovei Date: Wed, 14 Feb 2024 15:49:02 -0600 Subject: [PATCH] Depsolve client (#199) This PR adds three commands to the warg CLI, `dependencies`, `lock`, and `bundle` - `warg dependencies ` Recursively fetches based on occurrences of `unlocked-dep` in binaries, and pretty prints dependency tree in terminal with semver ranges - `warg lock ` Recursively fetches based on occurrences of `unlocked-dep` and creates a "locked component". This locked component naively pins semver versions and imports `locked-dep`s for those versions, and then instantiates each component with the instantiation arguments that it expects. Given pinned versions and integrity shas, this is intended to be easily reproducible. - `warg bundle ` An iteration on locking. For runtimes that are not registry aware (all at this time), a locked component is not executable. This uses the warg cache to replace `locked-dep` imports with the actual definitions of the components being referenced, producing an executable artifact. There are other import variants that are defined in the spec, that are not currently being used, but are planned to be used in the future. For more information on other available import use cases, see the [explainer](https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#import-and-export-definitions) --- Cargo.lock | 1774 ++++++++++++++++++++++++--- Cargo.toml | 19 +- crates/client/Cargo.toml | 9 + crates/client/src/depsolve.rs | 277 +++++ crates/client/src/lib.rs | 136 +- crates/client/src/version_util.rs | 335 +++++ crates/server/src/api/v1/package.rs | 2 +- src/bin/warg.rs | 10 +- src/commands.rs | 6 + src/commands/bundle.rs | 37 + src/commands/dependencies.rs | 191 +++ src/commands/lock.rs | 44 + tests/components/add.wat | 14 + tests/components/five.wat | 33 + tests/components/inc.wat | 33 + tests/components/meet.wat | 49 + tests/components/meet_bundled.wat | 201 +++ tests/components/meet_locked.wat | 74 ++ tests/depsolve.rs | 153 +++ 19 files changed, 3230 insertions(+), 167 deletions(-) create mode 100644 crates/client/src/depsolve.rs create mode 100644 crates/client/src/version_util.rs create mode 100644 src/commands/bundle.rs create mode 100644 src/commands/dependencies.rs create mode 100644 src/commands/lock.rs create mode 100644 tests/components/add.wat create mode 100644 tests/components/five.wat create mode 100644 tests/components/inc.wat create mode 100644 tests/components/meet.wat create mode 100644 tests/components/meet_bundled.wat create mode 100644 tests/components/meet_locked.wat create mode 100644 tests/depsolve.rs diff --git a/Cargo.lock b/Cargo.lock index fc7152f7..ed1d872d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,13 +2,22 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +dependencies = [ + "gimli 0.27.3", +] + [[package]] name = "addr2line" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ - "gimli", + "gimli 0.28.1", ] [[package]] @@ -29,6 +38,18 @@ dependencies = [ "opaque-debug", ] +[[package]] +name = "ahash" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.2" @@ -38,6 +59,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "ambient-authority" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9d4ee0d472d1cd2e28c97dfa124b3d8d992e10eb0a035f33f5d12e3a177ba3b" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -59,6 +86,15 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + [[package]] name = "anstream" version = "0.6.11" @@ -113,6 +149,18 @@ version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + [[package]] name = "async-broadcast" version = "0.5.1" @@ -125,13 +173,13 @@ dependencies = [ [[package]] name = "async-channel" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c" +checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" dependencies = [ "concurrent-queue", - "event-listener 4.0.3", - "event-listener-strategy", + "event-listener 5.0.0", + "event-listener-strategy 0.5.0", "futures-core", "pin-project-lite", ] @@ -217,7 +265,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" dependencies = [ "event-listener 4.0.3", - "event-listener-strategy", + "event-listener-strategy 0.4.0", "pin-project-lite", ] @@ -290,6 +338,17 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -319,7 +378,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "rustversion", - "serde", + "serde 1.0.196", "serde_json", "serde_path_to_error", "serde_urlencoded", @@ -370,12 +429,12 @@ version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ - "addr2line", + "addr2line 0.21.0", "cc", "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.32.2", "rustc-demangle", ] @@ -403,6 +462,15 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde 1.0.196", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -415,6 +483,15 @@ version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +[[package]] +name = "bitmaps" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +dependencies = [ + "typenum", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -474,6 +551,69 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +[[package]] +name = "cap-fs-ext" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58bc48200a1a0fa6fba138b1802ad7def18ec1cdd92f7b2a04e21f1bd887f7b9" +dependencies = [ + "cap-primitives", + "cap-std", + "io-lifetimes 1.0.11", + "windows-sys 0.48.0", +] + +[[package]] +name = "cap-primitives" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4b6df5b295dca8d56f35560be8c391d59f0420f72e546997154e24e765e6451" +dependencies = [ + "ambient-authority", + "fs-set-times", + "io-extras", + "io-lifetimes 1.0.11", + "ipnet", + "maybe-owned", + "rustix 0.37.27", + "windows-sys 0.48.0", + "winx 0.35.1", +] + +[[package]] +name = "cap-rand" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d25555efacb0b5244cf1d35833d55d21abc916fff0eaad254b8e2453ea9b8ab" +dependencies = [ + "ambient-authority", + "rand", +] + +[[package]] +name = "cap-std" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3373a62accd150b4fcba056d4c5f3b552127f0ec86d3c8c102d60b978174a012" +dependencies = [ + "cap-primitives", + "io-extras", + "io-lifetimes 1.0.11", + "rustix 0.37.27", +] + +[[package]] +name = "cap-time-ext" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e95002993b7baee6b66c8950470e59e5226a23b3af39fc59c47fe416dd39821a" +dependencies = [ + "cap-primitives", + "once_cell", + "rustix 0.37.27", + "winx 0.35.1", +] + [[package]] name = "cast" version = "0.3.0" @@ -486,6 +626,7 @@ version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ + "jobserver", "libc", ] @@ -497,15 +638,15 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" +checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", - "num-traits", - "serde", + "num-traits 0.2.18", + "serde 1.0.196", "wasm-bindgen", "windows-targets 0.52.0", ] @@ -518,7 +659,7 @@ checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" dependencies = [ "ciborium-io", "ciborium-ll", - "serde", + "serde 1.0.196", ] [[package]] @@ -548,9 +689,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.18" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" +checksum = "80c21025abd42669a92efc996ef13cfb2c5c627858421ea58d5c3b331a6c134f" dependencies = [ "clap_builder", "clap_derive", @@ -558,21 +699,21 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.18" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" +checksum = "458bf1f341769dfcf849846f65dffdf9146daa56bcd2a47cb4e1de9915567c99" dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim", + "strsim 0.11.0", ] [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" dependencies = [ "heck", "proc-macro2", @@ -582,9 +723,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "colorchoice" @@ -601,6 +742,22 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "config" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1b9d958c2b1368a663f05538fc1b5975adce1e19f435acceae987aceeeb369" +dependencies = [ + "lazy_static 1.4.0", + "nom", + "rust-ini", + "serde 1.0.196", + "serde-hjson", + "serde_json", + "toml 0.5.11", + "yaml-rust", +] + [[package]] name = "console" version = "0.15.8" @@ -608,7 +765,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" dependencies = [ "encode_unicode", - "lazy_static", + "lazy_static 1.4.0", "libc", "unicode-width", "windows-sys 0.52.0", @@ -636,6 +793,15 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +[[package]] +name = "cpp_demangle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" +dependencies = [ + "cfg-if", +] + [[package]] name = "cpufeatures" version = "0.2.12" @@ -645,6 +811,123 @@ dependencies = [ "libc", ] +[[package]] +name = "cranelift-bforest" +version = "0.97.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aae6f552c4c0ccfb30b9559b77bc985a387d998e1736cbbe6b14c903f3656cf" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-codegen" +version = "0.97.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95551de96900cefae691ce895ff2abc691ae3a0b97911a76b45faf99e432937b" +dependencies = [ + "bumpalo", + "cranelift-bforest", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-control", + "cranelift-entity", + "cranelift-isle", + "gimli 0.27.3", + "hashbrown 0.13.2", + "log", + "regalloc2", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.97.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36a3ad7b2bb03de3383f258b00ca29d80234bebd5130cb6ef3bae37ada5baab0" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.97.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915918fee4142c85fb04bafe0bcd697e2fd6c15a260301ea6f8d2ea332a30e86" + +[[package]] +name = "cranelift-control" +version = "0.97.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e447d548cd7f4fcb87fbd10edbd66a4f77966d17785ed50a08c8f3835483c8" +dependencies = [ + "arbitrary", +] + +[[package]] +name = "cranelift-entity" +version = "0.97.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d8ab3352a1e5966968d7ab424bd3de8e6b58314760745c3817c2eec3fa2f918" +dependencies = [ + "serde 1.0.196", +] + +[[package]] +name = "cranelift-frontend" +version = "0.97.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bffa38431f7554aa1594f122263b87c9e04abc55c9f42b81d37342ac44f79f0" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.97.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84cef66a71c77938148b72bf006892c89d6be9274a08f7e669ff15a56145d701" + +[[package]] +name = "cranelift-native" +version = "0.97.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f33c7e5eb446e162d2d10b17fe68e1f091020cc2e4e38b5501c21099600b0a1b" +dependencies = [ + "cranelift-codegen", + "libc", + "target-lexicon", +] + +[[package]] +name = "cranelift-wasm" +version = "0.97.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "632f7b64fa6a8c5b980eb6a17ef22089e15cb9f779f1ed3bd3072beab0686c09" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "itertools 0.10.5", + "log", + "smallvec", + "wasmparser 0.107.0", + "wasmtime-types", +] + +[[package]] +name = "crc32fast" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +dependencies = [ + "cfg-if", +] + [[package]] name = "criterion" version = "0.5.1" @@ -658,13 +941,13 @@ dependencies = [ "criterion-plot", "is-terminal", "itertools 0.10.5", - "num-traits", + "num-traits 0.2.18", "once_cell", "oorandom", "plotters", "rayon", "regex", - "serde", + "serde 1.0.196", "serde_derive", "serde_json", "tinytemplate", @@ -754,7 +1037,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim", + "strsim 0.10.0", "syn 2.0.48", ] @@ -788,6 +1071,15 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63dfa964fe2a66f3fde91fc70b267fe193d822c7e603e2a675a49a7f46ad3f49" +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "uuid", +] + [[package]] name = "der" version = "0.7.8" @@ -806,7 +1098,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", - "serde", + "serde 1.0.196", ] [[package]] @@ -894,7 +1186,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fc50de1d729b55dfbb03e2d2db846684e3ab585f4ee9cfc3c675d236f951888" dependencies = [ "diesel", - "serde", + "serde 1.0.196", "serde_json", ] @@ -936,13 +1228,52 @@ dependencies = [ "subtle", ] +[[package]] +name = "directories" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f51c5d4ddabd36886dd3e1438cb358cdcb0d7c499cb99cb4ac2e38e18b5cb210" +dependencies = [ + "dirs-sys 0.3.7", +] + +[[package]] +name = "directories-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +dependencies = [ + "dirs-sys 0.3.7", +] + [[package]] name = "dirs" version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" dependencies = [ - "dirs-sys", + "dirs-sys 0.4.1", +] + +[[package]] +name = "dirs-sys" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc", + "redox_users", + "winapi", ] [[package]] @@ -957,6 +1288,17 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + [[package]] name = "ecdsa" version = "0.16.9" @@ -973,9 +1315,9 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "elliptic-curve" @@ -1014,25 +1356,38 @@ dependencies = [ [[package]] name = "enumflags2" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5998b4f30320c9d93aed72f63af821bfdac50465b75428fce77b48ec482c3939" +checksum = "3278c9d5fb675e0a51dabcf4c0d355f692b064171535ba72361be1528a9d8e8d" dependencies = [ "enumflags2_derive", - "serde", + "serde 1.0.196", ] [[package]] name = "enumflags2_derive" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246" +checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4" dependencies = [ "proc-macro2", "quote", "syn 2.0.48", ] +[[package]] +name = "env_logger" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -1077,6 +1432,17 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "event-listener" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b72557800024fabbaa2449dd4bf24e37b93702d457a4d4f2b0dd1f0f039f20c1" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + [[package]] name = "event-listener-strategy" version = "0.4.0" @@ -1087,6 +1453,16 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "event-listener-strategy" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feedafcaa9b749175d5ac357452a9d41ea2911da598fde46ce1fe02c37751291" +dependencies = [ + "event-listener 5.0.0", + "pin-project-lite", +] + [[package]] name = "fallible-iterator" version = "0.2.0" @@ -1108,6 +1484,17 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +[[package]] +name = "fd-lock" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e5768da2206272c81ef0b5e951a41862938a6070da63bcea197899942d3b947" +dependencies = [ + "cfg-if", + "rustix 0.38.31", + "windows-sys 0.52.0", +] + [[package]] name = "ff" version = "0.13.0" @@ -1118,6 +1505,16 @@ dependencies = [ "subtle", ] +[[package]] +name = "file-per-thread-logger" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a3cc21c33af89af0930c8cae4ade5e6fdc17b5d2c97b3d2e2edb67a1cf683f3" +dependencies = [ + "env_logger", + "log", +] + [[package]] name = "finl_unicode" version = "1.2.0" @@ -1161,14 +1558,25 @@ dependencies = [ ] [[package]] -name = "futures" -version = "0.3.30" +name = "fs-set-times" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "6d167b646a876ba8fda6b50ac645cfd96242553cbaf0ca4fccaa39afcbf0801f" dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", + "io-lifetimes 1.0.11", + "rustix 0.38.31", + "windows-sys 0.48.0", +] + +[[package]] +name = "futures" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", "futures-io", "futures-sink", "futures-task", @@ -1277,6 +1685,28 @@ dependencies = [ "slab", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "fxprof-processed-profile" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" +dependencies = [ + "bitflags 2.4.2", + "debugid", + "fxhash", + "serde 1.0.196", + "serde_json", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -1299,6 +1729,17 @@ dependencies = [ "wasi", ] +[[package]] +name = "gimli" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +dependencies = [ + "fallible-iterator", + "indexmap 1.9.3", + "stable_deref_trait", +] + [[package]] name = "gimli" version = "0.28.1" @@ -1328,7 +1769,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.11", - "indexmap 2.2.2", + "indexmap 2.2.3", "slab", "tokio", "tokio-util", @@ -1347,7 +1788,7 @@ dependencies = [ "futures-sink", "futures-util", "http 1.0.0", - "indexmap 2.2.2", + "indexmap 2.2.3", "slab", "tokio", "tokio-util", @@ -1370,6 +1811,15 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + [[package]] name = "hashbrown" version = "0.14.3" @@ -1384,9 +1834,18 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.5" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" +checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" [[package]] name = "hex" @@ -1495,6 +1954,12 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "hyper" version = "0.14.28" @@ -1612,6 +2077,20 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "im-rc" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1955a75fa080c677d3972822ec4bad316169ab1cfc6c257a942c2265dbe5fe" +dependencies = [ + "bitmaps", + "rand_core", + "rand_xoshiro", + "sized-chunks", + "typenum", + "version_check", +] + [[package]] name = "indexmap" version = "1.9.3" @@ -1620,18 +2099,18 @@ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown 0.12.3", - "serde", + "serde 1.0.196", ] [[package]] name = "indexmap" -version = "2.2.2" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", "hashbrown 0.14.3", - "serde", + "serde 1.0.196", ] [[package]] @@ -1643,17 +2122,33 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "io-extras" +version = "0.17.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fde93d48f0d9277f977a333eca8313695ddd5301dc96f7e02aeddcb0dd99096f" +dependencies = [ + "io-lifetimes 1.0.11", + "windows-sys 0.48.0", +] + [[package]] name = "io-lifetimes" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.6", "libc", "windows-sys 0.48.0", ] +[[package]] +name = "io-lifetimes" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a611371471e98973dbcab4e0ec66c31a10bc356eeb4d54a0e05eac8158fe38c" + [[package]] name = "ipnet" version = "2.9.0" @@ -1662,12 +2157,12 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ - "hermit-abi", - "rustix 0.38.31", + "hermit-abi 0.3.6", + "libc", "windows-sys 0.52.0", ] @@ -1704,6 +2199,35 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +[[package]] +name = "ittapi" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a5c0b993601cad796222ea076565c5d9f337d35592f8622c753724f06d7271" +dependencies = [ + "anyhow", + "ittapi-sys", + "log", +] + +[[package]] +name = "ittapi-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7b5e473765060536a660eed127f758cf1a810c73e49063264959c60d1727d9" +dependencies = [ + "cc", +] + +[[package]] +name = "jobserver" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.68" @@ -1720,13 +2244,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1be8bc4c6b6e9d85ecdad090fcf342a9216f53d747a537cc05e3452fd650ca46" dependencies = [ "byteorder", - "lazy_static", + "lazy_static 1.4.0", "linux-keyutils", "secret-service", "security-framework", "windows-sys 0.52.0", ] +[[package]] +name = "lazy_static" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" + [[package]] name = "lazy_static" version = "1.4.0" @@ -1739,6 +2269,19 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" +[[package]] +name = "lexical-core" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" +dependencies = [ + "arrayvec", + "bitflags 1.3.2", + "cfg-if", + "ryu", + "static_assertions", +] + [[package]] name = "libc" version = "0.2.153" @@ -1756,6 +2299,12 @@ dependencies = [ "redox_syscall", ] +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "linux-keyutils" version = "0.2.4" @@ -1826,6 +2375,15 @@ dependencies = [ "logos-codegen", ] +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + [[package]] name = "matchers" version = "0.1.0" @@ -1841,6 +2399,12 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +[[package]] +name = "maybe-owned" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" + [[package]] name = "md-5" version = "0.10.6" @@ -1857,6 +2421,15 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +[[package]] +name = "memfd" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" +dependencies = [ + "rustix 0.38.31", +] + [[package]] name = "memoffset" version = "0.7.1" @@ -1866,6 +2439,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +dependencies = [ + "autocfg", +] + [[package]] name = "memoffset" version = "0.9.0" @@ -1904,7 +2486,7 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f23f71580015254b020e856feac3df5878c2c7a8812297edd6c0a485ac9dada" dependencies = [ - "serde", + "serde 1.0.196", "toml 0.7.8", ] @@ -1967,7 +2549,7 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" dependencies = [ - "lazy_static", + "lazy_static 1.4.0", "libc", "log", "openssl", @@ -1991,6 +2573,17 @@ dependencies = [ "memoffset 0.7.1", ] +[[package]] +name = "nom" +version = "5.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08959a387a676302eebf4ddbcbc611da04285579f76f88ee0506c63b1a61dd4b" +dependencies = [ + "lexical-core", + "memchr", + "version_check", +] + [[package]] name = "normpath" version = "1.1.1" @@ -2021,7 +2614,7 @@ dependencies = [ "num-integer", "num-iter", "num-rational", - "num-traits", + "num-traits 0.2.18", ] [[package]] @@ -2032,7 +2625,7 @@ checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ "autocfg", "num-integer", - "num-traits", + "num-traits 0.2.18", ] [[package]] @@ -2041,7 +2634,7 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" dependencies = [ - "num-traits", + "num-traits 0.2.18", ] [[package]] @@ -2052,23 +2645,22 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", - "num-traits", + "num-traits 0.2.18", ] [[package]] name = "num-iter" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" dependencies = [ "autocfg", "num-integer", - "num-traits", + "num-traits 0.2.18", ] [[package]] @@ -2080,14 +2672,23 @@ dependencies = [ "autocfg", "num-bigint", "num-integer", - "num-traits", + "num-traits 0.2.18", ] [[package]] name = "num-traits" -version = "0.2.17" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" +dependencies = [ + "num-traits 0.2.18", +] + +[[package]] +name = "num-traits" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] @@ -2098,10 +2699,22 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.6", "libc", ] +[[package]] +name = "object" +version = "0.30.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" +dependencies = [ + "crc32fast", + "hashbrown 0.13.2", + "indexmap 1.9.3", + "memchr", +] + [[package]] name = "object" version = "0.32.2" @@ -2179,6 +2792,15 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +[[package]] +name = "ordered-float" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" +dependencies = [ + "num-traits 0.2.18", +] + [[package]] name = "ordered-stream" version = "0.2.0" @@ -2236,6 +2858,12 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + [[package]] name = "pathdiff" version = "0.2.1" @@ -2249,7 +2877,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1030c719b0ec2a2d25a5df729d6cff1acf3cc230bf766f4f97833591f7577b90" dependencies = [ "base64", - "serde", + "serde 1.0.196", ] [[package]] @@ -2276,7 +2904,7 @@ dependencies = [ "pbjson-build", "prost", "prost-build", - "serde", + "serde 1.0.196", ] [[package]] @@ -2301,7 +2929,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.2.2", + "indexmap 2.2.3", ] [[package]] @@ -2377,9 +3005,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "plotters" @@ -2387,7 +3015,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" dependencies = [ - "num-traits", + "num-traits 0.2.18", "plotters-backend", "plotters-svg", "wasm-bindgen", @@ -2631,6 +3259,42 @@ dependencies = [ "thiserror", ] +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + +[[package]] +name = "ptree" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0de80796b316aec75344095a6d2ef68ec9b8f573b9e7adc821149ba3598e270" +dependencies = [ + "ansi_term", + "atty", + "config", + "directories", + "petgraph", + "serde 1.0.196", + "serde-value", + "tint", +] + +[[package]] +name = "pulldown-cmark" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffade02495f22453cd593159ea2f59827aae7f53fa8323f756799b670881dcf8" +dependencies = [ + "bitflags 1.3.2", + "memchr", + "unicase", +] + [[package]] name = "quote" version = "1.0.35" @@ -2670,6 +3334,15 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core", +] + [[package]] name = "rayon" version = "1.8.1" @@ -2710,6 +3383,19 @@ dependencies = [ "thiserror", ] +[[package]] +name = "regalloc2" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" +dependencies = [ + "hashbrown 0.13.2", + "log", + "rustc-hash", + "slice-group-by", + "smallvec", +] + [[package]] name = "regex" version = "1.10.3" @@ -2779,7 +3465,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "rustls-pemfile", - "serde", + "serde 1.0.196", "serde_json", "serde_urlencoded", "sync_wrapper", @@ -2833,12 +3519,24 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rust-ini" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" + [[package]] name = "rustc-demangle" version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustix" version = "0.37.27" @@ -2847,9 +3545,11 @@ checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" dependencies = [ "bitflags 1.3.2", "errno", - "io-lifetimes", + "io-lifetimes 1.0.11", + "itoa", "libc", "linux-raw-sys 0.3.8", + "once_cell", "windows-sys 0.48.0", ] @@ -2958,7 +3658,7 @@ dependencies = [ "num", "once_cell", "rand", - "serde", + "serde 1.0.196", "sha2", "zbus", ] @@ -2992,9 +3692,15 @@ version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" dependencies = [ - "serde", + "serde 1.0.196", ] +[[package]] +name = "serde" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8" + [[package]] name = "serde" version = "1.0.196" @@ -3004,6 +3710,28 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-hjson" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a3a4e0ea8a88553209f6cc6cfe8724ecad22e1acf372793c27d995290fe74f8" +dependencies = [ + "lazy_static 1.4.0", + "num-traits 0.1.43", + "regex", + "serde 0.8.23", +] + +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde 1.0.196", +] + [[package]] name = "serde_derive" version = "1.0.196" @@ -3023,7 +3751,7 @@ checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", - "serde", + "serde 1.0.196", ] [[package]] @@ -3033,7 +3761,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebd154a240de39fdebcf5775d2675c204d7c13cf39a4c697be6493c8e734337c" dependencies = [ "itoa", - "serde", + "serde 1.0.196", ] [[package]] @@ -3053,7 +3781,7 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" dependencies = [ - "serde", + "serde 1.0.196", ] [[package]] @@ -3065,21 +3793,22 @@ dependencies = [ "form_urlencoded", "itoa", "ryu", - "serde", + "serde 1.0.196", ] [[package]] name = "serde_with" -version = "3.6.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b0ed1662c5a68664f45b76d18deb0e234aff37207086803165c961eb695e981" +checksum = "15d167997bd841ec232f5b2b8e0e26606df2e7caa4c31b95ea9ca52b200bd270" dependencies = [ "base64", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.2", - "serde", + "indexmap 2.2.3", + "serde 1.0.196", + "serde_derive", "serde_json", "serde_with_macros", "time", @@ -3087,9 +3816,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.6.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568577ff0ef47b879f736cd66740e022f3672788cdf002a05a4e609ea5a6fb15" +checksum = "865f9743393e638991566a8b7a479043c2c8da94a33e0a31f18214c9cae0a64d" dependencies = [ "darling", "proc-macro2", @@ -3097,6 +3826,19 @@ dependencies = [ "syn 2.0.48", ] +[[package]] +name = "serde_yaml" +version = "0.9.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adf8a49373e98a4c5f0ceb5d05aa7c648d75f63774981ed95b7c7443bbd50c6e" +dependencies = [ + "indexmap 2.2.3", + "itoa", + "ryu", + "serde 1.0.196", + "unsafe-libyaml", +] + [[package]] name = "sha1" version = "0.10.6" @@ -3119,13 +3861,26 @@ dependencies = [ "digest", ] +[[package]] +name = "sha256" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18278f6a914fa3070aa316493f7d2ddfb9ac86ebc06fa3b83bffda487e9065b0" +dependencies = [ + "async-trait", + "bytes", + "hex", + "sha2", + "tokio", +] + [[package]] name = "sharded-slab" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ - "lazy_static", + "lazy_static 1.4.0", ] [[package]] @@ -3134,6 +3889,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" +[[package]] +name = "shellexpand" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ccc8076840c4da029af4f87e4e8daeb0fca6b87bbb02e10cb60b791450e11e4" +dependencies = [ + "dirs 4.0.0", +] + [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -3159,6 +3923,16 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "sized-chunks" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +dependencies = [ + "bitmaps", + "typenum", +] + [[package]] name = "slab" version = "0.4.9" @@ -3168,6 +3942,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "slice-group-by" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" + [[package]] name = "smallvec" version = "1.13.1" @@ -3213,6 +3993,18 @@ dependencies = [ "der", ] +[[package]] +name = "sptr" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -3236,6 +4028,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strsim" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" + [[package]] name = "subtle" version = "2.5.0" @@ -3291,6 +4089,28 @@ dependencies = [ "libc", ] +[[package]] +name = "system-interface" +version = "0.25.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10081a99cbecbc363d381b9503563785f0b02735fccbb0d4c1a2cb3d39f7e7fe" +dependencies = [ + "bitflags 2.4.2", + "cap-fs-ext", + "cap-std", + "fd-lock", + "io-lifetimes 2.0.3", + "rustix 0.38.31", + "windows-sys 0.48.0", + "winx 0.36.3", +] + +[[package]] +name = "target-lexicon" +version = "0.12.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" + [[package]] name = "tempfile" version = "3.10.0" @@ -3303,6 +4123,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + [[package]] name = "testresult" version = "0.3.0" @@ -3311,18 +4140,18 @@ checksum = "52e045f5cf9ad69772c1c9652f5567a75df88bbb5a1310a64e53cab140c5c459" [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", @@ -3349,7 +4178,7 @@ dependencies = [ "itoa", "num-conv", "powerfmt", - "serde", + "serde 1.0.196", "time-core", "time-macros", ] @@ -3370,13 +4199,22 @@ dependencies = [ "time-core", ] +[[package]] +name = "tint" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7af24570664a3074673dbbf69a65bdae0ae0b72f2949b1adfbacb736ee4d6896" +dependencies = [ + "lazy_static 0.2.11", +] + [[package]] name = "tinytemplate" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" dependencies = [ - "serde", + "serde 1.0.196", "serde_json", ] @@ -3475,13 +4313,22 @@ dependencies = [ "tracing", ] +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde 1.0.196", +] + [[package]] name = "toml" version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" dependencies = [ - "serde", + "serde 1.0.196", "serde_spanned", "toml_datetime", "toml_edit 0.19.15", @@ -3493,10 +4340,10 @@ version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" dependencies = [ - "serde", + "serde 1.0.196", "serde_spanned", "toml_datetime", - "toml_edit 0.22.4", + "toml_edit 0.22.5", ] [[package]] @@ -3505,7 +4352,7 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ - "serde", + "serde 1.0.196", ] [[package]] @@ -3514,24 +4361,24 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.2", - "serde", + "indexmap 2.2.3", + "serde 1.0.196", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.22.4" +version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c9ffdf896f8daaabf9b66ba8e77ea1ed5ed0f72821b398aba62352e95062951" +checksum = "99e68c159e8f5ba8a28c4eb7b0c0c190d77bb479047ca713270048145a9ad28a" dependencies = [ - "indexmap 2.2.2", - "serde", + "indexmap 2.2.3", + "serde 1.0.196", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.6.1", ] [[package]] @@ -3714,6 +4561,12 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "unsafe-libyaml" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" + [[package]] name = "url" version = "2.5.0" @@ -3731,6 +4584,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "uuid" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" + [[package]] name = "valuable" version = "0.1.0" @@ -3779,7 +4638,7 @@ name = "warg-api" version = "0.4.0-dev" dependencies = [ "itertools 0.12.1", - "serde", + "serde 1.0.196", "serde_with", "thiserror", "warg-crypto", @@ -3791,17 +4650,21 @@ name = "warg-cli" version = "0.4.0-dev" dependencies = [ "anyhow", + "async-recursion", "async-trait", "bytes", "clap", "dialoguer", "futures", + "indexmap 2.2.3", "itertools 0.12.1", "keyring", "p256", + "ptree", "rand_core", "reqwest", "rpassword", + "semver", "serde_json", "testresult", "thiserror", @@ -3815,9 +4678,15 @@ dependencies = [ "warg-crypto", "warg-protocol", "warg-server", + "wasm-compose", + "wasm-encoder 0.41.2", + "wasmparser 0.121.2", + "wasmprinter", + "wasmtime", + "wasmtime-wasi", "wat", "wit-component", - "wit-parser", + "wit-parser 0.13.2", ] [[package]] @@ -3825,19 +4694,24 @@ name = "warg-client" version = "0.4.0-dev" dependencies = [ "anyhow", + "async-recursion", "async-trait", "bytes", "clap", - "dirs", + "dirs 5.0.1", "futures-util", + "indexmap 2.2.3", "itertools 0.12.1", "libc", "normpath", "once_cell", "pathdiff", + "ptree", "reqwest", - "serde", + "semver", + "serde 1.0.196", "serde_json", + "sha256", "tempfile", "thiserror", "tokio", @@ -3849,6 +4723,10 @@ dependencies = [ "warg-crypto", "warg-protocol", "warg-transparency", + "wasm-compose", + "wasm-encoder 0.41.2", + "wasmparser 0.121.2", + "wasmprinter", "windows-sys 0.52.0", ] @@ -3866,7 +4744,7 @@ dependencies = [ "pretty_assertions", "rand_core", "secrecy", - "serde", + "serde 1.0.196", "sha2", "signature", "thiserror", @@ -3885,7 +4763,7 @@ dependencies = [ "prost-types", "protox", "regex", - "serde", + "serde 1.0.196", "warg-crypto", ] @@ -3896,20 +4774,20 @@ dependencies = [ "anyhow", "base64", "hex", - "indexmap 2.2.2", + "indexmap 2.2.3", "pbjson-types", "pretty_assertions", "prost", "prost-types", "semver", - "serde", + "serde 1.0.196", "serde_json", "serde_with", "thiserror", "warg-crypto", "warg-protobuf", "warg-transparency", - "wasmparser", + "wasmparser 0.121.2", ] [[package]] @@ -3927,9 +4805,9 @@ dependencies = [ "diesel_json", "diesel_migrations", "futures", - "indexmap 2.2.2", + "indexmap 2.2.3", "secrecy", - "serde", + "serde 1.0.196", "serde_json", "tempfile", "thiserror", @@ -3945,7 +4823,7 @@ dependencies = [ "warg-crypto", "warg-protocol", "warg-transparency", - "wasmparser", + "wasmparser 0.121.2", ] [[package]] @@ -3968,6 +4846,50 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasi-cap-std-sync" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2fe3aaf51c1e1a04a490e89f0a9cab789d21a496c0ce398d49a24f8df883a58" +dependencies = [ + "anyhow", + "async-trait", + "cap-fs-ext", + "cap-rand", + "cap-std", + "cap-time-ext", + "fs-set-times", + "io-extras", + "io-lifetimes 1.0.11", + "is-terminal", + "once_cell", + "rustix 0.37.27", + "system-interface", + "tracing", + "wasi-common", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasi-common" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e74e9a2c8bfda59870a8bff38a31b9ba80b6fdb7abdfd2487177b85537d2e8a8" +dependencies = [ + "anyhow", + "bitflags 1.3.2", + "cap-rand", + "cap-std", + "io-extras", + "log", + "rustix 0.37.27", + "thiserror", + "tracing", + "wasmtime", + "wiggle", + "windows-sys 0.48.0", +] + [[package]] name = "wasm-bindgen" version = "0.2.91" @@ -4034,29 +4956,60 @@ version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" +[[package]] +name = "wasm-compose" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd324927af875ebedb1b820c00e3c585992d33c2c787c5021fe6d8982527359b" +dependencies = [ + "anyhow", + "heck", + "im-rc", + "indexmap 2.2.3", + "log", + "petgraph", + "serde 1.0.196", + "serde_derive", + "serde_yaml", + "smallvec", + "wasm-encoder 0.41.2", + "wasmparser 0.121.2", + "wat", +] + +[[package]] +name = "wasm-encoder" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18c41dbd92eaebf3612a39be316540b8377c871cb9bde6b064af962984912881" +dependencies = [ + "leb128", +] + [[package]] name = "wasm-encoder" -version = "0.41.0" +version = "0.41.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e09bca7d6388637d27fb5edbeab11f56bfabcef8743c55ae34370e1e5030a071" +checksum = "972f97a5d8318f908dded23594188a90bcd09365986b1163e66d70170e5287ae" dependencies = [ "leb128", + "wasmparser 0.121.2", ] [[package]] name = "wasm-metadata" -version = "0.10.17" +version = "0.10.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c853d3809fc9fccf3bc0ad63f4f51d8eefad0bacf88f957aa991c1d9b88b016e" +checksum = "18ebaa7bd0f9e7a5e5dd29b9a998acf21c4abed74265524dd7e85934597bfb10" dependencies = [ "anyhow", - "indexmap 2.2.2", - "serde", + "indexmap 2.2.3", + "serde 1.0.196", "serde_derive", "serde_json", "spdx", - "wasm-encoder", - "wasmparser", + "wasm-encoder 0.41.2", + "wasmparser 0.121.2", ] [[package]] @@ -4074,35 +5027,368 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.121.0" +version = "0.107.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953cf6a7606ab31382cb1caa5ae403e77ba70c7f8e12eeda167e7040d42bfda8" +checksum = "29e3ac9b780c7dda0cac7a52a5d6d2d6707cc6e3451c9db209b6c758f40d7acb" +dependencies = [ + "indexmap 1.9.3", + "semver", +] + +[[package]] +name = "wasmparser" +version = "0.121.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dbe55c8f9d0dbd25d9447a5a889ff90c0cc3feaa7395310d3d826b2c703eaab" dependencies = [ "bitflags 2.4.2", - "indexmap 2.2.2", + "indexmap 2.2.3", "semver", ] +[[package]] +name = "wasmprinter" +version = "0.2.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60e73986a6b7fdfedb7c5bf9e7eb71135486507c8fbc4c0c42cffcb6532988b7" +dependencies = [ + "anyhow", + "wasmparser 0.121.2", +] + +[[package]] +name = "wasmtime" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc104ced94ff0a6981bde77a0bc29aab4af279914a4143b8d1af9fd4b2c9d41" +dependencies = [ + "anyhow", + "async-trait", + "bincode", + "bumpalo", + "cfg-if", + "encoding_rs", + "fxprof-processed-profile", + "indexmap 1.9.3", + "libc", + "log", + "object 0.30.4", + "once_cell", + "paste", + "psm", + "rayon", + "serde 1.0.196", + "serde_json", + "target-lexicon", + "wasmparser 0.107.0", + "wasmtime-cache", + "wasmtime-component-macro", + "wasmtime-component-util", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-fiber", + "wasmtime-jit", + "wasmtime-runtime", + "wasmtime-winch", + "wat", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2b28e5661a9b5f7610a62ab3c69222fa161f7bd31d04529e856461d8c3e706b" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-cache" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f58ddfe801df3886feaf466d883ea37e941bcc6d841b9f644a08c7acabfe7f8" +dependencies = [ + "anyhow", + "base64", + "bincode", + "directories-next", + "file-per-thread-logger", + "log", + "rustix 0.37.27", + "serde 1.0.196", + "sha2", + "toml 0.5.11", + "windows-sys 0.48.0", + "zstd", +] + +[[package]] +name = "wasmtime-component-macro" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39725d9633fb064bd3a6d83c5ea5077289256de0862d3d96295822edb13419c0" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "syn 1.0.109", + "wasmtime-component-util", + "wasmtime-wit-bindgen", + "wit-parser 0.8.0", +] + +[[package]] +name = "wasmtime-component-util" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1153feafc824f95dc69472cb89a3396b3b05381f781a7508b01840f9df7b1a51" + +[[package]] +name = "wasmtime-cranelift" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fc1e39ce9aa0fa0b319541ed423960b06cfa7343eca1574f811ea34275739c2" +dependencies = [ + "anyhow", + "cranelift-codegen", + "cranelift-control", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "cranelift-wasm", + "gimli 0.27.3", + "log", + "object 0.30.4", + "target-lexicon", + "thiserror", + "wasmparser 0.107.0", + "wasmtime-cranelift-shared", + "wasmtime-environ", +] + +[[package]] +name = "wasmtime-cranelift-shared" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dd32739326690e51c76551d7cbf29d371e7de4dc7b37d2d503be314ab5b7d04" +dependencies = [ + "anyhow", + "cranelift-codegen", + "cranelift-control", + "cranelift-native", + "gimli 0.27.3", + "object 0.30.4", + "target-lexicon", + "wasmtime-environ", +] + +[[package]] +name = "wasmtime-environ" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b60e4ae5c9ae81750d8bc59110bf25444aa1d9266c19999c3b64b801db3c73" +dependencies = [ + "anyhow", + "cranelift-entity", + "gimli 0.27.3", + "indexmap 1.9.3", + "log", + "object 0.30.4", + "serde 1.0.196", + "target-lexicon", + "thiserror", + "wasm-encoder 0.29.0", + "wasmparser 0.107.0", + "wasmprinter", + "wasmtime-component-util", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-fiber" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd40c8d869916ee6b1f3fcf1858c52041445475ca8550aee81c684c0eb530ca" +dependencies = [ + "cc", + "cfg-if", + "rustix 0.37.27", + "wasmtime-asm-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-jit" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "655b23a10eddfe7814feb548a466f3f25aa4bb4f43098a147305c544a2de28e1" +dependencies = [ + "addr2line 0.19.0", + "anyhow", + "bincode", + "cfg-if", + "cpp_demangle", + "gimli 0.27.3", + "ittapi", + "log", + "object 0.30.4", + "rustc-demangle", + "rustix 0.37.27", + "serde 1.0.196", + "target-lexicon", + "wasmtime-environ", + "wasmtime-jit-debug", + "wasmtime-jit-icache-coherence", + "wasmtime-runtime", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e46b7e98979a69d3df093076bde8431204e3c96a770e8d216fea365c627d88a4" +dependencies = [ + "object 0.30.4", + "once_cell", + "rustix 0.37.27", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb1e7c68ede63dc7a98c3e473162954e224951854e229c8b4e74697fe17dbdd" +dependencies = [ + "cfg-if", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-runtime" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843e33bf9e0f0c57902c87a1dea1389cc23865c65f007214318dbdfcb3fd4ae5" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "encoding_rs", + "indexmap 1.9.3", + "libc", + "log", + "mach", + "memfd", + "memoffset 0.8.0", + "paste", + "rand", + "rustix 0.37.27", + "sptr", + "wasmtime-asm-macros", + "wasmtime-environ", + "wasmtime-fiber", + "wasmtime-jit-debug", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-types" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7473a07bebd85671bada453123e3d465c8e0a59668ff79f5004076e6a2235ef5" +dependencies = [ + "cranelift-entity", + "serde 1.0.196", + "thiserror", + "wasmparser 0.107.0", +] + +[[package]] +name = "wasmtime-wasi" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aff7b3b3272ad5b4ba63c9aac6248da6f06a8227d0c0d6017d89225d794e966c" +dependencies = [ + "anyhow", + "async-trait", + "bitflags 1.3.2", + "cap-fs-ext", + "cap-rand", + "cap-std", + "cap-time-ext", + "fs-set-times", + "io-extras", + "libc", + "rustix 0.37.27", + "system-interface", + "thiserror", + "tracing", + "wasi-cap-std-sync", + "wasi-common", + "wasmtime", + "wiggle", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-winch" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "351c9d4e60658dd0cf616c12c5508f86cc2cefcc0cff307eed0a31b23d3c0b70" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli 0.27.3", + "object 0.30.4", + "target-lexicon", + "wasmparser 0.107.0", + "wasmtime-cranelift-shared", + "wasmtime-environ", + "winch-codegen", +] + +[[package]] +name = "wasmtime-wit-bindgen" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f114407efbd09e4ef67053b6ae54c16455a821ef2f6096597fcba83b7625e59c" +dependencies = [ + "anyhow", + "heck", + "wit-parser 0.8.0", +] + [[package]] name = "wast" -version = "70.0.2" +version = "35.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3d5061300042ff5065123dae1e27d00c03f567d34a2937c8472255148a216dc" +checksum = "2ef140f1b49946586078353a453a1d28ba90adfc54dde75710bc1931de204d68" +dependencies = [ + "leb128", +] + +[[package]] +name = "wast" +version = "71.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "647c3ac4354da32688537e8fc4d2fe6c578df51896298cb64727d98088a1fd26" dependencies = [ "bumpalo", "leb128", "memchr", "unicode-width", - "wasm-encoder", + "wasm-encoder 0.41.2", ] [[package]] name = "wat" -version = "1.0.85" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afd7357b6cc46d46a2509c43dcb1dd4131dafbf4e75562d87017b5a05ffad2d6" +checksum = "b69c36f634411568a2c6d24828b674961e37ea03340fe1d605c337ed8162d901" dependencies = [ - "wast", + "wast 71.0.1", ] [[package]] @@ -4137,6 +5423,48 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wiggle" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63f150c6e39ef29a58139564c5ed7a0ef34d6df8a8eecd4233af85a576968d9" +dependencies = [ + "anyhow", + "async-trait", + "bitflags 1.3.2", + "thiserror", + "tracing", + "wasmtime", + "wiggle-macro", +] + +[[package]] +name = "wiggle-generate" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f31e961fb0a5ad3ff10689c85f327f4abf10b4cac033b9d7372ccbb106aea24" +dependencies = [ + "anyhow", + "heck", + "proc-macro2", + "quote", + "shellexpand", + "syn 1.0.109", + "witx", +] + +[[package]] +name = "wiggle-macro" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a28ae3d6b90f212beca7fab5910d0a3b1a171290c06eaa81bb39f41e6f74589" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "wiggle-generate", +] + [[package]] name = "winapi" version = "0.3.9" @@ -4168,6 +5496,22 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "winch-codegen" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1bf2ac354be169bb201de7867b84f45d91d0ef812f67f11c33f74a7f5a24e56" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli 0.27.3", + "regalloc2", + "smallvec", + "target-lexicon", + "wasmparser 0.107.0", + "wasmtime-environ", +] + [[package]] name = "windows-core" version = "0.52.0" @@ -4311,9 +5655,18 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.39" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5389a154b01683d28c77f8f68f49dea75f0a4da32557a58f68ee51ebba472d29" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d90f4e0f530c4c69f62b80d839e9ef3855edc9cba471a160c4d692deed62b401" dependencies = [ "memchr", ] @@ -4328,42 +5681,91 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "winx" +version = "0.35.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c52a121f0fbf9320d5f2a9a5d82f6cb7557eda5e8b47fc3e7f359ec866ae960" +dependencies = [ + "bitflags 1.3.2", + "io-lifetimes 1.0.11", + "windows-sys 0.48.0", +] + +[[package]] +name = "winx" +version = "0.36.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9643b83820c0cd246ecabe5fa454dd04ba4fa67996369466d0747472d337346" +dependencies = [ + "bitflags 2.4.2", + "windows-sys 0.52.0", +] + [[package]] name = "wit-component" -version = "0.20.1" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "331de496d439010797c17637d8002712b9b69110f1669164c09dfa226ad277bb" +checksum = "a4436190e87b4e539807bcdcf5b817e79d2e29e16bc5ddb6445413fe3d1f5716" dependencies = [ "anyhow", "bitflags 2.4.2", - "indexmap 2.2.2", + "indexmap 2.2.3", "log", - "serde", + "serde 1.0.196", "serde_derive", "serde_json", - "wasm-encoder", + "wasm-encoder 0.41.2", "wasm-metadata", - "wasmparser", - "wit-parser", + "wasmparser 0.121.2", + "wit-parser 0.13.2", ] [[package]] name = "wit-parser" -version = "0.13.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df4913a2219096373fd6512adead1fb77ecdaa59d7fc517972a7d30b12f625be" +checksum = "6daec9f093dbaea0e94043eeb92ece327bbbe70c86b1f41aca9bbfefd7f050f0" dependencies = [ "anyhow", "id-arena", - "indexmap 2.2.2", + "indexmap 1.9.3", "log", + "pulldown-cmark", "semver", - "serde", + "unicode-xid", + "url", +] + +[[package]] +name = "wit-parser" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "316b36a9f0005f5aa4b03c39bc3728d045df136f8c13a73b7db4510dec725e08" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.2.3", + "log", + "semver", + "serde 1.0.196", "serde_derive", "serde_json", "unicode-xid", ] +[[package]] +name = "witx" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e366f27a5cabcddb2706a78296a40b8fcc451e1a6aba2fc1d94b4a01bdaaef4b" +dependencies = [ + "anyhow", + "log", + "thiserror", + "wast 35.0.2", +] + [[package]] name = "xdg-home" version = "1.1.0" @@ -4374,6 +5776,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "yansi" version = "0.5.1" @@ -4408,7 +5819,7 @@ dependencies = [ "once_cell", "ordered-stream", "rand", - "serde", + "serde 1.0.196", "serde_repr", "sha1", "static_assertions", @@ -4441,17 +5852,66 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb80bb776dbda6e23d705cf0123c3b95df99c4ebeaec6c2599d4a5419902b4a9" dependencies = [ - "serde", + "serde 1.0.196", "static_assertions", "zvariant", ] +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "zeroize" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.9+zstd.1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" +dependencies = [ + "cc", + "pkg-config", +] + [[package]] name = "zvariant" version = "3.15.0" @@ -4461,7 +5921,7 @@ dependencies = [ "byteorder", "enumflags2", "libc", - "serde", + "serde 1.0.196", "static_assertions", "zvariant_derive", ] diff --git a/Cargo.toml b/Cargo.toml index cb0fb510..76444e47 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,9 @@ homepage = { workspace = true } repository = { workspace = true} [dependencies] +wasm-encoder = { workspace = true } +wasmparser = { workspace = true } +wasm-compose = { workspace = true } warg-crypto = { workspace = true } warg-protocol = { workspace = true } warg-client = { workspace = true } @@ -26,6 +29,17 @@ bytes = { workspace = true } p256 = { workspace = true } rand_core = { workspace = true } url = { workspace = true } +# TODO: remove these demo-related dependencies +wasmtime = "10.0" +wasmtime-wasi = "10.0" +reqwest.workspace = true +warg-api.workspace = true +ptree.workspace = true +async-recursion = "1.0.4" +indexmap.workspace = true +semver.workspace = true +wat = "1.0.85" +wasmprinter = "0.2.78" keyring = "2.3.0" dialoguer = "0.11.0" rpassword = "7.3.1" @@ -36,7 +50,7 @@ reqwest = { workspace = true } serde_json = { workspace = true } warg-server = { workspace = true } warg-api = { workspace = true } -wat = "1.0.85" +wat = "1.0.67" wit-component = "0.20.1" wit-parser = "0.13.1" testresult = "0.3.0" @@ -58,6 +72,7 @@ homepage = "https://warg.io/" repository = "https://github.com/bytecodealliance/registry" [workspace.dependencies] +ptree = "0.4.0" warg-api = { path = "crates/api", version = "0.4.0-dev" } warg-client = { path = "crates/client", version = "0.4.0-dev" } warg-crypto = { path = "crates/crypto", version = "0.4.0-dev" } @@ -121,6 +136,8 @@ diesel_migrations = "2.1.0" diesel-derive-enum = "2.1.0" chrono = "0.4.33" regex = "1" +wasm-encoder = "0.41.0" +wasm-compose = "0.5.2" wasmparser = "0.121.0" protox = "0.5.1" toml = "0.8.2" diff --git a/crates/client/Cargo.toml b/crates/client/Cargo.toml index d73c8b0b..3374e148 100644 --- a/crates/client/Cargo.toml +++ b/crates/client/Cargo.toml @@ -30,11 +30,20 @@ url = { workspace = true } libc = { workspace = true } tracing = { workspace = true } itertools = { workspace = true } +wasmparser = { workspace = true } +wasm-compose = { workspace = true } dirs = { workspace = true } once_cell = { workspace = true } walkdir = { workspace = true } normpath = { workspace = true } pathdiff = { workspace = true } +indexmap.workspace = true +async-recursion = "1.0.5" +semver.workspace = true +wasm-encoder.workspace = true +wasmprinter = "0.2.75" +sha256 = "1.4.0" +ptree = { workspace = true } [target.'cfg(windows)'.dependencies.windows-sys] version = "0.52" diff --git a/crates/client/src/depsolve.rs b/crates/client/src/depsolve.rs new file mode 100644 index 00000000..cb72c6e5 --- /dev/null +++ b/crates/client/src/depsolve.rs @@ -0,0 +1,277 @@ +use anyhow::{bail, Result}; +use async_recursion::async_recursion; +use indexmap::IndexSet; +use semver::VersionReq; +use std::fs; +use warg_protocol::package::{Release, ReleaseState}; +use warg_protocol::registry::PackageName; +use wasm_encoder::{ + Component, ComponentImportSection, ComponentSectionId, ComponentTypeRef, RawSection, +}; +use wasmparser::{Chunk, ComponentImportSectionReader, Parser, Payload}; + +use super::Client; +use crate::storage::{ContentStorage, PackageInfo, RegistryStorage}; +use crate::version_util::{DependencyImportParser, Import, ImportKind}; +/// Import Kinds found in components + +/// Creates list of dependenies for locking components +pub struct LockListBuilder { + /// List of deps to include in locked component + pub lock_list: IndexSet, +} + +impl Default for LockListBuilder { + /// New LockListBuilder + fn default() -> Self { + Self { + lock_list: IndexSet::new(), + } + } +} + +impl LockListBuilder { + fn parse_import( + &mut self, + parser: &ComponentImportSectionReader, + imports: &mut Vec, + ) -> Result<()> { + let clone = parser.clone(); + for import in clone.into_iter_with_offsets() { + let (_, imp) = import?; + imports.push(imp.name.0.to_string()); + } + Ok(()) + } + + #[async_recursion] + async fn parse_package( + &mut self, + client: &Client, + mut bytes: &[u8], + ) -> Result<()> { + let mut parser = Parser::new(0); + let mut imports: Vec = Vec::new(); + loop { + let payload = match parser.parse(bytes, true)? { + Chunk::NeedMoreData(_) => unreachable!(), + Chunk::Parsed { payload, consumed } => { + bytes = &bytes[consumed..]; + payload + } + }; + match payload { + Payload::ComponentImportSection(s) => { + self.parse_import(&s, &mut imports)?; + } + Payload::CodeSectionStart { + count: _, + range: _, + size: _, + } => { + parser.skip_section(); + } + Payload::ModuleSection { range, .. } => { + let offset = range.end - range.start; + if offset > bytes.len() { + bail!("invalid module or component section range"); + } + bytes = &bytes[offset..]; + } + Payload::ComponentSection { range, .. } => { + let offset = range.end - range.start; + if offset > bytes.len() { + bail!("invalid module or component section range"); + } + bytes = &bytes[offset..]; + } + Payload::End(_) => { + break; + } + _ => {} + } + } + for import in imports { + let mut resolver = DependencyImportParser { + next: &import, + offset: 0, + }; + + let import = resolver.parse()?; + match import.kind { + ImportKind::Locked(_) | ImportKind::Unlocked => { + let id = PackageName::new(import.name.clone())?; + if let Some(info) = client.registry().load_package(&id).await? { + let release = info.state.releases().last(); + if let Some(r) = release { + if let Some(bytes) = self.release_bytes(r, client)? { + self.parse_package(client, &bytes).await?; + } + } + self.lock_list.insert(import); + } else { + client.download(&id, &VersionReq::STAR).await?; + if let Some(info) = client.registry().load_package(&id).await? { + let release = info.state.releases().last(); + if let Some(r) = release { + if let Some(bytes) = self.release_bytes(r, client)? { + self.parse_package(client, &bytes).await?; + } + } + self.lock_list.insert(import); + } + } + } + ImportKind::Interface(_) => {} + } + } + Ok(()) + } + + fn release_bytes( + &self, + release: &Release, + client: &Client, + ) -> Result>> { + let state = &release.state; + if let ReleaseState::Released { content } = state { + let path = client.content().content_location(content); + if let Some(p) = path { + return Ok(Some(fs::read(p)?)); + } + } + Ok(None) + } + + /// List of deps for building + #[async_recursion] + pub async fn build_list( + &mut self, + client: &Client, + info: &PackageInfo, + ) -> Result<()> { + let release = info.state.releases().last(); + if let Some(r) = release { + let state = &r.state; + if let ReleaseState::Released { content } = state { + let path = client.content().content_location(content); + if let Some(p) = path { + let bytes = fs::read(p)?; + self.parse_package(client, &bytes).await?; + } + } + } + Ok(()) + } +} + +/// Bundles Dependencies +pub struct Bundler<'a, R, C> +where + R: RegistryStorage, + C: ContentStorage, +{ + /// Warg client used for bundling + client: &'a Client, +} + +impl<'a, R, C> Bundler<'a, R, C> +where + R: RegistryStorage, + C: ContentStorage, +{ + /// New Bundler + pub fn new(client: &'a Client) -> Self { + Self { client } + } + + async fn parse_imports( + &mut self, + parser: ComponentImportSectionReader<'a>, + component: &mut Component, + ) -> Result> { + let mut imports = ComponentImportSection::new(); + for import in parser.into_iter_with_offsets() { + let (_, imp) = import?; + let mut dep_parser = DependencyImportParser { + next: imp.name.0, + offset: 0, + }; + let parsed_imp = dep_parser.parse()?; + if !parsed_imp.name.contains('/') { + let pkg_id = PackageName::new(parsed_imp.name)?; + if let Some(info) = self.client.registry().load_package(&pkg_id).await? { + let release = if parsed_imp.req != VersionReq::STAR { + info.state + .releases() + .filter(|r| parsed_imp.req.matches(&r.version)) + .last() + } else { + info.state.releases().last() + }; + if let Some(r) = release { + let release_state = &r.state; + if let ReleaseState::Released { content } = release_state { + let path = self.client.content().content_location(content); + if let Some(p) = path { + let bytes = fs::read(p)?; + component.section(&RawSection { + id: ComponentSectionId::Component.into(), + data: &bytes, + }); + } + } + } + } + } else if let wasmparser::ComponentTypeRef::Instance(i) = imp.ty { + imports.import(imp.name.0, ComponentTypeRef::Instance(i)); + } + } + component.section(&imports); + Ok(Vec::new()) + } + + /// Parse bytes for bundling + pub async fn parse(&mut self, mut bytes: &'a [u8]) -> Result { + let constant = bytes; + let mut parser = Parser::new(0); + let mut component = Component::new(); + loop { + let payload = match parser.parse(bytes, true)? { + Chunk::NeedMoreData(_) => unreachable!(), + Chunk::Parsed { payload, consumed } => { + bytes = &bytes[consumed..]; + payload + } + }; + match payload { + Payload::ComponentImportSection(s) => { + self.parse_imports(s, &mut component).await?; + } + Payload::ModuleSection { range, .. } => { + let offset = range.end - range.start; + component.section(&RawSection { + id: 1, + data: &constant[range], + }); + if offset > bytes.len() { + panic!(); + } + bytes = &bytes[offset..]; + } + Payload::End(_) => { + break; + } + _ => { + if let Some((id, range)) = payload.as_section() { + component.section(&RawSection { + id, + data: &constant[range], + }); + } + } + } + } + Ok(component) + } +} diff --git a/crates/client/src/lib.rs b/crates/client/src/lib.rs index e3af19ec..996566b3 100644 --- a/crates/client/src/lib.rs +++ b/crates/client/src/lib.rs @@ -1,11 +1,13 @@ //! A client library for Warg component registries. #![deny(missing_docs)] - use crate::storage::PackageInfo; use anyhow::{anyhow, Context, Result}; use reqwest::{Body, IntoUrl}; +use semver::{Version, VersionReq}; use std::cmp::Ordering; +use std::fs; +use std::str::FromStr; use std::{borrow::Cow, collections::HashMap, path::PathBuf, time::Duration}; use storage::{ ContentStorage, FileSystemContentStorage, FileSystemRegistryStorage, PublishInfo, @@ -20,18 +22,24 @@ use warg_api::v1::{ }, proof::{ConsistencyRequest, InclusionRequest}, }; -use warg_crypto::{ - hash::{AnyHash, Sha256}, - signing, Encode, Signable, -}; +use warg_crypto::hash::Sha256; +use warg_crypto::{hash::AnyHash, signing, Encode, Signable}; +use warg_protocol::package::ReleaseState; use warg_protocol::{ operator, package, registry::{LogId, LogLeaf, PackageName, RecordId, RegistryLen, TimestampedCheckpoint}, - PublishedProtoEnvelope, SerdeEnvelope, Version, VersionReq, + PublishedProtoEnvelope, SerdeEnvelope, }; +use wasm_compose::graph::{CompositionGraph, EncodeOptions, ExportIndex, InstanceId}; pub mod api; mod config; +/// Tools for locking and bundling components +pub mod depsolve; +use depsolve::{Bundler, LockListBuilder}; +/// Tools for semver +pub mod version_util; +use version_util::{kindless_name, locked_package, versioned_package, Import, ImportKind}; pub mod lock; mod registry_url; pub mod storage; @@ -89,6 +97,112 @@ impl Client { .or(Err(ClientError::ClearContentCacheFailed)) } + /// Locks component + pub async fn lock_component(&self, info: &PackageInfo) -> ClientResult> { + let mut builder = LockListBuilder::default(); + builder.build_list(self, info).await?; + let top = Import { + name: format!("{}:{}", info.name.namespace(), info.name.name()), + req: VersionReq::STAR, + kind: ImportKind::Unlocked, + }; + builder.lock_list.insert(top); + let mut composer = CompositionGraph::new(); + let mut handled = HashMap::::new(); + for package in builder.lock_list { + let name = package.name.clone(); + let version = package.req; + let id = PackageName::new(name)?; + let info = self.registry().load_package(&id).await?; + if let Some(inf) = info { + let release = if version != VersionReq::STAR { + inf.state + .releases() + .filter(|r| version.matches(&r.version)) + .last() + } else { + inf.state.releases().last() + }; + + if let Some(r) = release { + let state = &r.state; + if let ReleaseState::Released { content } = state { + let locked_package = locked_package(&package.name, r, content); + let path = self.content().content_location(content); + if let Some(p) = path { + let bytes = fs::read(&p).map_err(|_| ClientError::ContentNotFound { + digest: content.clone(), + })?; + + let read_digest = + AnyHash::from_str(&format!("sha256:{}", sha256::digest(bytes))) + .unwrap(); + if content != &read_digest { + return Err(ClientError::IncorrectContent { + digest: read_digest, + expected: content.clone(), + }); + } + let component = + wasm_compose::graph::Component::from_file(&locked_package, p)?; + let component_id = if let Some((id, _)) = + composer.get_component_by_name(&locked_package) + { + id + } else { + composer.add_component(component)? + }; + let instance_id = composer.instantiate(component_id)?; + let added = composer.get_component(component_id); + handled.insert(versioned_package(&package.name, version), instance_id); + let mut args = Vec::new(); + if let Some(added) = added { + for (index, name, _) in added.imports() { + let iid = handled.get(kindless_name(name)); + if let Some(arg) = iid { + args.push((arg, index)); + } + } + } + for arg in args { + composer.connect( + *arg.0, + None::, + instance_id, + arg.1, + )?; + } + } + } + } + } + } + let final_name = &format!("{}:{}", info.name.namespace(), &info.name.name()); + let id = handled.get(final_name); + let options = EncodeOptions { + export: id.copied(), + ..Default::default() + }; + let locked = composer.encode(options)?; + fs::write("./locked.wasm", locked.as_slice()).map_err(|e| ClientError::Other(e.into()))?; + Ok(locked) + } + + /// Bundles component + pub async fn bundle_component(&self, info: &PackageInfo) -> ClientResult> { + let mut bundler = Bundler::new(self); + let path = PathBuf::from("./locked.wasm"); + let locked = if !path.is_file() { + self.lock_component(info).await? + } else { + fs::read("./locked.wasm").map_err(|e| ClientError::Other(e.into()))? + }; + let bundled = bundler.parse(&locked).await?; + fs::write("./bundled.wasm", bundled.as_slice()) + .map_err(|e| ClientError::Other(e.into()))?; + Ok(bundled.as_slice().to_vec()) + } + /// Submits the publish information in client storage. /// /// If there's no publishing information in client storage, an error is returned. @@ -373,6 +487,7 @@ impl Client { }) } + /// Update checkpoint for list of packages async fn update_checkpoint<'a>( &self, ts_checkpoint: &SerdeEnvelope, @@ -827,6 +942,15 @@ pub enum ClientError { digest: AnyHash, }, + /// Content digest was different than expected. + #[error("content with digest `{digest}` was not found expected `{expected}`")] + IncorrectContent { + /// The digest of the missing content. + digest: AnyHash, + /// The expected + expected: AnyHash, + }, + /// The package log is empty and cannot be validated. #[error("package log is empty and cannot be validated")] PackageLogEmpty { diff --git a/crates/client/src/version_util.rs b/crates/client/src/version_util.rs new file mode 100644 index 00000000..974a3a81 --- /dev/null +++ b/crates/client/src/version_util.rs @@ -0,0 +1,335 @@ +use anyhow::{bail, Result}; +use ptree::TreeBuilder; +use semver::{Comparator, Op, Prerelease, Version, VersionReq}; +use warg_crypto::hash::AnyHash; +use warg_protocol::package::Release; +use wasmparser::names::KebabStr; + +/// Kind of import encountered while parsing +#[derive(Debug, Eq, PartialEq, Hash)] +pub enum ImportKind { + /// Locked Version + Locked(Option), + /// Unlocked Version Range + Unlocked, + /// Interface + Interface(Option), +} + +/// Dependency in dep solve +#[derive(Debug, Eq, PartialEq, Hash)] +pub struct Import { + /// Import name + pub name: String, + /// Version Requirements + pub req: VersionReq, + /// Import kind + pub kind: ImportKind, +} + +/// Parser for dep solve deps +pub struct DependencyImportParser<'a> { + /// string to be parsed + pub next: &'a str, + /// index of parser + pub offset: usize, +} + +impl<'a> DependencyImportParser<'a> { + /// Parses import + pub fn parse(&mut self) -> Result { + if self.eat_str("unlocked-dep=") { + self.expect_str("<")?; + let imp = self.pkgidset_up_to('>')?; + self.expect_str(">")?; + return Ok(imp); + } + + if self.eat_str("locked-dep=") { + self.expect_str("<")?; + let imp = self.pkgver()?; + return Ok(imp); + } + + let name = self.eat_until('@'); + let v = self.semver(self.next)?; + let comp = Comparator { + op: semver::Op::Exact, + major: v.major, + minor: Some(v.minor), + patch: Some(v.patch), + pre: v.pre, + }; + let req = VersionReq { + comparators: vec![comp], + }; + Ok(Import { + name: name.unwrap().to_string(), + req, + kind: ImportKind::Interface(Some(self.next.to_string())), + }) + } + + fn eat_str(&mut self, prefix: &str) -> bool { + match self.next.strip_prefix(prefix) { + Some(rest) => { + self.next = rest; + true + } + None => false, + } + } + + fn expect_str(&mut self, prefix: &str) -> Result<()> { + if self.eat_str(prefix) { + Ok(()) + } else { + bail!(format!( + "expected `{prefix}` at `{}` at {}", + self.next, self.offset + )); + } + } + + fn eat_up_to(&mut self, c: char) -> Option<&'a str> { + let i = self.next.find(c)?; + let (a, b) = self.next.split_at(i); + self.next = b; + Some(a) + } + + fn eat_until(&mut self, c: char) -> Option<&'a str> { + let ret = self.eat_up_to(c); + if ret.is_some() { + self.next = &self.next[c.len_utf8()..]; + } + ret + } + + fn kebab(&self, s: &'a str) -> Result<&'a KebabStr> { + match KebabStr::new(s) { + Some(name) => Ok(name), + None => bail!(format!("`{s}` is not in kebab case at {}", self.offset)), + } + } + + fn take_until(&mut self, c: char) -> Result<&'a str> { + match self.eat_until(c) { + Some(s) => Ok(s), + None => bail!(format!("failed to find `{c}` character at {}", self.offset)), + } + } + + fn take_up_to(&mut self, c: char) -> Result<&'a str> { + match self.eat_up_to(c) { + Some(s) => Ok(s), + None => bail!(format!("failed to find `{c}` character at {}", self.offset)), + } + } + + fn semver(&self, s: &str) -> Result { + match Version::parse(s) { + Ok(v) => Ok(v), + Err(e) => bail!(format!( + "`{s}` is not a valid semver: {e} at {}", + self.offset + )), + } + } + + fn pkgver(&mut self) -> Result { + let namespace = self.take_until(':')?; + self.kebab(namespace)?; + let name = match self.eat_until('@') { + Some(name) => name, + // a:b + None => { + let name = self.take_up_to(',')?; + self.kebab(name)?; + return Ok(Import { + name: format!("{namespace}:{name}"), + req: VersionReq::STAR, + kind: ImportKind::Locked(None), + }); + } + }; + let version = self.eat_until('>'); + let req = if let Some(v) = version { + let v = self.semver(v)?; + let comp = Comparator { + op: semver::Op::Exact, + major: v.major, + minor: Some(v.minor), + patch: Some(v.patch), + pre: Prerelease::default(), + }; + VersionReq { + comparators: vec![comp], + } + } else { + VersionReq::STAR + }; + let digest = if self.eat_str(",") { + self.eat_until('<'); + self.eat_until('>').map(|d| d.to_string()) + } else { + None + }; + Ok(Import { + name: format!("{namespace}:{name}"), + req, + kind: ImportKind::Locked(digest), + }) + } + fn pkgidset_up_to(&mut self, end: char) -> Result { + let namespace = self.take_until(':')?; + self.kebab(namespace)?; + let name = match self.eat_until('@') { + Some(name) => name, + // a:b + None => { + let name = self.take_up_to(end)?; + self.kebab(name)?; + return Ok(Import { + name: format!("{namespace}:{name}"), + req: VersionReq::STAR, + kind: ImportKind::Unlocked, + }); + } + }; + self.kebab(name)?; + // a:b@* + if self.eat_str("*") { + return Ok(Import { + name: format!("{namespace}:{name}"), + req: VersionReq::STAR, + kind: ImportKind::Unlocked, + }); + } + self.expect_str("{")?; + if self.eat_str(">=") { + match self.eat_until(' ') { + Some(lower) => { + let lower = self.semver(lower)?; + self.expect_str("<")?; + let upper = self.take_until('}')?; + let upper = self.semver(upper)?; + let lc = Comparator { + op: semver::Op::GreaterEq, + major: lower.major, + minor: Some(lower.minor), + patch: Some(lower.patch), + pre: Prerelease::default(), + }; + let uc = Comparator { + op: semver::Op::Less, + major: upper.major, + minor: Some(upper.minor), + patch: Some(upper.patch), + pre: Prerelease::default(), + }; + let comparators = vec![lc, uc]; + return Ok(Import { + name: format!("{namespace}:{name}"), + req: VersionReq { comparators }, + kind: ImportKind::Unlocked, + }); + } + // a:b@{>=1.2.3} + None => { + let lower = self.take_until('}')?; + let lower = self.semver(lower)?; + let comparator = Comparator { + op: semver::Op::GreaterEq, + major: lower.major, + minor: Some(lower.minor), + patch: Some(lower.patch), + pre: Prerelease::default(), + }; + let comparators = vec![comparator]; + return Ok(Import { + name: format!("{namespace}:{name}"), + req: VersionReq { comparators }, + kind: ImportKind::Unlocked, + }); + } + } + } + + // a:b@{<1.2.3} + // .. or + // a:b@{<1.2.3 >=1.2.3} + self.expect_str("<")?; + let upper = self.take_until('}')?; + let upper = self.semver(upper)?; + let uc = Comparator { + op: semver::Op::Less, + major: upper.major, + minor: Some(upper.minor), + patch: Some(upper.patch), + pre: Prerelease::default(), + }; + let mut comparators: Vec = Vec::new(); + comparators.push(uc); + Ok(Import { + name: format!("{namespace}:{name}"), + req: VersionReq { comparators }, + kind: ImportKind::Unlocked, + }) + } +} + +/// Returns locked package string +pub fn locked_package(pkg_name: &str, release: &Release, content: &AnyHash) -> String { + format!( + "locked-dep=<{}@{}>,integrity=<{}>", + &pkg_name, + &release.version.to_string(), + &content.to_string().replace(':', "-") + ) +} + +/// Package name with version range +pub fn versioned_package(pkg_name: &str, version: VersionReq) -> String { + let ver = version.clone().to_string(); + let range = if ver == "*" { + "".to_string() + } else { + // @{ } + format!("@{{{}}}", ver.replace(',', "")) + }; + format!("{}{range}", pkg_name) +} + +/// Remove import kind from import beginning +pub fn kindless_name(import_name: &str) -> &str { + // unlocked-dep= --> + let kindless_name = import_name.splitn(2, '=').last().unwrap(); + // remove angle brackets + &kindless_name[1..kindless_name.len() - 1] +} + +/// Stringify version +pub fn version_string(version: &VersionReq) -> String { + if version.to_string() == "*" { + "*".to_string() + } else if version.comparators.len() == 1 && version.comparators[0].op == Op::Exact { + version.to_string() + } else { + format!("{{{}}}", version.to_string().replace(',', "")) + } +} + +/// Create TreeBuilder child node +pub fn create_child_node<'a>( + node: &'a mut TreeBuilder, + name: &str, + version: &str, +) -> &'a mut TreeBuilder { + node.begin_child(format!("{}@{}", name, version)) +} + +/// Create new TreeBuilder +pub fn new_tree(namespace: &str, name: &str, version: &Version) -> TreeBuilder { + TreeBuilder::new(format!("{}:{}@{}", namespace, name, version)) +} diff --git a/crates/server/src/api/v1/package.rs b/crates/server/src/api/v1/package.rs index a198c774..5759dab8 100644 --- a/crates/server/src/api/v1/package.rs +++ b/crates/server/src/api/v1/package.rs @@ -383,7 +383,7 @@ async fn upload_content( { config .core_service - .submit_package_record(log_id, record_id) + .submit_package_record(log_id, record_id.clone()) .await; } diff --git a/src/bin/warg.rs b/src/bin/warg.rs index 64bcf18f..33f68f62 100644 --- a/src/bin/warg.rs +++ b/src/bin/warg.rs @@ -3,8 +3,8 @@ use clap::Parser; use std::process::exit; use tracing_subscriber::EnvFilter; use warg_cli::commands::{ - ClearCommand, ConfigCommand, DownloadCommand, InfoCommand, KeyCommand, PublishCommand, - ResetCommand, UpdateCommand, + BundleCommand, ClearCommand, ConfigCommand, DependenciesCommand, DownloadCommand, InfoCommand, + KeyCommand, LockCommand, PublishCommand, ResetCommand, UpdateCommand, }; use warg_client::ClientError; @@ -25,6 +25,9 @@ enum WargCli { Config(ConfigCommand), Info(InfoCommand), Key(KeyCommand), + Lock(LockCommand), + Bundle(BundleCommand), + Dependencies(DependenciesCommand), Download(DownloadCommand), Update(UpdateCommand), #[clap(subcommand)] @@ -43,6 +46,9 @@ async fn main() -> Result<()> { WargCli::Config(cmd) => cmd.exec().await, WargCli::Info(cmd) => cmd.exec().await, WargCli::Key(cmd) => cmd.exec().await, + WargCli::Lock(cmd) => cmd.exec().await, + WargCli::Bundle(cmd) => cmd.exec().await, + WargCli::Dependencies(cmd) => cmd.exec().await, WargCli::Download(cmd) => cmd.exec().await, WargCli::Update(cmd) => cmd.exec().await, WargCli::Publish(cmd) => cmd.exec().await, diff --git a/src/commands.rs b/src/commands.rs index 263aaae5..0bfaee46 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -8,22 +8,28 @@ use warg_client::RegistryUrl; use warg_client::{ClientError, Config, FileSystemClient, StorageLockResult}; use warg_crypto::signing::PrivateKey; +mod bundle; mod clear; mod config; +mod dependencies; mod download; mod info; mod key; +mod lock; mod publish; mod reset; mod update; use crate::keyring::get_signing_key; +pub use self::bundle::*; pub use self::clear::*; pub use self::config::*; +pub use self::dependencies::*; pub use self::download::*; pub use self::info::*; pub use self::key::*; +pub use self::lock::*; pub use self::publish::*; pub use self::reset::*; pub use self::update::*; diff --git a/src/commands/bundle.rs b/src/commands/bundle.rs new file mode 100644 index 00000000..1b7aa5e8 --- /dev/null +++ b/src/commands/bundle.rs @@ -0,0 +1,37 @@ +use super::CommonOptions; +use anyhow::{bail, Result}; +use clap::Args; +use semver::VersionReq; +use warg_client::storage::RegistryStorage; +use warg_protocol::registry::PackageName; +/// Bundle With Registry Dependencies +#[derive(Args)] +pub struct BundleCommand { + /// The common command options. + #[clap(flatten)] + pub common: CommonOptions, + + /// Only show information for the specified package. + #[clap(value_name = "PACKAGE")] + pub package: PackageName, +} + +impl BundleCommand { + /// Executes the command. + pub async fn exec(self) -> Result<()> { + let config = self.common.read_config()?; + let client = self.common.create_client(&config)?; + println!("registry: {url}", url = client.url()); + if let Some(info) = client.registry().load_package(&self.package).await? { + client.bundle_component(&info).await?; + } else { + client.download(&self.package, &VersionReq::STAR).await?; + if let Some(info) = client.registry().load_package(&self.package).await? { + client.bundle_component(&info).await?; + } else { + bail!("Unable to find package {}", self.package.name()) + } + } + Ok(()) + } +} diff --git a/src/commands/dependencies.rs b/src/commands/dependencies.rs new file mode 100644 index 00000000..4dbbb7fb --- /dev/null +++ b/src/commands/dependencies.rs @@ -0,0 +1,191 @@ +use super::CommonOptions; +use anyhow::{bail, Result}; +use async_recursion::async_recursion; +use clap::Args; +use ptree::{output::print_tree, TreeBuilder}; +use std::fs; +use warg_client::{ + storage::{ContentStorage, PackageInfo, RegistryStorage}, + version_util::{ + create_child_node, new_tree, version_string, DependencyImportParser, ImportKind, + }, + FileSystemClient, +}; +use warg_protocol::{package::ReleaseState, registry::PackageName, VersionReq}; +use wasmparser::{Chunk, ComponentImport, ComponentImportSectionReader, Parser, Payload}; + +/// Print Dependency Tree +#[derive(Args)] +pub struct DependenciesCommand { + /// The common command options. + #[clap(flatten)] + pub common: CommonOptions, + + /// Only show information for the specified package. + #[clap(value_name = "PACKAGE")] + pub package: PackageName, +} + +impl DependenciesCommand { + /// Executes the command. + pub async fn exec(self) -> Result<()> { + let config = self.common.read_config()?; + let client = self.common.create_client(&config)?; + + if let Some(info) = client.registry().load_package(&self.package).await? { + Self::print_package_info(&client, &info).await?; + } + + Ok(()) + } + + #[async_recursion] + async fn parse_deps<'a>( + id: &'a PackageName, + version: VersionReq, + client: &FileSystemClient, + node: &mut TreeBuilder, + parser: &mut DepsParser, + ) -> Result<()> { + client.download(id, &version).await?; + + let package = client.registry().load_package(id).await?; + if let Some(pkg) = package { + let latest = pkg.state.releases().last(); + if let Some(l) = latest { + if let ReleaseState::Released { content } = &l.state { + let path = client.content().content_location(content); + if let Some(p) = path { + let bytes = fs::read(p)?; + let deps = parser.parse(&bytes)?; + for dep in deps { + let mut dep_parser = DependencyImportParser { + next: dep.name.0, + offset: 0, + }; + let dep = dep_parser.parse()?; + let v = version_string(&dep.req); + let grand_child = create_child_node(node, &dep.name, &v); + match dep.kind { + ImportKind::Locked(_) | ImportKind::Unlocked => { + let id = PackageName::new(dep.name)?; + Self::parse_deps(&id, dep.req, client, grand_child, parser) + .await?; + } + ImportKind::Interface(_) => {} + } + grand_child.end_child(); + } + } + } + } + } + Ok(()) + } + + async fn print_package_info(client: &FileSystemClient, info: &PackageInfo) -> Result<()> { + let mut parser = DepsParser::new(); + let root_package = client.registry().load_package(&info.name).await?; + if let Some(rp) = root_package { + let latest = rp.state.releases().last(); + if let Some(l) = latest { + client.download(&info.name, &VersionReq::STAR).await?; + let mut tree = new_tree(info.name.namespace(), info.name.name(), &l.version); + if let ReleaseState::Released { content } = &l.state { + let path = client.content().content_location(content); + if let Some(p) = path { + let bytes = fs::read(&p)?; + let deps = parser.parse(&bytes)?; + for dep in deps { + let mut dep_parser = DependencyImportParser { + next: dep.name.0, + offset: 0, + }; + let dep = dep_parser.parse()?; + let v = version_string(&dep.req); + let child = create_child_node(&mut tree, &dep.name, &v); + match dep.kind { + ImportKind::Locked(_) | ImportKind::Unlocked => { + Self::parse_deps( + &PackageName::new(dep.name)?, + dep.req, + client, + child, + &mut parser, + ) + .await?; + } + ImportKind::Interface(_) => {} + } + child.end_child(); + } + } + let built = tree.build(); + print_tree(&built)? + } + } + } + Ok(()) + } +} + +struct DepsParser {} + +impl DepsParser { + pub fn new() -> Self { + Self {} + } + + pub fn parse_imports<'a>( + &mut self, + parser: ComponentImportSectionReader<'a>, + deps: &mut Vec>, + ) -> Result<()> { + for import in parser.into_iter_with_offsets() { + let (_, imp) = import?; + deps.push(imp); + } + Ok(()) + } + + pub fn parse<'a>(&mut self, mut bytes: &'a [u8]) -> Result>> { + let mut parser = Parser::new(0); + let mut deps = Vec::new(); + loop { + let payload = match parser.parse(bytes, true)? { + Chunk::NeedMoreData(_) => unreachable!(), + Chunk::Parsed { payload, consumed } => { + bytes = &bytes[consumed..]; + payload + } + }; + match payload { + Payload::ComponentImportSection(s) => { + self.parse_imports(s, &mut deps)?; + } + Payload::CodeSectionStart { .. } => { + parser.skip_section(); + } + Payload::ModuleSection { range, .. } => { + let offset = range.end - range.start; + if offset > bytes.len() { + bail!("invalid module or component section range"); + } + bytes = &bytes[offset..]; + } + Payload::ComponentSection { range, .. } => { + let offset = range.end - range.start; + if offset > bytes.len() { + bail!("invalid module or component section range"); + } + bytes = &bytes[offset..]; + } + Payload::End(_) => { + break; + } + _ => {} + } + } + Ok(deps) + } +} diff --git a/src/commands/lock.rs b/src/commands/lock.rs new file mode 100644 index 00000000..57d6aa7c --- /dev/null +++ b/src/commands/lock.rs @@ -0,0 +1,44 @@ +use super::CommonOptions; +use anyhow::Result; +use clap::Args; +use semver::VersionReq; +use warg_client::{ + storage::{PackageInfo, RegistryStorage}, + FileSystemClient, +}; +use warg_protocol::registry::PackageName; + +/// Print Dependency Tree +#[derive(Args)] +pub struct LockCommand { + /// The common command options. + #[clap(flatten)] + pub common: CommonOptions, + + /// Only show information for the specified package. + #[clap(value_name = "PACKAGE")] + pub package: PackageName, +} + +impl LockCommand { + /// Executes the command. + pub async fn exec(self) -> Result<()> { + let config = self.common.read_config()?; + let client = self.common.create_client(&config)?; + println!("registry: {url}", url = client.url()); + if let Some(info) = client.registry().load_package(&self.package).await? { + Self::lock(client, &info).await?; + } else { + client.download(&self.package, &VersionReq::STAR).await?; + if let Some(info) = client.registry().load_package(&self.package).await? { + Self::lock(client, &info).await?; + } + } + Ok(()) + } + + async fn lock(client: FileSystemClient, info: &PackageInfo) -> Result<()> { + client.lock_component(info).await?; + Ok(()) + } +} diff --git a/tests/components/add.wat b/tests/components/add.wat new file mode 100644 index 00000000..52f09081 --- /dev/null +++ b/tests/components/add.wat @@ -0,0 +1,14 @@ +(component + (core module $numbers + (func (export "add") (param i32 i32) (result i32) + local.get 0 + local.get 1 + i32.add + ) + ) + (core instance $firstInstance (instantiate $numbers)) + (alias core export 0 "add" (core func)) + (type (func (param "left" u32) (param "right" u32) (result u32))) + (func (type 0) (canon lift (core func 0))) + (export "add" (func 0)) +) \ No newline at end of file diff --git a/tests/components/five.wat b/tests/components/five.wat new file mode 100644 index 00000000..3693d219 --- /dev/null +++ b/tests/components/five.wat @@ -0,0 +1,33 @@ +(component + (type (;0;) + (instance + (type (;0;) (func (param "left" u32) (param "right" u32) (result u32))) + (export (;0;) "add" (func (type 0))) + ) + ) + (import "unlocked-dep==1.0.0}>" (instance (;0;) (type 0))) + (alias export 0 "add" (func (;0;))) + (core func (;0;) (canon lower (func 0))) + (core module $numbers (;0;) + (type (;0;) (func (param i32 i32) (result i32))) + (type (;1;) (func (param i32) (result i32))) + (import "adder" "add" (func (;0;) (type 0))) + (func (;1;) (type 1) (param i32) (result i32) + local.get 0 + i32.const 5 + call 0 + ) + (export "both" (func 1)) + ) + (core instance (;0;) + (export "add" (func 0)) + ) + (core instance $firstInstance (;1;) (instantiate $numbers + (with "adder" (instance 0)) + ) + ) + (alias core export $firstInstance "both" (core func (;1;))) + (type (;1;) (func (param "input" u32) (result u32))) + (func (;1;) (type 1) (canon lift (core func 1))) + (export (;2;) "second" (func 1)) +) \ No newline at end of file diff --git a/tests/components/inc.wat b/tests/components/inc.wat new file mode 100644 index 00000000..91a81977 --- /dev/null +++ b/tests/components/inc.wat @@ -0,0 +1,33 @@ +(component + (type (;0;) + (instance + (type (;0;) (func (param "left" u32) (param "right" u32) (result u32))) + (export (;0;) "add" (func (type 0))) + ) + ) + (import "unlocked-dep==1.0.0}>" (instance (;0;) (type 0))) + (alias export 0 "add" (func (;0;))) + (core func (;0;) (canon lower (func 0))) + (core module $numbers (;0;) + (type (;0;) (func (param i32 i32) (result i32))) + (type (;1;) (func (param i32) (result i32))) + (import "adder" "add" (func (;0;) (type 0))) + (func (;1;) (type 1) (param i32) (result i32) + local.get 0 + i32.const 2 + call 0 + ) + (export "both" (func 1)) + ) + (core instance (;0;) + (export "add" (func 0)) + ) + (core instance $firstInstance (;1;) (instantiate $numbers + (with "adder" (instance 0)) + ) + ) + (alias core export $firstInstance "both" (core func (;1;))) + (type (;1;) (func (param "input" u32) (result u32))) + (func (;1;) (type 1) (canon lift (core func 1))) + (export (;2;) "first" (func 1)) +) \ No newline at end of file diff --git a/tests/components/meet.wat b/tests/components/meet.wat new file mode 100644 index 00000000..596a2e63 --- /dev/null +++ b/tests/components/meet.wat @@ -0,0 +1,49 @@ +(component + (type (;0;) + (instance + (type (;0;) (func (param "input" u32) (result u32))) + (export (;0;) "first" (func (type 0))) + ) + ) + (type (;1;) + (instance + (type (;0;) (func (param "input" u32) (result u32))) + (export (;0;) "second" (func (type 0))) + ) + ) + (import "unlocked-dep==1.0.0}>" (instance (;0;) (type 0))) + (import "unlocked-dep==1.0.0}>" (instance (;0;) (type 1))) + (alias export 0 "first" (func (;0;))) + (core func (;0;) (canon lower (func 0))) + (alias export 1 "second" (func (;1;))) + (core func (;1;) (canon lower (func 1))) + (core module $meet + (type (;0;) (func (param i32 ) (result i32))) + (type (;1;) (func (param i32 i32) (result i32))) + (import "firsty" "first" (func (;0;) (type 0))) + (import "secondy" "second" (func (;1;) (type 0))) + (func (;2;) (type 1) (param i32 i32) (result i32) + local.get 0 + call 0 + local.get 1 + call 1 + i32.add + ) + (export "full" (func 2)) + ) + (core instance (;0;) + (export "first" (func 0)) + ) + (core instance (;1;) + (export "second" (func 1)) + ) + (core instance $total (;1;) (instantiate $meet + (with "firsty" (instance 0)) + (with "secondy" (instance 1)) + ) + ) + (alias core export $total "full" (core func (;2;))) + (type (;2;) (func (param "left" u32) (param "right" u32) (result u32))) + (func (;1;) (type 2) (canon lift (core func 2))) + (export (;2;) "full" (func 2)) +) \ No newline at end of file diff --git a/tests/components/meet_bundled.wat b/tests/components/meet_bundled.wat new file mode 100644 index 00000000..ae36356f --- /dev/null +++ b/tests/components/meet_bundled.wat @@ -0,0 +1,201 @@ +(component + (type (;0;) + (component + (type (;0;) (func (param "left" u32) (param "right" u32) (result u32))) + (export (;0;) "add" (func (type 0))) + ) + ) + (component (;0;) + (core module $numbers (;0;) + (type (;0;) (func (param i32 i32) (result i32))) + (func (;0;) (type 0) (param i32 i32) (result i32) + local.get 0 + local.get 1 + i32.add + ) + (export "add" (func 0)) + ) + (core instance $firstInstance (;0;) (instantiate $numbers)) + (alias core export $firstInstance "add" (core func (;0;))) + (type (;0;) (func (param "left" u32) (param "right" u32) (result u32))) + (func (;0;) (type 0) (canon lift (core func 0))) + (export (;1;) "add" (func 0)) + ) + (type (;1;) + (component + (type (;0;) + (instance + (type (;0;) (func (param "left" u32) (param "right" u32) (result u32))) + (export (;0;) "add" (func (type 0))) + ) + ) + (import "unlocked-dep==1.0.0}>" (instance (;0;) (type 0))) + (type (;1;) (func (param "input" u32) (result u32))) + (export (;0;) "first" (func (type 1))) + ) + ) + (component (;1;) + (type (;0;) + (instance + (type (;0;) (func (param "left" u32) (param "right" u32) (result u32))) + (export (;0;) "add" (func (type 0))) + ) + ) + (import "unlocked-dep==1.0.0}>" (instance (;0;) (type 0))) + (alias export 0 "add" (func (;0;))) + (core func (;0;) (canon lower (func 0))) + (core module $numbers (;0;) + (type (;0;) (func (param i32 i32) (result i32))) + (type (;1;) (func (param i32) (result i32))) + (import "adder" "add" (func (;0;) (type 0))) + (func (;1;) (type 1) (param i32) (result i32) + local.get 0 + i32.const 2 + call 0 + ) + (export "both" (func 1)) + ) + (core instance (;0;) + (export "add" (func 0)) + ) + (core instance $firstInstance (;1;) (instantiate $numbers + (with "adder" (instance 0)) + ) + ) + (alias core export $firstInstance "both" (core func (;1;))) + (type (;1;) (func (param "input" u32) (result u32))) + (func (;1;) (type 1) (canon lift (core func 1))) + (export (;2;) "first" (func 1)) + ) + (type (;2;) + (component + (type (;0;) + (instance + (type (;0;) (func (param "left" u32) (param "right" u32) (result u32))) + (export (;0;) "add" (func (type 0))) + ) + ) + (import "unlocked-dep==1.0.0}>" (instance (;0;) (type 0))) + (type (;1;) (func (param "input" u32) (result u32))) + (export (;0;) "second" (func (type 1))) + ) + ) + (component (;2;) + (type (;0;) + (instance + (type (;0;) (func (param "left" u32) (param "right" u32) (result u32))) + (export (;0;) "add" (func (type 0))) + ) + ) + (import "unlocked-dep==1.0.0}>" (instance (;0;) (type 0))) + (alias export 0 "add" (func (;0;))) + (core func (;0;) (canon lower (func 0))) + (core module $numbers (;0;) + (type (;0;) (func (param i32 i32) (result i32))) + (type (;1;) (func (param i32) (result i32))) + (import "adder" "add" (func (;0;) (type 0))) + (func (;1;) (type 1) (param i32) (result i32) + local.get 0 + i32.const 5 + call 0 + ) + (export "both" (func 1)) + ) + (core instance (;0;) + (export "add" (func 0)) + ) + (core instance $firstInstance (;1;) (instantiate $numbers + (with "adder" (instance 0)) + ) + ) + (alias core export $firstInstance "both" (core func (;1;))) + (type (;1;) (func (param "input" u32) (result u32))) + (func (;1;) (type 1) (canon lift (core func 1))) + (export (;2;) "second" (func 1)) + ) + (type (;3;) + (component + (type (;0;) + (instance + (type (;0;) (func (param "input" u32) (result u32))) + (export (;0;) "first" (func (type 0))) + ) + ) + (import "unlocked-dep==1.0.0}>" (instance (;0;) (type 0))) + (type (;1;) + (instance + (type (;0;) (func (param "input" u32) (result u32))) + (export (;0;) "second" (func (type 0))) + ) + ) + (import "unlocked-dep==1.0.0}>" (instance (;1;) (type 1))) + (type (;2;) (func (param "left" u32) (param "right" u32) (result u32))) + (export (;0;) "full" (func (type 2))) + ) + ) + (component (;3;) + (type (;0;) + (instance + (type (;0;) (func (param "input" u32) (result u32))) + (export (;0;) "first" (func (type 0))) + ) + ) + (type (;1;) + (instance + (type (;0;) (func (param "input" u32) (result u32))) + (export (;0;) "second" (func (type 0))) + ) + ) + (import "unlocked-dep==1.0.0}>" (instance (;0;) (type 0))) + (import "unlocked-dep==1.0.0}>" (instance (;1;) (type 1))) + (alias export 0 "first" (func (;0;))) + (core func (;0;) (canon lower (func 0))) + (alias export 1 "second" (func (;1;))) + (core func (;1;) (canon lower (func 1))) + (core module $meet (;0;) + (type (;0;) (func (param i32) (result i32))) + (type (;1;) (func (param i32 i32) (result i32))) + (import "firsty" "first" (func (;0;) (type 0))) + (import "secondy" "second" (func (;1;) (type 0))) + (func (;2;) (type 1) (param i32 i32) (result i32) + local.get 0 + call 0 + local.get 1 + call 1 + i32.add + ) + (export "full" (func 2)) + ) + (core instance (;0;) + (export "first" (func 0)) + ) + (core instance (;1;) + (export "second" (func 1)) + ) + (core instance $total (;2;) (instantiate $meet + (with "firsty" (instance 0)) + (with "secondy" (instance 1)) + ) + ) + (alias core export $total "full" (core func (;2;))) + (type (;2;) (func (param "left" u32) (param "right" u32) (result u32))) + (func (;2;) (type 2) (canon lift (core func 2))) + (export (;3;) "full" (func 2)) + ) + (instance (;0;) (instantiate 0)) + (instance (;1;) (instantiate 1 + (with "unlocked-dep==1.0.0}>" (instance 0)) + ) + ) + (instance (;2;) (instantiate 2 + (with "unlocked-dep==1.0.0}>" (instance 0)) + ) + ) + (instance (;3;) (instantiate 3 + (with "unlocked-dep==1.0.0}>" (instance 1)) + (with "unlocked-dep==1.0.0}>" (instance 2)) + ) + ) + (alias export 3 "full" (func (;0;))) + (export (;1;) "full" (func 0)) +) \ No newline at end of file diff --git a/tests/components/meet_locked.wat b/tests/components/meet_locked.wat new file mode 100644 index 00000000..aca4251a --- /dev/null +++ b/tests/components/meet_locked.wat @@ -0,0 +1,74 @@ +(component + (type (;0;) + (component + (type (;0;) (func (param "left" u32) (param "right" u32) (result u32))) + (export (;0;) "add" (func (type 0))) + ) + ) + (import "locked-dep=,integrity=" (component (;0;) (type 0))) + (type (;1;) + (component + (type (;0;) + (instance + (type (;0;) (func (param "left" u32) (param "right" u32) (result u32))) + (export (;0;) "add" (func (type 0))) + ) + ) + (import "unlocked-dep==1.0.0}>" (instance (;0;) (type 0))) + (type (;1;) (func (param "input" u32) (result u32))) + (export (;0;) "first" (func (type 1))) + ) + ) + (import "locked-dep=,integrity=" (component (;1;) (type 1))) + (type (;2;) + (component + (type (;0;) + (instance + (type (;0;) (func (param "left" u32) (param "right" u32) (result u32))) + (export (;0;) "add" (func (type 0))) + ) + ) + (import "unlocked-dep==1.0.0}>" (instance (;0;) (type 0))) + (type (;1;) (func (param "input" u32) (result u32))) + (export (;0;) "second" (func (type 1))) + ) + ) + (import "locked-dep=,integrity=" (component (;2;) (type 2))) + (type (;3;) + (component + (type (;0;) + (instance + (type (;0;) (func (param "input" u32) (result u32))) + (export (;0;) "first" (func (type 0))) + ) + ) + (import "unlocked-dep==1.0.0}>" (instance (;0;) (type 0))) + (type (;1;) + (instance + (type (;0;) (func (param "input" u32) (result u32))) + (export (;0;) "second" (func (type 0))) + ) + ) + (import "unlocked-dep==1.0.0}>" (instance (;1;) (type 1))) + (type (;2;) (func (param "left" u32) (param "right" u32) (result u32))) + (export (;0;) "full" (func (type 2))) + ) + ) + (import "locked-dep=,integrity=" (component (;3;) (type 3))) + (instance (;0;) (instantiate 0)) + (instance (;1;) (instantiate 1 + (with "unlocked-dep==1.0.0}>" (instance 0)) + ) + ) + (instance (;2;) (instantiate 2 + (with "unlocked-dep==1.0.0}>" (instance 0)) + ) + ) + (instance (;3;) (instantiate 3 + (with "unlocked-dep==1.0.0}>" (instance 1)) + (with "unlocked-dep==1.0.0}>" (instance 2)) + ) + ) + (alias export 3 "full" (func (;0;))) + (export (;1;) "full" (func 0)) +) \ No newline at end of file diff --git a/tests/depsolve.rs b/tests/depsolve.rs new file mode 100644 index 00000000..0628a2d7 --- /dev/null +++ b/tests/depsolve.rs @@ -0,0 +1,153 @@ +use self::support::*; +use anyhow::{Context, Result}; +use std::time::Duration; +use warg_client::{ + storage::{ + ContentStorage, FileSystemContentStorage, FileSystemRegistryStorage, PublishEntry, + PublishInfo, RegistryStorage, + }, + Client, +}; +use warg_crypto::signing::PrivateKey; +use warg_protocol::registry::{PackageName, RecordId}; + +pub mod support; + +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +async fn depsolve() -> Result<()> { + let (_server, config) = spawn_server(&root().await?, None, None, None).await?; + + let client = create_client(&config)?; + let signing_key = support::test_signing_key(); + + let mut head = publish_package( + &client, + &signing_key, + "test:add", + "tests/components/add.wat", + ) + .await?; + client + .wait_for_publish( + &PackageName::new("test:add")?, + &head, + Duration::from_millis(100), + ) + .await?; + head = publish_package( + &client, + &signing_key, + "test:five", + "tests/components/five.wat", + ) + .await?; + client + .wait_for_publish( + &PackageName::new("test:five")?, + &head, + Duration::from_millis(100), + ) + .await?; + head = publish_package( + &client, + &signing_key, + "test:inc", + "tests/components/inc.wat", + ) + .await?; + client + .wait_for_publish( + &PackageName::new("test:inc")?, + &head, + Duration::from_millis(100), + ) + .await?; + head = publish_package( + &client, + &signing_key, + "test:meet", + "tests/components/meet.wat", + ) + .await?; + client + .wait_for_publish( + &PackageName::new("test:meet")?, + &head, + Duration::from_millis(100), + ) + .await?; + + client.update().await?; + client + .upsert([ + &PackageName::new("test:add")?, + &PackageName::new("test:inc")?, + &PackageName::new("test:five")?, + &PackageName::new("test:meet")?, + ]) + .await?; + + let info = client + .registry() + .load_package(&PackageName::new("test:meet")?) + .await? + .context("package does not exist in client storage")?; + + let locked_bytes = client.lock_component(&info).await?; + let expected_locked = wat::parse_file("tests/components/meet_locked.wat")?; + assert_eq!( + wasmprinter::print_bytes(&locked_bytes)?, + wasmprinter::print_bytes(expected_locked)? + ); + let bundled_bytes = client.bundle_component(&info).await?; + let expected_bundled = wat::parse_file("tests/components/meet_bundled.wat")?; + assert_eq!( + wasmprinter::print_bytes(bundled_bytes)?, + wasmprinter::print_bytes(expected_bundled)? + ); + Ok(()) +} + +async fn publish_package( + client: &Client, + signing_key: &PrivateKey, + name: &str, + path: &str, +) -> Result { + let comp = wat::parse_file(path)?; + let name = PackageName::new(name)?; + let add_digest = client + .content() + .store_content( + Box::pin(futures::stream::once(async move { Ok(comp.into()) })), + None, + ) + .await?; + let mut head = client + .publish_with_info( + signing_key, + PublishInfo { + name: name.clone(), + head: None, + entries: vec![PublishEntry::Init], + }, + ) + .await?; + client + .wait_for_publish(&name.clone(), &head, Duration::from_millis(100)) + .await?; + head = client + .publish_with_info( + signing_key, + PublishInfo { + name: name.clone(), + head: Some(head), + entries: vec![PublishEntry::Release { + version: format!("1.0.0").parse().unwrap(), + content: add_digest.clone(), + }], + }, + ) + .await?; + Ok(head) +}