diff --git a/Cargo.lock b/Cargo.lock index 997e7fa..a2ab0da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -518,9 +518,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.22" +version = "1.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9540e661f81799159abee814118cc139a2004b3a3aa3ea37724a1b66530b90e0" +checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938" dependencies = [ "shlex", ] @@ -564,9 +564,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.18" +version = "4.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3" +checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615" dependencies = [ "clap_builder", "clap_derive", @@ -574,9 +574,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.18" +version = "4.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b" +checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b" dependencies = [ "anstream", "anstyle", @@ -1290,7 +1290,7 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap 2.5.0", + "indexmap 2.6.0", "slab", "tokio", "tokio-util", @@ -1312,6 +1312,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + [[package]] name = "heck" version = "0.4.1" @@ -1423,9 +1429,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "httpdate" @@ -1593,12 +1599,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.15.0", "serde 1.0.210", ] @@ -1770,7 +1776,7 @@ checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ "bitflags 2.6.0", "libc", - "redox_syscall 0.5.6", + "redox_syscall 0.5.7", ] [[package]] @@ -1846,7 +1852,7 @@ dependencies = [ "lazy_static 1.5.0", "proc-macro2", "quote", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", "syn 2.0.79", ] @@ -2222,9 +2228,12 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" +dependencies = [ + "portable-atomic", +] [[package]] name = "openssl-probe" @@ -2319,7 +2328,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.5.6", + "redox_syscall 0.5.7", "smallvec 1.13.2", "windows-targets 0.52.6", ] @@ -2332,7 +2341,7 @@ checksum = "914a1c2265c98e2446911282c6ac86d8524f495792c38c5bd884f80499c7538a" dependencies = [ "parse-display-derive", "regex", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", ] [[package]] @@ -2344,7 +2353,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", "structmeta", "syn 2.0.79", ] @@ -2414,7 +2423,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.5.0", + "indexmap 2.6.0", ] [[package]] @@ -2481,6 +2490,12 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "portable-atomic" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" + [[package]] name = "powerfmt" version = "0.2.0" @@ -2765,9 +2780,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "355ae415ccd3a04315d3f8246e86d67689ea74d88d915576e1589a351062a13b" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags 2.6.0", ] @@ -2785,14 +2800,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.6" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", ] [[package]] @@ -2806,13 +2821,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", ] [[package]] @@ -2823,9 +2838,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "relative-path" @@ -2835,9 +2850,9 @@ checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2" [[package]] name = "reqwest" -version = "0.12.7" +version = "0.12.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" +checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" dependencies = [ "base64 0.22.1", "bytes 1.7.2", @@ -3028,11 +3043,10 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ - "base64 0.22.1", "rustls-pki-types", ] @@ -3267,15 +3281,15 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.9.0" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" +checksum = "9720086b3357bcb44fce40117d769a4d068c70ecfa190850a980a71755f66fcc" dependencies = [ "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.5.0", + "indexmap 2.6.0", "serde 1.0.210", "serde_derive", "serde_json", @@ -3285,9 +3299,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.9.0" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" +checksum = "5f1abbfe725f27678f4663bcacb75a83e829fd464c25d78dd038a3a29e307cec" dependencies = [ "darling", "proc-macro2", @@ -3301,7 +3315,7 @@ version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.6.0", "itoa", "ryu", "serde 1.0.210", @@ -3557,9 +3571,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if 1.0.0", "fastrand 2.1.1", @@ -3570,12 +3584,12 @@ dependencies = [ [[package]] name = "terminal_size" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +checksum = "4f599bd7ca042cfdf8f4512b277c02ba102247820f9d9d4a9f521f496751a6ef" dependencies = [ "rustix 0.38.37", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -3905,7 +3919,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.6.0", "toml_datetime", "winnow 0.5.40", ] @@ -3916,7 +3930,7 @@ version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.6.0", "serde 1.0.210", "serde_spanned", "toml_datetime", @@ -4010,9 +4024,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-ident" @@ -4108,7 +4122,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44b422328c3a86be288f569694aa97df958ade0cd9514ed00bc562952c6778e" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.6.0", "itertools 0.12.1", "serde 1.0.210", "serde_with", @@ -4131,7 +4145,7 @@ dependencies = [ "dialoguer", "dirs", "futures-util", - "indexmap 2.5.0", + "indexmap 2.6.0", "itertools 0.12.1", "keyring", "libc", @@ -4212,7 +4226,7 @@ dependencies = [ "anyhow", "base64 0.21.7", "hex", - "indexmap 2.5.0", + "indexmap 2.6.0", "pbjson-types", "prost", "prost-types", @@ -4233,7 +4247,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b950a71a544b7ac8f5a5e95f43886ac97c3fe5c7080b955b1b534037596d7be" dependencies = [ "anyhow", - "indexmap 2.5.0", + "indexmap 2.6.0", "prost", "thiserror", "warg-crypto", @@ -4322,7 +4336,7 @@ dependencies = [ "anyhow", "heck 0.4.1", "im-rc", - "indexmap 2.5.0", + "indexmap 2.6.0", "log", "petgraph", "serde 1.0.210", @@ -4364,6 +4378,15 @@ dependencies = [ "wasmparser 0.217.0", ] +[[package]] +name = "wasm-encoder" +version = "0.218.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22b896fa8ceb71091ace9bcb81e853f54043183a1c9667cf93422c40252ffa0a" +dependencies = [ + "leb128", +] + [[package]] name = "wasm-metadata" version = "0.215.0" @@ -4371,7 +4394,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c6bb07c5576b608f7a2a9baa2294c1a3584a249965d695a9814a496cb6d232f" dependencies = [ "anyhow", - "indexmap 2.5.0", + "indexmap 2.6.0", "serde 1.0.210", "serde_derive", "serde_json", @@ -4387,7 +4410,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65a146bf9a60e9264f0548a2599aa9656dba9a641eff9ab88299dc2a637e483c" dependencies = [ "anyhow", - "indexmap 2.5.0", + "indexmap 2.6.0", "serde 1.0.210", "serde_derive", "serde_json", @@ -4398,7 +4421,7 @@ dependencies = [ [[package]] name = "wasm-pkg-client" -version = "0.7.1" +version = "0.7.2" dependencies = [ "anyhow", "async-trait", @@ -4431,7 +4454,7 @@ dependencies = [ [[package]] name = "wasm-pkg-common" -version = "0.7.1" +version = "0.7.2" dependencies = [ "anyhow", "bytes 1.7.2", @@ -4451,11 +4474,11 @@ dependencies = [ [[package]] name = "wasm-pkg-core" -version = "0.7.1" +version = "0.7.2" dependencies = [ "anyhow", "futures-util", - "indexmap 2.5.0", + "indexmap 2.6.0", "libc", "rstest", "semver 1.0.23", @@ -4476,9 +4499,9 @@ dependencies = [ [[package]] name = "wasm-streams" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" +checksum = "4e072d4e72f700fb3443d8fe94a39315df013eef1104903cdb0a2abd322bbecd" dependencies = [ "futures-util", "js-sys", @@ -4494,7 +4517,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9dbe55c8f9d0dbd25d9447a5a889ff90c0cc3feaa7395310d3d826b2c703eaab" dependencies = [ "bitflags 2.6.0", - "indexmap 2.5.0", + "indexmap 2.6.0", "semver 1.0.23", ] @@ -4507,7 +4530,7 @@ dependencies = [ "ahash", "bitflags 2.6.0", "hashbrown 0.14.5", - "indexmap 2.5.0", + "indexmap 2.6.0", "semver 1.0.23", ] @@ -4520,7 +4543,7 @@ dependencies = [ "ahash", "bitflags 2.6.0", "hashbrown 0.14.5", - "indexmap 2.5.0", + "indexmap 2.6.0", "semver 1.0.23", ] @@ -4536,22 +4559,22 @@ dependencies = [ [[package]] name = "wast" -version = "217.0.0" +version = "218.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79004ecebded92d3c710d4841383368c7f04b63d0992ddd6b0c7d5029b7629b7" +checksum = "8a53cd1f0fa505df97557e36a58bddb8296e2fcdcd089529545ebfdb18a1b9d7" dependencies = [ "bumpalo", "leb128", "memchr", "unicode-width", - "wasm-encoder 0.217.0", + "wasm-encoder 0.218.0", ] [[package]] name = "wat" -version = "1.217.0" +version = "1.218.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c126271c3d92ca0f7c63e4e462e40c69cca52fd4245fcda730d1cf558fb55088" +checksum = "4f87f8e14e776762e07927c27c2054d2cf678aab9aae2d431a79b3e31e4dd391" dependencies = [ "wast", ] @@ -4831,7 +4854,7 @@ checksum = "f725e3885fc5890648be5c5cbc1353b755dc932aa5f1aa7de968b912a3280743" dependencies = [ "anyhow", "bitflags 2.6.0", - "indexmap 2.5.0", + "indexmap 2.6.0", "log", "serde 1.0.210", "serde_derive", @@ -4850,7 +4873,7 @@ checksum = "d7117809905e49db716d81e794f79590c052bf2fdbbcda1731ca0fb28f6f3ddf" dependencies = [ "anyhow", "bitflags 2.6.0", - "indexmap 2.5.0", + "indexmap 2.6.0", "log", "serde 1.0.210", "serde_derive", @@ -4869,7 +4892,7 @@ checksum = "935a97eaffd57c3b413aa510f8f0b550a4a9fe7d59e79cd8b89a83dcb860321f" dependencies = [ "anyhow", "id-arena", - "indexmap 2.5.0", + "indexmap 2.6.0", "log", "semver 1.0.23", "serde 1.0.210", @@ -4887,7 +4910,7 @@ checksum = "fb893dcd6d370cfdf19a0d9adfcd403efb8e544e1a0ea3a8b81a21fe392eaa78" dependencies = [ "anyhow", "id-arena", - "indexmap 2.5.0", + "indexmap 2.6.0", "log", "semver 1.0.23", "serde 1.0.210", @@ -4899,7 +4922,7 @@ dependencies = [ [[package]] name = "wkg" -version = "0.7.1" +version = "0.7.2" dependencies = [ "anyhow", "base64 0.22.1", diff --git a/Cargo.toml b/Cargo.toml index 464f45a..1724261 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ resolver = "2" [workspace.package] edition = "2021" -version = "0.7.1" +version = "0.7.2" authors = ["The Wasmtime Project Developers"] license = "Apache-2.0 WITH LLVM-exception" @@ -36,9 +36,9 @@ tracing-subscriber = { version = "0.3.18", default-features = false, features = "fmt", "env-filter", ] } -wasm-pkg-common = { version = "0.7.1", path = "crates/wasm-pkg-common" } -wasm-pkg-client = { version = "0.7.1", path = "crates/wasm-pkg-client" } +wasm-pkg-common = { version = "0.7.2", path = "crates/wasm-pkg-common" } +wasm-pkg-client = { version = "0.7.2", path = "crates/wasm-pkg-client" } wasm-metadata = "0.217" wit-component = "0.217" wit-parser = "0.217" -wasm-pkg-core = { version = "0.7.1", path = "crates/wasm-pkg-core" } +wasm-pkg-core = { version = "0.7.2", path = "crates/wasm-pkg-core" } diff --git a/crates/wasm-pkg-core/src/lock.rs b/crates/wasm-pkg-core/src/lock.rs index 3695f9e..0ed59d5 100644 --- a/crates/wasm-pkg-core/src/lock.rs +++ b/crates/wasm-pkg-core/src/lock.rs @@ -12,7 +12,7 @@ use semver::{Version, VersionReq}; use serde::{Deserialize, Serialize}; use tokio::{ fs::{File, OpenOptions}, - io::AsyncWriteExt, + io::{AsyncSeekExt, AsyncWriteExt}, }; use wasm_pkg_client::{ContentDigest, PackageRef}; @@ -131,12 +131,19 @@ impl LockFile { pub async fn write(&mut self) -> Result<()> { let contents = toml::to_string_pretty(self)?; // Truncate the file before writing to it + self.locker.file.rewind().await.with_context(|| { + format!( + "unable to rewind lock file at path {}", + self.locker.path.display() + ) + })?; self.locker.file.set_len(0).await.with_context(|| { format!( "unable to truncate lock file at path {}", self.locker.path.display() ) })?; + self.locker.file.write_all( b"# This file is automatically generated.\n# It is not intended for manual editing.\n", ) @@ -824,6 +831,11 @@ mod tests { .await .expect("Shouldn't fail when creating a new lock file"); + // Write the current file to make sure that works + lock.write() + .await + .expect("Shouldn't fail when writing lock file"); + // Push one more package onto the lock file before writing it let new_package = LockedPackage { name: "defiant:armor".parse().unwrap(), @@ -838,6 +850,7 @@ mod tests { lock.packages.insert(new_package.clone()); expected_deps.insert(new_package); + // Write again with the same file lock.write() .await .expect("Shouldn't fail when writing lock file");