Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
201 changes: 86 additions & 115 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ wat = "1.202.0"
logos = "0.14.0"
miette = "7.2.0"
thiserror = "1.0.58"
warg-client = "0.6.0"
warg-protocol = "0.6.0"
warg-crypto = "0.6.0"
warg-server = "0.6.0"
warg-client = "0.7.0"
warg-protocol = "0.7.0"
warg-crypto = "0.7.0"
warg-server = "0.7.0"
futures = "0.3.30"
indicatif = "0.17.8"
pretty_assertions = "1.4.0"
Expand Down
8 changes: 4 additions & 4 deletions crates/wac-resolver/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@ impl RegistryPackageResolver {
/// client configuration file.
///
/// If `url` is `None`, the default URL will be used.
pub fn new(url: Option<&str>, bar: Option<Box<dyn ProgressBar>>) -> Result<Self> {
pub async fn new(url: Option<&str>, bar: Option<Box<dyn ProgressBar>>) -> Result<Self> {
Ok(Self {
client: Arc::new(Client::new_with_default_config(url)?),
client: Arc::new(Client::new_with_default_config(url).await?),
bar,
})
}

/// Creates a new registry package resolver with the given configuration.
///
/// If `url` is `None`, the default URL will be used.
pub fn new_with_config(
pub async fn new_with_config(
url: Option<&str>,
config: &Config,
bar: Option<Box<dyn ProgressBar>>,
) -> Result<Self> {
Ok(Self {
client: Arc::new(Client::new_with_config(url, config, None)?),
client: Arc::new(Client::new_with_config(url, config, None).await?),
bar,
})
}
Expand Down
2 changes: 1 addition & 1 deletion crates/wac-resolver/tests/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export i2.foo as "bar";
"#,
)?;

let resolver = RegistryPackageResolver::new_with_config(None, &config, None)?;
let resolver = RegistryPackageResolver::new_with_config(None, &config, None).await?;
let packages = resolver.resolve(&packages(&document)?).await?;

let resolution = document.resolve(packages)?;
Expand Down
3 changes: 2 additions & 1 deletion crates/wac-resolver/tests/support/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub async fn publish(
content: Vec<u8>,
init: bool,
) -> Result<()> {
let client = FileSystemClient::new_with_config(None, config, None)?;
let client = FileSystemClient::new_with_config(None, config, None).await?;

let digest = client
.content()
Expand Down Expand Up @@ -148,6 +148,7 @@ pub async fn spawn_server(root: &Path) -> Result<(ServerInstance, warg_client::C
content_dir: Some(root.join("content")),
namespace_map_path: Some(root.join("namespaces")),
keyring_auth: false,
keyring_backend: None,
keys: Default::default(),
ignore_federation_hints: false,
auto_accept_federation_hints: false,
Expand Down
3 changes: 2 additions & 1 deletion src/commands/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ impl EncodeCommand {
self.deps.into_iter().collect(),
#[cfg(feature = "registry")]
self.registry.as_deref(),
)?;
)
.await?;

let packages = resolver
.resolve(&document)
Expand Down
13 changes: 7 additions & 6 deletions src/commands/plug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ impl PlugCommand {
#[cfg(feature = "registry")]
PackageRef::RegistryPackage((name, version)) => {
if client.is_none() {
client = Some(FileSystemClient::new_with_default_config(
self.registry.as_deref(),
));
client = Some(
FileSystemClient::new_with_default_config(self.registry.as_deref()).await,
);
}
let client = client.as_ref().unwrap().as_ref().map_err(|_| {
anyhow::anyhow!(
Expand Down Expand Up @@ -176,9 +176,10 @@ impl PlugCommand {
#[cfg(feature = "registry")]
PackageRef::RegistryPackage((name, version)) => {
if client.is_none() {
client = Some(FileSystemClient::new_with_default_config(
self.registry.as_deref(),
));
client = Some(
FileSystemClient::new_with_default_config(self.registry.as_deref())
.await,
);
}
let client = client.as_ref().unwrap().as_ref().map_err(|_| {
anyhow::anyhow!(
Expand Down
3 changes: 2 additions & 1 deletion src/commands/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ impl ResolveCommand {
self.deps.into_iter().collect(),
#[cfg(feature = "registry")]
self.registry.as_deref(),
)?;
)
.await?;

let packages = resolver
.resolve(&document)
Expand Down
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub struct PackageResolver {

impl PackageResolver {
/// Creates a new package resolver.
pub fn new(
pub async fn new(
dir: impl Into<PathBuf>,
overrides: HashMap<String, PathBuf>,
#[cfg(feature = "registry")] registry: Option<&str>,
Expand All @@ -63,7 +63,8 @@ impl PackageResolver {
registry: wac_resolver::RegistryPackageResolver::new(
registry,
Some(Box::new(progress::ProgressBar::new())),
)?,
)
.await?,
})
}

Expand Down