This PR fixes #5353

Changelog:
* Updated indexmap to 2
* Updated loupe and webc versions (that uses latest indexmap)
* Move indexmap and loupe into workspace dependencies
* Upgraded toml version
This commit is contained in:
Syrus Akbary
2025-01-20 17:58:07 +01:00
parent d5820948a8
commit 86a9968e9f
19 changed files with 293 additions and 294 deletions

491
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -92,8 +92,9 @@ wasmer-config = { path = "./lib/config" }
wasmer-wasix = { path = "./lib/wasix" }
# Wasmer-owned crates
webc = { version = "7.0.0-rc.2" }
webc = { version = "7.0.0" }
shared-buffer = "0.1.4"
loupe = "0.2.0"
# Third-party crates
dashmap = "6.0.1"
@ -107,7 +108,7 @@ wasmparser = { version = "0.216.0", default-features = false, features = [
] }
rkyv = { version = "0.8.8", features = ["indexmap-2", "bytes-1"] }
memmap2 = { version = "0.6.2" }
toml = { version = "0.5.9", features = ["preserve_order"] }
toml = { version = "0.8", features = ["preserve_order"] }
indexmap = "2"
serde_yaml = { package = "serde_yml", version = "0.0.12" }
libc = { version = "^0.2", default-features = false }

View File

@ -30,7 +30,7 @@ version.workspace = true
# Shared dependencies.
[dependencies]
# - Mandatory shared dependencies.
indexmap = { version = "1.6" }
indexmap = { workspace = true }
cfg-if = "1.0"
thiserror = "1.0"
more-asserts = "0.2"
@ -42,7 +42,7 @@ rustc-demangle = "0.1"
shared-buffer = { workspace = true }
wasmi_c_api = { version = "0.38.0", package = "wasmi_c_api_impl", optional = true }
seq-macro = { version = "0.3.5", optional = true }
loupe = { version = "0.1.3", optional = true, features = [
loupe = { workspace = true, optional = true, features = [
"indexmap",
"enable-indexmap",
] }

View File

@ -166,7 +166,7 @@ dirs = "4.0"
serde_json = { version = "1.0" }
target-lexicon = { version = "0.12", features = ["std"] }
wasmer-config = { version = "0.12.0", path = "../config" }
indexmap = "1.9.2"
indexmap = { workspace = true }
walkdir = "2.3.2"
regex = "1.6.0"
toml.workspace = true

View File

@ -1,7 +1,6 @@
//! Create a new Edge app.
use std::{
collections::HashMap,
env,
io::Cursor,
path::{Path, PathBuf},
@ -13,6 +12,7 @@ use anyhow::Context;
use colored::Colorize;
use dialoguer::{theme::ColorfulTheme, Confirm, Select};
use futures::stream::TryStreamExt;
use indexmap::IndexMap;
use is_terminal::IsTerminal;
use wasmer_backend_api::{
types::{AppTemplate, TemplateLanguage},
@ -137,7 +137,7 @@ impl CmdAppCreate {
package: PackageSource::from_str(package).unwrap(),
app_id: None,
domains: None,
env: HashMap::new(),
env: IndexMap::new(),
cli_args: None,
capabilities: None,
scheduled_tasks: None,
@ -147,7 +147,7 @@ impl CmdAppCreate {
scaling: None,
locality: None,
redirect: None,
extra: HashMap::new(),
extra: IndexMap::new(),
jobs: None,
}
}

View File

@ -2,11 +2,9 @@ use crate::config::WasmerEnv;
use anyhow::Context;
use cargo_metadata::{CargoOpt, MetadataCommand};
use clap::Parser;
use indexmap::IndexMap;
use semver::VersionReq;
use std::{
collections::HashMap,
path::{Path, PathBuf},
};
use std::path::{Path, PathBuf};
use super::AsyncCliCommand;
@ -271,8 +269,8 @@ impl Init {
}
/// Returns the dependencies based on the `--template` flag
fn get_dependencies(template: Option<&Template>) -> HashMap<String, VersionReq> {
let mut map = HashMap::default();
fn get_dependencies(template: Option<&Template>) -> IndexMap<String, VersionReq> {
let mut map = IndexMap::default();
match template {
Some(Template::Js) => {
@ -489,7 +487,7 @@ async fn construct_manifest(
abi: default_abi,
bindings: bindings.as_ref().and_then(|b| b.first_binding()),
interfaces: Some({
let mut map = HashMap::new();
let mut map = IndexMap::new();
map.insert("wasi".to_string(), "0.1.0-unstable".to_string());
map
}),

View File

@ -22,7 +22,7 @@ thiserror = "1.0"
serde_bytes = { version = "0.11", optional = true }
smallvec = "1.6"
xxhash-rust = { version = "0.8.10", features = ["xxh64"] }
loupe = { version = "0.1.3", optional = true, features = [
loupe = { workspace = true, optional = true, features = [
"indexmap",
"enable-indexmap",
] }

View File

@ -15,7 +15,7 @@ categories = ["parser-implementations", "wasm"]
[dependencies]
serde = { version = "1.0", features = ["derive"] }
anyhow = "1"
toml = "0.8"
toml = { workspace = true }
thiserror = "1"
semver = { version = "1", features = ["serde"] }
serde_json = "1"
@ -23,7 +23,7 @@ serde_yaml.workspace = true
indexmap = { workspace = true, features = ["serde"] }
derive_builder = "0.12.0"
bytesize = { version = "1.3.0", features = ["serde"] }
schemars = { version = "0.8.16", features = ["url"] }
schemars = { version = "0.8.16", features = ["url", "indexmap2"] }
url = { version = "2.5.0", features = ["serde"] }
hex = "0.4.3"
ciborium = "0.2.2"

View File

@ -1,7 +1,9 @@
use std::{borrow::Cow, collections::HashMap, fmt::Display, str::FromStr};
use std::{borrow::Cow, fmt::Display, str::FromStr};
use serde::{de::Error, Deserialize, Serialize};
use indexmap::IndexMap;
use crate::package::PackageSource;
use super::{pretty_duration::PrettyDuration, AppConfigCapabilityMemoryV1, AppVolume, HttpRequest};
@ -83,7 +85,7 @@ pub struct ExecutableJob {
/// Environment variables.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub env: Option<HashMap<String, String>>,
pub env: Option<IndexMap<String, String>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub capabilities: Option<ExecutableJobCompatibilityMapV1>,
@ -105,7 +107,7 @@ pub struct ExecutableJobCompatibilityMapV1 {
/// This provides a small bit of forwards compatibility for newly added
/// capabilities.
#[serde(flatten)]
pub other: HashMap<String, serde_json::Value>,
pub other: IndexMap<String, serde_json::Value>,
}
impl Serialize for JobTrigger {

View File

@ -7,10 +7,9 @@ mod pretty_duration;
pub use self::{healthcheck::*, http::*, job::*};
use std::collections::HashMap;
use anyhow::{bail, Context};
use bytesize::ByteSize;
use indexmap::IndexMap;
use pretty_duration::PrettyDuration;
use crate::package::PackageSource;
@ -65,8 +64,8 @@ pub struct AppConfigV1 {
pub locality: Option<Locality>,
/// Environment variables.
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
pub env: HashMap<String, String>,
#[serde(default, skip_serializing_if = "IndexMap::is_empty")]
pub env: IndexMap<String, String>,
// CLI arguments passed to the runner.
/// Only applicable for runners that accept CLI arguments.
@ -100,7 +99,7 @@ pub struct AppConfigV1 {
/// Capture extra fields for forwards compatibility.
#[serde(flatten)]
pub extra: HashMap<String, serde_json::Value>,
pub extra: IndexMap<String, serde_json::Value>,
}
#[derive(
@ -208,7 +207,7 @@ pub struct AppConfigCapabilityMapV1 {
/// This provides a small bit of forwards compatibility for newly added
/// capabilities.
#[serde(flatten)]
pub other: HashMap<String, serde_json::Value>,
pub other: IndexMap<String, serde_json::Value>,
}
/// Memory capability settings.

View File

@ -5,7 +5,7 @@ fn main() {
}
mod codegen {
use std::{collections::HashMap, path::Path};
use indexmap::IndexMap;
pub fn generate_schemas() {
eprintln!("Generating schemas...");
@ -37,10 +37,10 @@ mod codegen {
}
/// Returns a map of filename to serialized JSON schema.
fn build_jsonschema_map() -> HashMap<String, String> {
let mut map = HashMap::new();
fn build_jsonschema_map() -> IndexMap<String, String> {
let mut map = IndexMap::new();
fn add_schema<T: schemars::JsonSchema>(map: &mut HashMap<String, String>, name: &str) {
fn add_schema<T: schemars::JsonSchema>(map: &mut IndexMap<String, String>, name: &str) {
let gen =
schemars::gen::SchemaGenerator::new(schemars::gen::SchemaSettings::draft2019_09());
map.insert(

View File

@ -1,6 +1,8 @@
//! Rust and cargo specific annotations used to interoperate with external tools.
use std::{collections::HashMap, path::PathBuf};
use std::path::PathBuf;
use indexmap::IndexMap;
use crate::package::{Abi, Bindings};
@ -20,7 +22,7 @@ pub struct CargoWasmerPackageAnnotation {
pub abi: Abi,
/// Filesystem mappings.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub fs: Option<HashMap<String, PathBuf>>,
pub fs: Option<IndexMap<String, PathBuf>>,
/// Binding declarations for the crate.
pub bindings: Option<Bindings>,
}

View File

@ -22,7 +22,7 @@ pub use self::{
use std::{
borrow::Cow,
collections::{hash_map::HashMap, BTreeMap, BTreeSet},
collections::{BTreeMap, BTreeSet},
fmt::{self, Display},
path::{Path, PathBuf},
str::FromStr,
@ -499,7 +499,7 @@ pub struct Module {
pub kind: Option<String>,
/// WebAssembly interfaces this module requires.
#[serde(skip_serializing_if = "Option::is_none")]
pub interfaces: Option<HashMap<String, String>>,
pub interfaces: Option<IndexMap<String, String>>,
/// Interface definitions that can be used to generate bindings to this
/// module.
pub bindings: Option<Bindings>,
@ -712,9 +712,9 @@ pub struct Manifest {
/// Metadata about the package itself.
pub package: Option<Package>,
/// The package's dependencies.
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
#[serde(default, skip_serializing_if = "IndexMap::is_empty")]
#[builder(default)]
pub dependencies: HashMap<String, VersionReq>,
pub dependencies: IndexMap<String, VersionReq>,
/// The mappings used when making bundled assets available to WebAssembly
/// instances, in the form guest -> host.
#[serde(default, skip_serializing_if = "IndexMap::is_empty")]
@ -734,7 +734,7 @@ impl Manifest {
pub fn new_empty() -> Self {
Self {
package: None,
dependencies: HashMap::new(),
dependencies: IndexMap::new(),
fs: IndexMap::new(),
modules: Vec::new(),
commands: Vec::new(),
@ -910,7 +910,7 @@ impl ManifestBuilder {
/// Add a dependency to the [`Manifest`].
pub fn with_dependency(&mut self, name: impl Into<String>, version: VersionReq) -> &mut Self {
self.dependencies
.get_or_insert_with(HashMap::new)
.get_or_insert_with(IndexMap::new)
.insert(name.into(), version);
self
}
@ -999,7 +999,7 @@ mod tests {
entrypoint: None,
private: false,
}),
dependencies: HashMap::new(),
dependencies: IndexMap::new(),
modules: vec![Module {
name: "test".to_string(),
abi: Abi::Wasi,

View File

@ -15,7 +15,7 @@ rust-version.workspace = true
[dependencies]
webc.workspace = true
wasmer-config = { version = "0.12.0", path = "../config" }
toml = "0.8.0"
toml = { workspace = true }
bytes = "1.8.0"
sha2 = "0.10.8"
shared-buffer.workspace = true

View File

@ -1,5 +1,5 @@
use std::{
collections::{BTreeMap, HashMap},
collections::BTreeMap,
path::{Path, PathBuf},
};
@ -227,7 +227,7 @@ fn transform_package_annotations_shared(
}
fn transform_dependencies(
original_dependencies: &HashMap<String, VersionReq>,
original_dependencies: &IndexMap<String, VersionReq>,
) -> Result<IndexMap<String, UrlOrManifest>, ManifestError> {
let mut dependencies = IndexMap::new();

View File

@ -29,7 +29,7 @@ bytecheck = "0.6.8"
xxhash-rust = { version = "0.8.8", features = ["xxh64"] }
sha2 = { version = "0.10" }
hex = { version = "^0.4" }
loupe = { version = "0.1.3", optional = true }
loupe = { workspace = true, optional = true }
# `rand` uses `getrandom` transitively, and to be able to

View File

@ -20,7 +20,7 @@ bytes = "1"
filetime = { version = "0.2.18", optional = true }
fs_extra = { version = "1.2.0", optional = true }
futures = { version = "0.3" }
indexmap = "1.9.2"
indexmap = { workspace = true }
lazy_static = "1.4"
libc = { workspace = true, optional = true }
pin-project-lite = "0.2.9"

View File

@ -32,7 +32,7 @@ fnv = "1.0.3"
# - Optional shared dependencies.
tracing = { version = "0.1", optional = true }
crossbeam-queue = "0.3.8"
loupe = { version = "0.1.3", optional = true }
loupe = { workspace = true, optional = true }
[target.'cfg(target_vendor = "apple")'.dependencies]
mach2 = "0.4.2"

View File

@ -121,7 +121,7 @@ hyper-util = { version = "0.1.5", features = [
"client",
], optional = true }
http-body-util = { version = "0.1.1", optional = true }
toml = "0.8"
toml = { workspace = true }
pin-utils = "0.1.0"
[target.'cfg(not(any(target_arch = "riscv64", target_arch = "loongarch64")))'.dependencies.reqwest]