From d367b1f10dc0736b1d58bfb46cd7774243b6e217 Mon Sep 17 00:00:00 2001 From: Calvin Prewitt Date: Sat, 4 May 2024 21:07:34 -0500 Subject: [PATCH 01/14] implemented `ConflictPendingPublish` --- crates/api/src/v1/package.rs | 21 +++- crates/client/src/lib.rs | 204 +++++++++++++++++++++++------------ crates/server/openapi.yaml | 2 +- src/bin/warg.rs | 7 ++ 4 files changed, 163 insertions(+), 71 deletions(-) diff --git a/crates/api/src/v1/package.rs b/crates/api/src/v1/package.rs index 74b8b307..356b468d 100644 --- a/crates/api/src/v1/package.rs +++ b/crates/api/src/v1/package.rs @@ -133,6 +133,9 @@ pub enum PackageError { /// The operation was not supported by the registry. #[error("the requested operation is not supported: {0}")] NotSupported(String), + /// The package was rejected by the registry, due to a conflict with a pending publish. + #[error("the package conflicts with pending publish of record `{0}`")] + ConflictPendingPublish(RecordId), /// The package was rejected by the registry. #[error("the package was rejected by the registry: {0}")] Rejection(String), @@ -152,7 +155,7 @@ impl PackageError { match self { Self::Unauthorized { .. } => 401, Self::LogNotFound(_) | Self::RecordNotFound(_) | Self::NamespaceNotDefined(_) => 404, - Self::NamespaceImported(_) => 409, + Self::NamespaceImported(_) | Self::ConflictPendingPublish(_) => 409, Self::RecordNotSourcing => 405, Self::Rejection(_) => 422, Self::NotSupported(_) => 501, @@ -243,6 +246,12 @@ impl Serialize for PackageError { id: Cow::Borrowed(namespace), } .serialize(serializer), + Self::ConflictPendingPublish(record_id) => RawError::Conflict { + status: Status::<409>, + ty: EntityType::Record, + id: Cow::Borrowed(record_id), + } + .serialize(serializer), Self::RecordNotSourcing => RawError::RecordNotSourcing::<()> { status: Status::<405>, } @@ -301,6 +310,16 @@ impl<'de> Deserialize<'de> for PackageError { }, RawError::Conflict { status: _, ty, id } => match ty { EntityType::NamespaceImport => Ok(Self::NamespaceImported(id.into_owned())), + EntityType::Record => Ok(Self::ConflictPendingPublish( + id.parse::() + .map_err(|_| { + serde::de::Error::invalid_value( + Unexpected::Str(&id), + &"a valid record id", + ) + })? + .into(), + )), _ => Err(serde::de::Error::invalid_value( Unexpected::Enum, &"a valid entity type", diff --git a/crates/client/src/lib.rs b/crates/client/src/lib.rs index c02ea7ee..499a144b 100644 --- a/crates/client/src/lib.rs +++ b/crates/client/src/lib.rs @@ -50,6 +50,8 @@ pub mod storage; pub use self::config::*; pub use self::registry_url::RegistryUrl; +const DEFAULT_WAIT_INTERVAL: Duration = Duration::from_secs(1); + /// A client for a Warg registry. pub struct Client where @@ -310,7 +312,7 @@ impl Client ClientResult { if info.entries.is_empty() { return Err(ClientError::NothingToPublish { @@ -318,101 +320,147 @@ impl Client { - if initializing { - return Err(ClientError::CannotInitializePackage { name: package.name }); - } else if info.head.is_none() { - // If we're not initializing the package and a head was not explicitly specified, - // updated to the latest checkpoint to get the latest known head. - info.head = package.state.head().as_ref().map(|h| h.digest.clone()); + let mut accepted_prompt_to_initialize = false; + + let (package, record) = loop { + let mut info = PublishInfo { + name: info.name.clone(), + head: info.head.clone(), + entries: info.entries.clone(), + }; + let mut initializing = info.initializing(); + + let package = match self.fetch_package(&info.name).await { + Ok(package) => { + if initializing { + return Err(ClientError::CannotInitializePackage { name: package.name }); + } else if info.head.is_none() { + // If we're not initializing the package and a head was not explicitly specified, + // set to the latest known head. + info.head = package.state.head().as_ref().map(|h| h.digest.clone()); + } + package } - package - } - Err(ClientError::PackageDoesNotExist { - name, - has_auth_token, - }) => { - if !initializing { - let prompt = if has_auth_token { - format!( + Err(ClientError::PackageDoesNotExist { + name, + has_auth_token, + }) => { + if !initializing { + let prompt = if has_auth_token { + format!( "Package `{package_name}` does not already exist or you do not have access. Do you wish to initialize `{package_name}` and publish release y/N\n", package_name = &info.name, ) - } else { - format!( + } else { + format!( "Package `{package_name}` does not already exist or you do not have access. You may be required to login. Try: `warg login` Do you wish to initialize `{package_name}` and publish release y/N\n", package_name = &info.name, ) - }; - if Confirm::with_theme(&ColorfulTheme::default()) - .with_prompt(prompt) - .default(false) - .interact() - .unwrap() - { - info.entries.insert(0, PublishEntry::Init); - } else { - return Err(ClientError::MustInitializePackage { - name, - has_auth_token, - }); + }; + if accepted_prompt_to_initialize + || Confirm::with_theme(&ColorfulTheme::default()) + .with_prompt(prompt) + .default(false) + .interact() + .unwrap() + { + info.entries.insert(0, PublishEntry::Init); + initializing = true; + accepted_prompt_to_initialize = true; + } else { + return Err(ClientError::MustInitializePackage { + name, + has_auth_token, + }); + } } + PackageInfo::new(info.name.clone()) } - PackageInfo::new(info.name.clone()) - } - err => err?, - }; - let registry_domain = self.get_warg_registry(package.name.namespace()).await?; + err => err?, + }; + let registry_domain = self.get_warg_registry(package.name.namespace()).await?; - let record = info.finalize(signing_key)?; - let log_id = LogId::package_log::(&package.name); - let record_id = RecordId::package_record::(&record); - let record = self - .api - .publish_package_record( - registry_domain.as_ref(), - &log_id, - PublishRecordRequest { - package_name: Cow::Borrowed(&package.name), - record: Cow::Owned(record.into()), - content_sources: Default::default(), - }, - ) - .await - .map_err(|e| match e { - api::ClientError::Package(PackageError::Rejection(reason)) => { - ClientError::PublishRejected { + let log_id = LogId::package_log::(&package.name); + let record = info.finalize(signing_key)?; + let record_id = RecordId::package_record::(&record); + let record = match self + .api + .publish_package_record( + registry_domain.as_ref(), + &log_id, + PublishRecordRequest { + package_name: Cow::Borrowed(&package.name), + record: Cow::Owned(record.into()), + content_sources: Default::default(), + }, + ) + .await + { + Ok(record) => Ok(record), + Err(api::ClientError::Package(PackageError::Rejection(reason))) => { + Err(ClientError::PublishRejected { name: package.name.clone(), reason, record_id, - } + }) } - api::ClientError::Package(PackageError::Unauthorized(reason)) => { - ClientError::Unauthorized(reason) + Err(api::ClientError::Package(PackageError::Unauthorized(reason))) => { + Err(ClientError::Unauthorized(reason)) } - e => { - ClientError::translate_log_not_found(e, self.api.auth_token().is_some(), |id| { + Err(api::ClientError::Package(PackageError::ConflictPendingPublish( + pending_record_id, + ))) => { + // conflicting pending publish succeeds, + tracing::info!("waiting for conflicting publish to complete"); + // check registry for federated namespace mapping, if initializing + if initializing { + match self.fetch_package(&package.name).await { + Ok(_) => {} + // may not exist until conflicting publish completes + Err(ClientError::PackageDoesNotExist { .. }) => {} + Err(err) => return Err(err), + } + } + self.wait_for_publish(&package.name, &pending_record_id, DEFAULT_WAIT_INTERVAL) + .await + .map_err(|err| match err { + ClientError::PackageMissingContent => { + ClientError::ConflictPendingPublish { + name: package.name.clone(), + record_id, + pending_record_id, + } + } + err => err, + })?; + + continue; + } + Err(e) => Err(ClientError::translate_log_not_found( + e, + self.api.auth_token().is_some(), + |id| { if id == &log_id { Some(package.name.clone()) } else { None } - }) - } - })?; + }, + )), + }?; + + break (package, record); + }; // TODO: parallelize this for (digest, MissingContent { upload }) in record.missing_content() { @@ -479,7 +527,7 @@ package_name = &info.name, return Err(ClientError::PackageMissingContent); } PackageRecordState::Published { .. } => { - self.update().await?; + self.fetch_package(&package).await?; return Ok(()); } PackageRecordState::Rejected { reason } => { @@ -978,7 +1026,7 @@ current_registry = registry_domain.map(|d| d.as_str()).unwrap_or(&self.url().saf Ok(()) } - /// Fetches package logs. + /// Fetches package logs without checking local storage first. pub async fn fetch_packages( &self, names: impl IntoIterator, @@ -991,6 +1039,13 @@ current_registry = registry_domain.map(|d| d.as_str()).unwrap_or(&self.url().saf Ok(packages) } + /// Fetches the `PackageInfo` without checking local storage first. + pub async fn fetch_package(&self, name: &PackageName) -> Result { + let mut info = PackageInfo::new(name.clone()); + self.update_checkpoints([&mut info]).await?; + Ok(info) + } + /// Retrieves the `PackageInfo` from local storage, if present, otherwise fetches from the /// registry. pub async fn package(&self, name: &PackageName) -> Result { @@ -1313,6 +1368,17 @@ pub enum ClientError { reason: String, }, + /// A publish operation was rejected due to conflicting pending publish. + #[error("the publishing of package `{name}` was rejected due to conflicting pending publish of record `{pending_record_id}`")] + ConflictPendingPublish { + /// The package that was rejected. + name: PackageName, + /// The record identifier for the record that was rejected. + record_id: RecordId, + /// The record identifier for the pending publish record. + pending_record_id: RecordId, + }, + /// The package is still missing content. #[error("the package is still missing content after all content was uploaded")] PackageMissingContent, diff --git a/crates/server/openapi.yaml b/crates/server/openapi.yaml index 5f0c67a3..0e102c3d 100644 --- a/crates/server/openapi.yaml +++ b/crates/server/openapi.yaml @@ -282,7 +282,7 @@ paths: type: type: string description: The type of entity that was not found. - enum: [name, namespace, namespaceImport] + enum: [name, namespace, namespaceImport, record] example: namespace id: type: string diff --git a/src/bin/warg.rs b/src/bin/warg.rs index 8d66d08a..1677ddc8 100644 --- a/src/bin/warg.rs +++ b/src/bin/warg.rs @@ -116,6 +116,13 @@ pub async fn describe_client_error(e: &ClientError) -> Result<()> { ClientError::PublishRejected { name, reason, .. } => { eprintln!("Package `{name}` publish rejected: {reason}") } + ClientError::ConflictPendingPublish { + name, + pending_record_id, + .. + } => { + eprintln!("Package `{name}` publish rejected due to conflict with pending publish of record `{pending_record_id}`") + } ClientError::Unauthorized(reason) => { eprintln!("Unauthorized: {reason}") } From fea9c2eb9cbb5485309b4a1931d4a8ba4669140d Mon Sep 17 00:00:00 2001 From: Calvin Prewitt Date: Sun, 5 May 2024 15:55:01 -0500 Subject: [PATCH 02/14] revised CLI messages --- crates/client/src/lib.rs | 52 +++++++++++++++++++++++----------------- src/bin/warg.rs | 14 +++++++++-- 2 files changed, 42 insertions(+), 24 deletions(-) diff --git a/crates/client/src/lib.rs b/crates/client/src/lib.rs index 499a144b..372990b2 100644 --- a/crates/client/src/lib.rs +++ b/crates/client/src/lib.rs @@ -312,35 +312,39 @@ impl Client ClientResult { - if info.entries.is_empty() { + if publish_info.entries.is_empty() { return Err(ClientError::NothingToPublish { - name: info.name.clone(), + name: publish_info.name.clone(), }); } tracing::info!( "publishing {new}package `{name}`", - name = info.name, - new = if info.initializing() { "new " } else { "" } + name = publish_info.name, + new = if publish_info.initializing() { + "new " + } else { + "" + } ); - tracing::debug!("entries: {:?}", info.entries); + tracing::debug!("entries: {:?}", publish_info.entries); let mut accepted_prompt_to_initialize = false; + let mut init_record_id: Option = None; let (package, record) = loop { - let mut info = PublishInfo { - name: info.name.clone(), - head: info.head.clone(), - entries: info.entries.clone(), - }; + let mut info = publish_info.clone(); let mut initializing = info.initializing(); let package = match self.fetch_package(&info.name).await { Ok(package) => { if initializing { - return Err(ClientError::CannotInitializePackage { name: package.name }); + return Err(ClientError::CannotInitializePackage { + name: package.name, + init_record_id, + }); } else if info.head.is_none() { // If we're not initializing the package and a head was not explicitly specified, // set to the latest known head. @@ -355,17 +359,18 @@ impl Client {} Err(err) => return Err(err), } + init_record_id = Some(pending_record_id.clone()); } self.wait_for_publish(&package.name, &pending_record_id, DEFAULT_WAIT_INTERVAL) .await @@ -527,7 +533,7 @@ package_name = &info.name, return Err(ClientError::PackageMissingContent); } PackageRecordState::Published { .. } => { - self.fetch_package(&package).await?; + self.fetch_package(package).await?; return Ok(()); } PackageRecordState::Rejected { reason } => { @@ -1276,6 +1282,8 @@ pub enum ClientError { CannotInitializePackage { /// The package name that already exists. name: PackageName, + /// The record identifier for the init record. + init_record_id: Option, }, /// The package must be initialized before publishing. diff --git a/src/bin/warg.rs b/src/bin/warg.rs index 1677ddc8..53c7bccd 100644 --- a/src/bin/warg.rs +++ b/src/bin/warg.rs @@ -110,8 +110,18 @@ pub async fn describe_client_error(e: &ClientError) -> Result<()> { } eprintln!("To initialize package: `warg publish init {name}`"); } - ClientError::CannotInitializePackage { name } => { - eprintln!("Package `{name}` is already initialized.") + ClientError::CannotInitializePackage { + name, + init_record_id, + } => { + if init_record_id.is_some() { + eprintln!( + "Package `{name}` was initialized but with a different record than you signed. +This may be expected behavior for registries that offer key management." + ) + } else { + eprintln!("Package `{name}` is already initialized.") + } } ClientError::PublishRejected { name, reason, .. } => { eprintln!("Package `{name}` publish rejected: {reason}") From 9cc53a625c202dd99421c3d65bc563c1f0ed81bc Mon Sep 17 00:00:00 2001 From: Calvin Prewitt Date: Sun, 5 May 2024 16:31:08 -0500 Subject: [PATCH 03/14] speed up tests by reducing the number of releases to 10 from 300 --- tests/client.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/client.rs b/tests/client.rs index e61a4ec1..16f87b97 100644 --- a/tests/client.rs +++ b/tests/client.rs @@ -18,7 +18,7 @@ fn create_client(config: &Config) -> Result { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn client_incrementally_fetches() -> Result<()> { - const RELEASE_COUNT: usize = 300; + const RELEASE_COUNT: usize = 10; const PACKAGE_NAME: &str = "test:package"; let (_server, config) = spawn_server(&root().await?, None, None, None).await?; From 3eb63685df8f485d84ffefb35216e387ea31eab7 Mon Sep 17 00:00:00 2001 From: Calvin Prewitt Date: Mon, 6 May 2024 09:55:59 -0500 Subject: [PATCH 04/14] added feature flag for `not-cli`; also, config to disable dialoguer prompt; --- Cargo.toml | 1 + crates/client/Cargo.toml | 5 +- crates/client/src/config.rs | 5 ++ crates/client/src/lib.rs | 161 ++++++++++++++++++++++++++++-------- src/bin/warg.rs | 13 +++ src/commands/config.rs | 1 + tests/support/mod.rs | 1 + 7 files changed, 149 insertions(+), 38 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 08e71555..2f78bf12 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,6 +58,7 @@ testresult = "0.3.0" [features] default = [] postgres = ["warg-server/postgres"] +not-cli = ["warg-client/not-cli"] [workspace] members = ["crates/server"] diff --git a/crates/client/Cargo.toml b/crates/client/Cargo.toml index 86d7e10d..9ebb2a30 100644 --- a/crates/client/Cargo.toml +++ b/crates/client/Cargo.toml @@ -10,8 +10,9 @@ homepage = { workspace = true } repository = { workspace = true} [features] -default = [] +default = ["dialoguer"] native-tls-vendored = ["reqwest/native-tls-vendored"] +not-cli = [] [dependencies] warg-crypto = { workspace = true } @@ -24,7 +25,7 @@ clap = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } tokio = { workspace = true } -dialoguer = { workspace = true } +dialoguer = { workspace = true, optional = true } tokio-util = { workspace = true } tempfile = { workspace = true } reqwest = { workspace = true } diff --git a/crates/client/src/config.rs b/crates/client/src/config.rs index 890df10d..b29d2838 100644 --- a/crates/client/src/config.rs +++ b/crates/client/src/config.rs @@ -122,6 +122,10 @@ pub struct Config { /// Auto accept registry hint or ask the user to confirm #[serde(default)] pub auto_accept_federation_hints: bool, + + /// Disable dialoguer prompts. + #[serde(default)] + pub disable_dialoguer: bool, } impl Config { @@ -202,6 +206,7 @@ impl Config { keyring_auth: self.keyring_auth, ignore_federation_hints: self.ignore_federation_hints, auto_accept_federation_hints: self.auto_accept_federation_hints, + disable_dialoguer: self.disable_dialoguer, }; serde_json::to_writer_pretty( diff --git a/crates/client/src/lib.rs b/crates/client/src/lib.rs index 372990b2..4f00dcb2 100644 --- a/crates/client/src/lib.rs +++ b/crates/client/src/lib.rs @@ -1,10 +1,16 @@ //! A client library for Warg component registries. #![deny(missing_docs)] -use crate::storage::{PackageInfo, PublishEntry}; +use crate::storage::PackageInfo; + +#[cfg(not(feature = "not-cli"))] +use crate::storage::PublishEntry; + use anyhow::{anyhow, Context, Result}; -use dialoguer::theme::ColorfulTheme; -use dialoguer::Confirm; + +#[cfg(not(feature = "not-cli"))] +use dialoguer::{theme::ColorfulTheme, Confirm}; + use indexmap::IndexMap; use reqwest::{Body, IntoUrl}; use secrecy::Secret; @@ -63,21 +69,27 @@ where content: C, namespace_map: N, api: api::Client, + #[cfg(not(feature = "not-cli"))] ignore_federation_hints: bool, + #[cfg(not(feature = "not-cli"))] auto_accept_federation_hints: bool, + #[cfg(not(feature = "not-cli"))] + disable_dialoguer: bool, } impl Client { /// Creates a new client for the given URL, registry storage, and /// content storage. + #[allow(clippy::too_many_arguments)] pub fn new( url: impl IntoUrl, registry: R, content: C, namespace_map: N, auth_token: Option>, - ignore_federation_hints: bool, - auto_accept_federation_hints: bool, + #[cfg(not(feature = "not-cli"))] ignore_federation_hints: bool, + #[cfg(not(feature = "not-cli"))] auto_accept_federation_hints: bool, + #[cfg(not(feature = "not-cli"))] disable_dialoguer: bool, ) -> ClientResult { let api = api::Client::new(url, auth_token)?; Ok(Self { @@ -85,8 +97,12 @@ impl Client Client = None; let (package, record) = loop { let mut info = publish_info.clone(); + + #[cfg(not(feature = "not-cli"))] let mut initializing = info.initializing(); + #[cfg(feature = "not-cli")] + let initializing = info.initializing(); + let package = match self.fetch_package(&info.name).await { Ok(package) => { if initializing { @@ -356,37 +379,42 @@ impl Client { - if !initializing { - let prompt = if has_auth_token { - format!( - "Package `{package_name}` was not found. + if !initializing && cfg!(feature = "not-cli") { + return Err(ClientError::MustInitializePackage { + name, + has_auth_token, + }); + } else if !initializing { + #[cfg(not(feature = "not-cli"))] + { + if self.disable_dialoguer { + return Err(ClientError::MustInitializePackage { + name, + has_auth_token, + }); + } + + if accepted_prompt_to_initialize + || Confirm::with_theme(&ColorfulTheme::default()) + .with_prompt(format!( + "Package `{package_name}` was not found. If it exists, you may not have access. Attempt to create `{package_name}` and publish the release y/N\n", - package_name = &info.name, - ) - } else { - format!( - "Package `{package_name}` was not found. -If it exists, you may not have access without logging in. Try: `warg login` -Attempt to create `{package_name}` and publish the release y/N\n", - package_name = &info.name, - ) - }; - if accepted_prompt_to_initialize - || Confirm::with_theme(&ColorfulTheme::default()) - .with_prompt(prompt) - .default(false) - .interact() - .unwrap() - { - info.entries.insert(0, PublishEntry::Init); - initializing = true; - accepted_prompt_to_initialize = true; - } else { - return Err(ClientError::MustInitializePackage { - name, - has_auth_token, - }); + package_name = &info.name, + )) + .default(false) + .interact() + .unwrap() + { + info.entries.insert(0, PublishEntry::Init); + initializing = true; + accepted_prompt_to_initialize = true; + } else { + return Err(ClientError::MustInitializePackage { + name, + has_auth_token, + }); + } } } PackageInfo::new(info.name.clone()) @@ -700,7 +728,13 @@ Attempt to create `{package_name}` and publish the release y/N\n", } // federated packages in other registries - let mut federated_packages: IndexMap, Vec<&mut PackageInfo>> = + #[cfg(not(feature = "not-cli"))] + let mut federated_packages: IndexMap< + Option, + Vec<&mut PackageInfo>, + > = IndexMap::with_capacity(packages.len()); + #[cfg(feature = "not-cli")] + let federated_packages: IndexMap, Vec<&mut PackageInfo>> = IndexMap::with_capacity(packages.len()); // loop and fetch logs @@ -745,10 +779,44 @@ Attempt to create `{package_name}` and publish the release y/N\n", Err(ClientError::Api(err)) } } + + #[cfg(feature = "not-cli")] + api::ClientError::LogNotFoundWithHint(log_id, hint) => { + let name = packages.get(log_id).unwrap().name.clone(); + + match hint.to_str().ok().map(|s| s.split_once('=')) { + Some(Some((namespace, registry))) if packages.contains_key(log_id) => { + Err(ClientError::PackageDoesNotExistWithHintHeader { + name, + has_auth_token, + hint_namespace: namespace.to_string(), + hint_registry: registry.to_string(), + }) + } + _ => Err(ClientError::PackageDoesNotExist { + name, + has_auth_token, + }), + } + } + + #[cfg(not(feature = "not-cli"))] api::ClientError::LogNotFoundWithHint(log_id, hint) => { match hint.to_str().ok().map(|s| s.split_once('=')) { Some(Some((namespace, registry))) - if !self.ignore_federation_hints + if self.disable_dialoguer && packages.contains_key(log_id) => + { + let name = packages.get(log_id).unwrap().name.clone(); + Err(ClientError::PackageDoesNotExistWithHintHeader { + name, + has_auth_token, + hint_namespace: namespace.to_string(), + hint_registry: registry.to_string(), + }) + } + Some(Some((namespace, registry))) + if !self.disable_dialoguer + && !self.ignore_federation_hints && packages.contains_key(log_id) => { let package_name = &packages.get(log_id).unwrap().name; @@ -1191,8 +1259,12 @@ impl FileSystemClient { content, namespace_map, auth_token, + #[cfg(not(feature = "not-cli"))] config.ignore_federation_hints, + #[cfg(not(feature = "not-cli"))] config.auto_accept_federation_hints, + #[cfg(not(feature = "not-cli"))] + config.disable_dialoguer, )?)) } @@ -1219,8 +1291,12 @@ impl FileSystemClient { FileSystemContentStorage::lock(content_dir)?, FileSystemNamespaceMapStorage::new(namespace_map_path), auth_token, + #[cfg(not(feature = "not-cli"))] config.ignore_federation_hints, + #[cfg(not(feature = "not-cli"))] config.auto_accept_federation_hints, + #[cfg(not(feature = "not-cli"))] + config.disable_dialoguer, ) } } @@ -1315,6 +1391,19 @@ pub enum ClientError { has_auth_token: bool, }, + /// The package does not exist with hint header. + #[error("package `{name}` does not exist but the registry suggests checking registry `{hint_registry}` for packages in namespace `{hint_namespace}`")] + PackageDoesNotExistWithHintHeader { + /// The missing package. + name: PackageName, + /// Client has authentication credentials. + has_auth_token: bool, + /// The hint namespace. + hint_namespace: String, + /// The hint registry. + hint_registry: String, + }, + /// The package version does not exist. #[error("version `{version}` of package `{name}` does not exist")] PackageVersionDoesNotExist { diff --git a/src/bin/warg.rs b/src/bin/warg.rs index 53c7bccd..7c79e79f 100644 --- a/src/bin/warg.rs +++ b/src/bin/warg.rs @@ -92,6 +92,19 @@ pub async fn describe_client_error(e: &ClientError) -> Result<()> { eprintln!("You may be required to login. Try: `warg login`"); } } + ClientError::PackageDoesNotExistWithHintHeader { + name, + has_auth_token, + hint_namespace, + hint_registry, + } => { + eprintln!( + "Package `{name}` was not found or you do not have access. +The registry suggests using registry `{hint_registry}` for packages in namespace `{hint_namespace}`."); + if !has_auth_token { + eprintln!("You may be required to login. Try: `warg login`"); + } + } ClientError::PackageVersionDoesNotExist { name, version } => { eprintln!("Package `{name}` version `{version}` was not found.") } diff --git a/src/commands/config.rs b/src/commands/config.rs index 3ed8a26c..9fe87cb0 100644 --- a/src/commands/config.rs +++ b/src/commands/config.rs @@ -80,6 +80,7 @@ impl ConfigCommand { keyring_auth: false, ignore_federation_hints: self.ignore_federation_hints, auto_accept_federation_hints: self.auto_accept_federation_hints, + disable_dialoguer: false, }; config.write_to_file(&path)?; diff --git a/tests/support/mod.rs b/tests/support/mod.rs index 97d476a2..00ad270a 100644 --- a/tests/support/mod.rs +++ b/tests/support/mod.rs @@ -169,6 +169,7 @@ pub async fn spawn_server( keyring_auth: false, ignore_federation_hints: false, auto_accept_federation_hints: false, + disable_dialoguer: true, }; Ok((instance, config)) From 86522f0cc50f88a1c1cd2d5fe815a0b7dce2fed2 Mon Sep 17 00:00:00 2001 From: Calvin Prewitt Date: Tue, 7 May 2024 08:30:30 -0500 Subject: [PATCH 05/14] added download to current working directory option; --- Cargo.toml | 2 +- src/commands/download.rs | 46 +++++++++++++++++++++++++++++++++++----- src/commands/login.rs | 2 +- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2f78bf12..5e7bf689 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,7 +67,7 @@ members = ["crates/server"] version = "0.5.0-dev" authors = ["The Warg Registry Project Developers"] edition = "2021" -rust-version = "1.66.0" +rust-version = "1.76.0" license = "Apache-2.0 WITH LLVM-exception" homepage = "https://warg.io/" repository = "https://github.com/bytecodealliance/registry" diff --git a/src/commands/download.rs b/src/commands/download.rs index b6301286..1e49808e 100644 --- a/src/commands/download.rs +++ b/src/commands/download.rs @@ -1,6 +1,8 @@ use super::CommonOptions; use anyhow::Result; use clap::Args; +use dialoguer::{theme::ColorfulTheme, Confirm}; +use std::path::PathBuf; use warg_client::ClientError; use warg_protocol::{registry::PackageName, VersionReq}; @@ -14,9 +16,12 @@ pub struct DownloadCommand { /// The package name to download. #[clap(value_name = "PACKAGE")] pub name: PackageName, - #[clap(long, short, value_name = "VERSION")] /// The version requirement of the package to download; defaults to `*`. + #[clap(long, short, value_name = "VERSION")] pub version: Option, + /// The output path for the file. If not specified, just downloads to local cache. + #[clap(long, short = 'o')] + pub output: Option, } impl DownloadCommand { @@ -33,7 +38,7 @@ impl DownloadCommand { None => VersionReq::STAR, }; - let res = client + let download = client .download(&self.name, &version) .await? .ok_or_else(|| ClientError::PackageVersionRequirementDoesNotExist { @@ -42,12 +47,43 @@ impl DownloadCommand { })?; println!( - "downloaded version {version} of package `{name}` ({digest})", + "Downloaded version {version} of package `{name}` ({digest}) to local cache", name = self.name, - version = res.version, - digest = res.digest + version = download.version, + digest = download.digest ); + // use the `output` path specified or ask the use if wants to save in the current working + // directory + let default_file_name = format!("{name}.wasm", name = self.name.name()); + if let Some(path) = self + .output + .map(|mut p| { + if p.is_file() { + p + } else { + p.push(&default_file_name); + p + } + }) + .or_else(|| { + if Confirm::with_theme(&ColorfulTheme::default()) + .with_prompt(format!( + "Write `{default_file_name}` in current directory? y/N\n", + )) + .default(true) + .interact() + .unwrap() + { + Some(PathBuf::from(default_file_name)) + } else { + None + } + }) + { + std::fs::copy(download.path, path)?; + } + Ok(()) } } diff --git a/src/commands/login.rs b/src/commands/login.rs index f0b87590..446349b0 100644 --- a/src/commands/login.rs +++ b/src/commands/login.rs @@ -63,7 +63,7 @@ impl LoginCommand { config.auto_accept_federation_hints = self.auto_accept_federation_hints; if home_url.is_some() { - config.home_url = home_url.clone(); + config.home_url.clone_from(home_url); config.write_to_file(&Config::default_config_path()?)?; // reset if changing home registry From f2a7992a2a4a3633459b81b08446b91835263892 Mon Sep 17 00:00:00 2001 From: Calvin Prewitt Date: Tue, 7 May 2024 08:34:16 -0500 Subject: [PATCH 06/14] clippy fix --- crates/client/src/depsolve.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/crates/client/src/depsolve.rs b/crates/client/src/depsolve.rs index 1d14f39b..445b2785 100644 --- a/crates/client/src/depsolve.rs +++ b/crates/client/src/depsolve.rs @@ -45,11 +45,16 @@ impl LockListBuilder { } #[async_recursion] - async fn parse_package( + async fn parse_package( &mut self, client: &Client, mut bytes: &[u8], - ) -> Result<()> { + ) -> Result<()> + where + R: RegistryStorage, + C: ContentStorage, + N: NamespaceMapStorage, + { let mut parser = Parser::new(0); let mut imports: Vec = Vec::new(); loop { @@ -157,11 +162,16 @@ impl LockListBuilder { /// List of deps for building #[async_recursion] - pub async fn build_list( + pub async fn build_list( &mut self, client: &Client, info: &PackageInfo, - ) -> Result<()> { + ) -> Result<()> + where + R: RegistryStorage, + C: ContentStorage, + N: NamespaceMapStorage, + { let release = info.state.releases().last(); if let Some(r) = release { let state = &r.state; From 70fe04e89ec0111608e48ada434d6a56cf03becd Mon Sep 17 00:00:00 2001 From: Calvin Prewitt Date: Tue, 7 May 2024 08:51:39 -0500 Subject: [PATCH 07/14] revised negative feature flag `not-cli` to positive `cli-interactive` --- Cargo.toml | 5 +-- crates/client/Cargo.toml | 5 +-- crates/client/src/config.rs | 6 ++-- crates/client/src/lib.rs | 66 ++++++++++++++++++------------------- src/commands/config.rs | 2 +- tests/support/mod.rs | 2 +- 6 files changed, 44 insertions(+), 42 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5e7bf689..c54ba418 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,9 +56,10 @@ wit-parser = "0.13.1" testresult = "0.3.0" [features] -default = [] +default = ["cli-interactive"] postgres = ["warg-server/postgres"] -not-cli = ["warg-client/not-cli"] +cli-interactive = ["warg-client/cli-interactive"] +not-interactive-cli = [] [workspace] members = ["crates/server"] diff --git a/crates/client/Cargo.toml b/crates/client/Cargo.toml index 9ebb2a30..1eb91e50 100644 --- a/crates/client/Cargo.toml +++ b/crates/client/Cargo.toml @@ -10,9 +10,10 @@ homepage = { workspace = true } repository = { workspace = true} [features] -default = ["dialoguer"] +default = ["cli-interactive"] native-tls-vendored = ["reqwest/native-tls-vendored"] -not-cli = [] +cli-interactive = ["dialoguer"] +not-interactive-cli = [] [dependencies] warg-crypto = { workspace = true } diff --git a/crates/client/src/config.rs b/crates/client/src/config.rs index b29d2838..46378cac 100644 --- a/crates/client/src/config.rs +++ b/crates/client/src/config.rs @@ -123,9 +123,9 @@ pub struct Config { #[serde(default)] pub auto_accept_federation_hints: bool, - /// Disable dialoguer prompts. + /// Disable interactive prompts. #[serde(default)] - pub disable_dialoguer: bool, + pub disable_interactive: bool, } impl Config { @@ -206,7 +206,7 @@ impl Config { keyring_auth: self.keyring_auth, ignore_federation_hints: self.ignore_federation_hints, auto_accept_federation_hints: self.auto_accept_federation_hints, - disable_dialoguer: self.disable_dialoguer, + disable_interactive: self.disable_interactive, }; serde_json::to_writer_pretty( diff --git a/crates/client/src/lib.rs b/crates/client/src/lib.rs index 4f00dcb2..a7ccb4ee 100644 --- a/crates/client/src/lib.rs +++ b/crates/client/src/lib.rs @@ -3,12 +3,12 @@ #![deny(missing_docs)] use crate::storage::PackageInfo; -#[cfg(not(feature = "not-cli"))] +#[cfg(feature = "cli-interactive")] use crate::storage::PublishEntry; use anyhow::{anyhow, Context, Result}; -#[cfg(not(feature = "not-cli"))] +#[cfg(feature = "cli-interactive")] use dialoguer::{theme::ColorfulTheme, Confirm}; use indexmap::IndexMap; @@ -69,12 +69,12 @@ where content: C, namespace_map: N, api: api::Client, - #[cfg(not(feature = "not-cli"))] + #[cfg(feature = "cli-interactive")] ignore_federation_hints: bool, - #[cfg(not(feature = "not-cli"))] + #[cfg(feature = "cli-interactive")] auto_accept_federation_hints: bool, - #[cfg(not(feature = "not-cli"))] - disable_dialoguer: bool, + #[cfg(feature = "cli-interactive")] + disable_interactive: bool, } impl Client { @@ -87,9 +87,9 @@ impl Client>, - #[cfg(not(feature = "not-cli"))] ignore_federation_hints: bool, - #[cfg(not(feature = "not-cli"))] auto_accept_federation_hints: bool, - #[cfg(not(feature = "not-cli"))] disable_dialoguer: bool, + #[cfg(feature = "cli-interactive")] ignore_federation_hints: bool, + #[cfg(feature = "cli-interactive")] auto_accept_federation_hints: bool, + #[cfg(feature = "cli-interactive")] disable_interactive: bool, ) -> ClientResult { let api = api::Client::new(url, auth_token)?; Ok(Self { @@ -97,12 +97,12 @@ impl Client Client = None; @@ -355,10 +355,10 @@ impl Client Client { - if !initializing && cfg!(feature = "not-cli") { + if !initializing && cfg!(not(feature = "cli-interactive")) { return Err(ClientError::MustInitializePackage { name, has_auth_token, }); } else if !initializing { - #[cfg(not(feature = "not-cli"))] + #[cfg(feature = "cli-interactive")] { - if self.disable_dialoguer { + if self.disable_interactive { return Err(ClientError::MustInitializePackage { name, has_auth_token, @@ -728,12 +728,12 @@ Attempt to create `{package_name}` and publish the release y/N\n", } // federated packages in other registries - #[cfg(not(feature = "not-cli"))] + #[cfg(feature = "cli-interactive")] let mut federated_packages: IndexMap< Option, Vec<&mut PackageInfo>, > = IndexMap::with_capacity(packages.len()); - #[cfg(feature = "not-cli")] + #[cfg(not(feature = "cli-interactive"))] let federated_packages: IndexMap, Vec<&mut PackageInfo>> = IndexMap::with_capacity(packages.len()); @@ -780,7 +780,7 @@ Attempt to create `{package_name}` and publish the release y/N\n", } } - #[cfg(feature = "not-cli")] + #[cfg(not(feature = "cli-interactive"))] api::ClientError::LogNotFoundWithHint(log_id, hint) => { let name = packages.get(log_id).unwrap().name.clone(); @@ -800,11 +800,11 @@ Attempt to create `{package_name}` and publish the release y/N\n", } } - #[cfg(not(feature = "not-cli"))] + #[cfg(feature = "cli-interactive")] api::ClientError::LogNotFoundWithHint(log_id, hint) => { match hint.to_str().ok().map(|s| s.split_once('=')) { Some(Some((namespace, registry))) - if self.disable_dialoguer && packages.contains_key(log_id) => + if self.disable_interactive && packages.contains_key(log_id) => { let name = packages.get(log_id).unwrap().name.clone(); Err(ClientError::PackageDoesNotExistWithHintHeader { @@ -815,7 +815,7 @@ Attempt to create `{package_name}` and publish the release y/N\n", }) } Some(Some((namespace, registry))) - if !self.disable_dialoguer + if !self.disable_interactive && !self.ignore_federation_hints && packages.contains_key(log_id) => { @@ -1259,12 +1259,12 @@ impl FileSystemClient { content, namespace_map, auth_token, - #[cfg(not(feature = "not-cli"))] + #[cfg(feature = "cli-interactive")] config.ignore_federation_hints, - #[cfg(not(feature = "not-cli"))] + #[cfg(feature = "cli-interactive")] config.auto_accept_federation_hints, - #[cfg(not(feature = "not-cli"))] - config.disable_dialoguer, + #[cfg(feature = "cli-interactive")] + config.disable_interactive, )?)) } @@ -1291,12 +1291,12 @@ impl FileSystemClient { FileSystemContentStorage::lock(content_dir)?, FileSystemNamespaceMapStorage::new(namespace_map_path), auth_token, - #[cfg(not(feature = "not-cli"))] + #[cfg(feature = "cli-interactive")] config.ignore_federation_hints, - #[cfg(not(feature = "not-cli"))] + #[cfg(feature = "cli-interactive")] config.auto_accept_federation_hints, - #[cfg(not(feature = "not-cli"))] - config.disable_dialoguer, + #[cfg(feature = "cli-interactive")] + config.disable_interactive, ) } } diff --git a/src/commands/config.rs b/src/commands/config.rs index 9fe87cb0..c584f57f 100644 --- a/src/commands/config.rs +++ b/src/commands/config.rs @@ -80,7 +80,7 @@ impl ConfigCommand { keyring_auth: false, ignore_federation_hints: self.ignore_federation_hints, auto_accept_federation_hints: self.auto_accept_federation_hints, - disable_dialoguer: false, + disable_interactive: false, }; config.write_to_file(&path)?; diff --git a/tests/support/mod.rs b/tests/support/mod.rs index 00ad270a..b5c787b6 100644 --- a/tests/support/mod.rs +++ b/tests/support/mod.rs @@ -169,7 +169,7 @@ pub async fn spawn_server( keyring_auth: false, ignore_federation_hints: false, auto_accept_federation_hints: false, - disable_dialoguer: true, + disable_interactive: true, }; Ok((instance, config)) From 27d349f7cc5bd9d4e093fa1d703273047c140188 Mon Sep 17 00:00:00 2001 From: Calvin Prewitt Date: Tue, 7 May 2024 08:52:36 -0500 Subject: [PATCH 08/14] removed unused wasmtime dep --- Cargo.lock | 1145 ++-------------------------------------------------- Cargo.toml | 2 - 2 files changed, 23 insertions(+), 1124 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 87a5df91..bf3c8871 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,22 +2,13 @@ # 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 0.28.1", + "gimli", ] [[package]] @@ -38,18 +29,6 @@ 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" @@ -59,12 +38,6 @@ 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" @@ -149,12 +122,6 @@ 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" @@ -429,12 +396,12 @@ version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ - "addr2line 0.21.0", + "addr2line", "cc", "cfg-if", "libc", "miniz_oxide", - "object 0.32.2", + "object", "rustc-demangle", ] @@ -462,15 +429,6 @@ 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" @@ -551,69 +509,6 @@ 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" @@ -626,7 +521,6 @@ version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ - "jobserver", "libc", ] @@ -793,15 +687,6 @@ 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" @@ -811,123 +696,6 @@ 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" @@ -1071,15 +839,6 @@ 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" @@ -1237,25 +996,6 @@ 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" @@ -1288,17 +1028,6 @@ 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" @@ -1375,19 +1104,6 @@ dependencies = [ "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" @@ -1484,17 +1200,6 @@ 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" @@ -1505,16 +1210,6 @@ 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" @@ -1557,17 +1252,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fs-set-times" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d167b646a876ba8fda6b50ac645cfd96242553cbaf0ca4fccaa39afcbf0801f" -dependencies = [ - "io-lifetimes 1.0.11", - "rustix 0.38.31", - "windows-sys 0.48.0", -] - [[package]] name = "futures" version = "0.3.30" @@ -1685,28 +1369,6 @@ 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" @@ -1729,17 +1391,6 @@ 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" @@ -1811,15 +1462,6 @@ 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" @@ -1954,12 +1596,6 @@ 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" @@ -2122,16 +1758,6 @@ 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" @@ -2143,12 +1769,6 @@ dependencies = [ "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" @@ -2199,35 +1819,6 @@ 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" @@ -2408,15 +1999,6 @@ dependencies = [ "logos-codegen 0.14.0", ] -[[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" @@ -2432,12 +2014,6 @@ 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" @@ -2454,15 +2030,6 @@ 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" @@ -2472,15 +2039,6 @@ 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" @@ -2736,18 +2294,6 @@ dependencies = [ "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" @@ -2901,12 +2447,6 @@ 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" @@ -3302,15 +2842,6 @@ 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" @@ -3327,17 +2858,6 @@ dependencies = [ "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" @@ -3426,19 +2946,6 @@ 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" @@ -3553,12 +3060,6 @@ 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" @@ -3567,11 +3068,9 @@ checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" dependencies = [ "bitflags 1.3.2", "errno", - "io-lifetimes 1.0.11", - "itoa", + "io-lifetimes", "libc", "linux-raw-sys 0.3.8", - "once_cell", "windows-sys 0.48.0", ] @@ -3911,15 +3410,6 @@ 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" @@ -3964,12 +3454,6 @@ 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" @@ -4015,18 +3499,6 @@ 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" @@ -4111,28 +3583,6 @@ 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" @@ -4145,15 +3595,6 @@ 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" @@ -4606,12 +4047,6 @@ 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" @@ -4702,14 +4137,12 @@ dependencies = [ "warg-protocol", "warg-server", "wasm-compose", - "wasm-encoder 0.41.2", - "wasmparser 0.121.2", + "wasm-encoder", + "wasmparser", "wasmprinter", - "wasmtime", - "wasmtime-wasi", "wat", "wit-component", - "wit-parser 0.13.2", + "wit-parser", ] [[package]] @@ -4722,7 +4155,7 @@ dependencies = [ "bytes", "clap", "dialoguer", - "dirs 5.0.1", + "dirs", "futures-util", "indexmap 2.2.4", "itertools 0.12.1", @@ -4749,8 +4182,8 @@ dependencies = [ "warg-protocol", "warg-transparency", "wasm-compose", - "wasm-encoder 0.41.2", - "wasmparser 0.121.2", + "wasm-encoder", + "wasmparser", "wasmprinter", "windows-sys 0.52.0", ] @@ -4824,7 +4257,7 @@ dependencies = [ "warg-crypto", "warg-protobuf", "warg-transparency", - "wasmparser 0.121.2", + "wasmparser", ] [[package]] @@ -4860,7 +4293,7 @@ dependencies = [ "warg-crypto", "warg-protocol", "warg-transparency", - "wasmparser 0.121.2", + "wasmparser", ] [[package]] @@ -4884,50 +4317,6 @@ 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 = "wasite" version = "0.1.0" @@ -5016,20 +4405,11 @@ dependencies = [ "serde_derive", "serde_yaml", "smallvec", - "wasm-encoder 0.41.2", - "wasmparser 0.121.2", + "wasm-encoder", + "wasmparser", "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.2" @@ -5037,7 +4417,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "972f97a5d8318f908dded23594188a90bcd09365986b1163e66d70170e5287ae" dependencies = [ "leb128", - "wasmparser 0.121.2", + "wasmparser", ] [[package]] @@ -5052,8 +4432,8 @@ dependencies = [ "serde_derive", "serde_json", "spdx", - "wasm-encoder 0.41.2", - "wasmparser 0.121.2", + "wasm-encoder", + "wasmparser", ] [[package]] @@ -5069,16 +4449,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "wasmparser" -version = "0.107.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29e3ac9b780c7dda0cac7a52a5d6d2d6707cc6e3451c9db209b6c758f40d7acb" -dependencies = [ - "indexmap 1.9.3", - "semver", -] - [[package]] name = "wasmparser" version = "0.121.2" @@ -5097,320 +4467,7 @@ 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 = "35.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ef140f1b49946586078353a453a1d28ba90adfc54dde75710bc1931de204d68" -dependencies = [ - "leb128", + "wasmparser", ] [[package]] @@ -5423,7 +4480,7 @@ dependencies = [ "leb128", "memchr", "unicode-width", - "wasm-encoder 0.41.2", + "wasm-encoder", ] [[package]] @@ -5432,7 +4489,7 @@ version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b69c36f634411568a2c6d24828b674961e37ea03340fe1d605c337ed8162d901" dependencies = [ - "wast 71.0.1", + "wast", ] [[package]] @@ -5468,48 +4525,6 @@ 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" @@ -5541,22 +4556,6 @@ 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" @@ -5726,27 +4725,6 @@ 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.3" @@ -5760,26 +4738,10 @@ dependencies = [ "serde 1.0.196", "serde_derive", "serde_json", - "wasm-encoder 0.41.2", + "wasm-encoder", "wasm-metadata", - "wasmparser 0.121.2", - "wit-parser 0.13.2", -] - -[[package]] -name = "wit-parser" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6daec9f093dbaea0e94043eeb92ece327bbbe70c86b1f41aca9bbfefd7f050f0" -dependencies = [ - "anyhow", - "id-arena", - "indexmap 1.9.3", - "log", - "pulldown-cmark", - "semver", - "unicode-xid", - "url", + "wasmparser", + "wit-parser", ] [[package]] @@ -5799,18 +4761,6 @@ dependencies = [ "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" @@ -5902,61 +4852,12 @@ dependencies = [ "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" diff --git a/Cargo.toml b/Cargo.toml index c54ba418..37fff047 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,8 +31,6 @@ 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 From f62fe12c1942a6ec04e50417c0b0f0ba7098a2de Mon Sep 17 00:00:00 2001 From: Calvin Prewitt Date: Tue, 7 May 2024 08:56:38 -0500 Subject: [PATCH 09/14] revised `id.parse::()` to `AnyHash::from_str(&id)` --- crates/api/src/v1/content.rs | 3 ++- crates/api/src/v1/fetch.rs | 3 ++- crates/api/src/v1/package.rs | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/api/src/v1/content.rs b/crates/api/src/v1/content.rs index c485f32a..8716499a 100644 --- a/crates/api/src/v1/content.rs +++ b/crates/api/src/v1/content.rs @@ -5,6 +5,7 @@ use crate::Status; use indexmap::IndexMap; use serde::{de::Unexpected, Deserialize, Serialize, Serializer}; use std::borrow::Cow; +use std::str::FromStr; use thiserror::Error; use warg_crypto::hash::AnyHash; @@ -95,7 +96,7 @@ impl<'de> Deserialize<'de> for ContentError { match RawError::::deserialize(deserializer)? { RawError::NotFound { status: _, ty, id } => match ty { EntityType::ContentDigest => Ok(Self::ContentDigestNotFound( - id.parse::().map_err(|_| { + AnyHash::from_str(&id).map_err(|_| { serde::de::Error::invalid_value(Unexpected::Str(&id), &"a valid digest") })?, )), diff --git a/crates/api/src/v1/fetch.rs b/crates/api/src/v1/fetch.rs index 1937a6cf..de736afc 100644 --- a/crates/api/src/v1/fetch.rs +++ b/crates/api/src/v1/fetch.rs @@ -4,6 +4,7 @@ use crate::Status; use indexmap::IndexMap; use serde::{de::Unexpected, Deserialize, Serialize, Serializer}; use std::borrow::Cow; +use std::str::FromStr; use thiserror::Error; use warg_crypto::hash::AnyHash; use warg_protocol::{ @@ -187,7 +188,7 @@ impl<'de> Deserialize<'de> for FetchError { RawError::CheckpointNotFound { id, .. } => Ok(Self::CheckpointNotFound(id)), RawError::NotFound { status: _, ty, id } => match ty { EntityType::Log => Ok(Self::LogNotFound( - id.parse::() + AnyHash::from_str(&id) .map_err(|_| { serde::de::Error::invalid_value(Unexpected::Str(&id), &"a valid log id") })? diff --git a/crates/api/src/v1/package.rs b/crates/api/src/v1/package.rs index 356b468d..a7ca3579 100644 --- a/crates/api/src/v1/package.rs +++ b/crates/api/src/v1/package.rs @@ -5,6 +5,7 @@ use crate::Status; use indexmap::IndexMap; use serde::{de::Unexpected, Deserialize, Serialize, Serializer}; use std::borrow::Cow; +use std::str::FromStr; use thiserror::Error; use warg_crypto::hash::AnyHash; use warg_protocol::{ @@ -286,14 +287,14 @@ impl<'de> Deserialize<'de> for PackageError { } RawError::NotFound { status: _, ty, id } => match ty { EntityType::Log => Ok(Self::LogNotFound( - id.parse::() + AnyHash::from_str(&id) .map_err(|_| { serde::de::Error::invalid_value(Unexpected::Str(&id), &"a valid log id") })? .into(), )), EntityType::Record => Ok(Self::RecordNotFound( - id.parse::() + AnyHash::from_str(&id) .map_err(|_| { serde::de::Error::invalid_value( Unexpected::Str(&id), @@ -311,7 +312,7 @@ impl<'de> Deserialize<'de> for PackageError { RawError::Conflict { status: _, ty, id } => match ty { EntityType::NamespaceImport => Ok(Self::NamespaceImported(id.into_owned())), EntityType::Record => Ok(Self::ConflictPendingPublish( - id.parse::() + AnyHash::from_str(&id) .map_err(|_| { serde::de::Error::invalid_value( Unexpected::Str(&id), From 8ebed4c3a11ae0847ac957f1f544591aa9341355 Mon Sep 17 00:00:00 2001 From: Calvin Prewitt Date: Tue, 7 May 2024 09:05:27 -0500 Subject: [PATCH 10/14] added `dep:` prefix to be more explicit in the Cargo.toml feature flag dependency --- crates/client/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/client/Cargo.toml b/crates/client/Cargo.toml index 1eb91e50..d6ff0378 100644 --- a/crates/client/Cargo.toml +++ b/crates/client/Cargo.toml @@ -12,7 +12,7 @@ repository = { workspace = true} [features] default = ["cli-interactive"] native-tls-vendored = ["reqwest/native-tls-vendored"] -cli-interactive = ["dialoguer"] +cli-interactive = ["dep:dialoguer"] not-interactive-cli = [] [dependencies] From 3c8efdca54fcabe621db051781bb058b7e7ec743 Mon Sep 17 00:00:00 2001 From: Calvin Prewitt Date: Tue, 7 May 2024 09:07:01 -0500 Subject: [PATCH 11/14] removed not needed empty feature flag --- Cargo.toml | 1 - crates/client/Cargo.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 37fff047..fa599379 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,7 +57,6 @@ testresult = "0.3.0" default = ["cli-interactive"] postgres = ["warg-server/postgres"] cli-interactive = ["warg-client/cli-interactive"] -not-interactive-cli = [] [workspace] members = ["crates/server"] diff --git a/crates/client/Cargo.toml b/crates/client/Cargo.toml index d6ff0378..daddeed6 100644 --- a/crates/client/Cargo.toml +++ b/crates/client/Cargo.toml @@ -13,7 +13,6 @@ repository = { workspace = true} default = ["cli-interactive"] native-tls-vendored = ["reqwest/native-tls-vendored"] cli-interactive = ["dep:dialoguer"] -not-interactive-cli = [] [dependencies] warg-crypto = { workspace = true } From a692b158a1c7a059f68746c3558b8ef0b836d46b Mon Sep 17 00:00:00 2001 From: Calvin Prewitt Date: Tue, 7 May 2024 09:59:05 -0500 Subject: [PATCH 12/14] simpilfied feature flag --- crates/client/src/lib.rs | 79 +++++++++++----------------------------- 1 file changed, 22 insertions(+), 57 deletions(-) diff --git a/crates/client/src/lib.rs b/crates/client/src/lib.rs index a7ccb4ee..0618f098 100644 --- a/crates/client/src/lib.rs +++ b/crates/client/src/lib.rs @@ -3,14 +3,8 @@ #![deny(missing_docs)] use crate::storage::PackageInfo; -#[cfg(feature = "cli-interactive")] -use crate::storage::PublishEntry; - use anyhow::{anyhow, Context, Result}; -#[cfg(feature = "cli-interactive")] -use dialoguer::{theme::ColorfulTheme, Confirm}; - use indexmap::IndexMap; use reqwest::{Body, IntoUrl}; use secrecy::Secret; @@ -69,11 +63,8 @@ where content: C, namespace_map: N, api: api::Client, - #[cfg(feature = "cli-interactive")] ignore_federation_hints: bool, - #[cfg(feature = "cli-interactive")] auto_accept_federation_hints: bool, - #[cfg(feature = "cli-interactive")] disable_interactive: bool, } @@ -87,9 +78,9 @@ impl Client>, - #[cfg(feature = "cli-interactive")] ignore_federation_hints: bool, - #[cfg(feature = "cli-interactive")] auto_accept_federation_hints: bool, - #[cfg(feature = "cli-interactive")] disable_interactive: bool, + ignore_federation_hints: bool, + auto_accept_federation_hints: bool, + disable_interactive: bool, ) -> ClientResult { let api = api::Client::new(url, auth_token)?; Ok(Self { @@ -97,11 +88,8 @@ impl Client Client = None; @@ -355,12 +342,8 @@ impl Client { if initializing { @@ -379,7 +362,7 @@ impl Client { - if !initializing && cfg!(not(feature = "cli-interactive")) { + if !initializing && self.disable_interactive { return Err(ClientError::MustInitializePackage { name, has_auth_token, @@ -387,12 +370,8 @@ impl Client, - Vec<&mut PackageInfo>, - > = IndexMap::with_capacity(packages.len()); - #[cfg(not(feature = "cli-interactive"))] - let federated_packages: IndexMap, Vec<&mut PackageInfo>> = + let mut federated_packages: IndexMap, Vec<&mut PackageInfo>> = IndexMap::with_capacity(packages.len()); // loop and fetch logs @@ -780,8 +753,9 @@ Attempt to create `{package_name}` and publish the release y/N\n", } } - #[cfg(not(feature = "cli-interactive"))] - api::ClientError::LogNotFoundWithHint(log_id, hint) => { + api::ClientError::LogNotFoundWithHint(log_id, hint) + if self.disable_interactive => + { let name = packages.get(log_id).unwrap().name.clone(); match hint.to_str().ok().map(|s| s.split_once('=')) { @@ -804,21 +778,11 @@ Attempt to create `{package_name}` and publish the release y/N\n", api::ClientError::LogNotFoundWithHint(log_id, hint) => { match hint.to_str().ok().map(|s| s.split_once('=')) { Some(Some((namespace, registry))) - if self.disable_interactive && packages.contains_key(log_id) => - { - let name = packages.get(log_id).unwrap().name.clone(); - Err(ClientError::PackageDoesNotExistWithHintHeader { - name, - has_auth_token, - hint_namespace: namespace.to_string(), - hint_registry: registry.to_string(), - }) - } - Some(Some((namespace, registry))) - if !self.disable_interactive - && !self.ignore_federation_hints + if !self.ignore_federation_hints && packages.contains_key(log_id) => { + use dialoguer::{theme::ColorfulTheme, Confirm}; + let package_name = &packages.get(log_id).unwrap().name; if self.auto_accept_federation_hints @@ -1253,18 +1217,18 @@ impl FileSystemClient { (_, None, _) => return Ok(StorageLockResult::NotAcquired(content_dir)), }; + let disable_interactive = + cfg!(not(feature = "cli-interactive")) || config.disable_interactive; + Ok(StorageLockResult::Acquired(Self::new( url.into_url(), packages, content, namespace_map, auth_token, - #[cfg(feature = "cli-interactive")] config.ignore_federation_hints, - #[cfg(feature = "cli-interactive")] config.auto_accept_federation_hints, - #[cfg(feature = "cli-interactive")] - config.disable_interactive, + disable_interactive, )?)) } @@ -1285,18 +1249,19 @@ impl FileSystemClient { content_dir, namespace_map_path, } = config.storage_paths_for_url(url)?; + + let disable_interactive = + cfg!(not(feature = "cli-interactive")) || config.disable_interactive; + Self::new( registry_url.into_url(), FileSystemRegistryStorage::lock(registries_dir)?, FileSystemContentStorage::lock(content_dir)?, FileSystemNamespaceMapStorage::new(namespace_map_path), auth_token, - #[cfg(feature = "cli-interactive")] config.ignore_federation_hints, - #[cfg(feature = "cli-interactive")] config.auto_accept_federation_hints, - #[cfg(feature = "cli-interactive")] - config.disable_interactive, + disable_interactive, ) } } From 09151caaf5352cdc48e5a1e695510d0de3eed362 Mon Sep 17 00:00:00 2001 From: Calvin Prewitt Date: Tue, 7 May 2024 10:19:08 -0500 Subject: [PATCH 13/14] fixed conditional block --- crates/client/src/lib.rs | 14 ++++++++------ http.wasm | Bin 0 -> 45009 bytes 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 http.wasm diff --git a/crates/client/src/lib.rs b/crates/client/src/lib.rs index 0618f098..78e9979d 100644 --- a/crates/client/src/lib.rs +++ b/crates/client/src/lib.rs @@ -362,12 +362,14 @@ impl Client { - if !initializing && self.disable_interactive { - return Err(ClientError::MustInitializePackage { - name, - has_auth_token, - }); - } else if !initializing { + if !initializing { + if self.disable_interactive || cfg!(not(feature = "cli-interactive")) { + return Err(ClientError::MustInitializePackage { + name, + has_auth_token, + }); + } + #[cfg(feature = "cli-interactive")] { use crate::storage::PublishEntry; diff --git a/http.wasm b/http.wasm new file mode 100644 index 0000000000000000000000000000000000000000..a5f5c85a32d1e6a171016050072330d6874168ba GIT binary patch literal 45009 zcmeHw+m9sId0(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ZEbw;Wd%&W)l?ZLk1=Od_s-2Jm1gGci7`(eId({z?sun;OiohUF zZw1_?Bl!}&=nfRevU~ye+iNGc2X)!psy)pqj!<0)Z>nArm0GvYTkX0W+qTI^{S&MyVwB=uA7OPVjKWo7 zFmE};9)$DC4QhmEhj=l@bRYIV3>7V#2CObJS-Wj6OM)y{&CyO48%90kXefv%>8Ujfh4p?FQto*zbCZ!iNuVRm`FR`Q^vh!%2BzSMgad_ZD1DOq_0vrni z(nuy{iAn>+TnM5n)ic9TO*yZfZ~+w$*7H_9Z{!)Mg0JP44)6@slgf;Xap5DiVqrVK zxR3U-If7!HSWkL;47!tUksb(}TZOlwEp#GGYJZ`Rj*>Cz=-&Y_(z|ejaiRp=Hm5B? zHZUahDLU}>4m<$A8nNWQPd$A+7bEN#_hps^FKj9&dU$%~*5I3iTYm~?V+aQT literal 0 HcmV?d00001 From 6f383df960d4a134ba50a990f8c5f98110f08e25 Mon Sep 17 00:00:00 2001 From: Calvin Prewitt Date: Tue, 7 May 2024 11:10:35 -0500 Subject: [PATCH 14/14] removed accidential `http.wasm` file; fixed incorrect logic for download output path --- http.wasm | Bin 45009 -> 0 bytes src/commands/download.rs | 11 +++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) delete mode 100644 http.wasm diff --git a/http.wasm b/http.wasm deleted file mode 100644 index a5f5c85a32d1e6a171016050072330d6874168ba..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 45009 zcmeHw+m9sId0(CB**llyl3ZRSQZ6oKb1854t|ZHeHaE`lA}vBv%+AQNts&4g-8Ivt z>8WZ~b?FGkJ3t--8;FBEBteiMjt%(5{{6o1oKvT& zx`(?oC9RcyA!n=Wob#RUemke4q&m7BndscVc-3q@VeXjC==`jhPLsW9+A}@#)NxW} zx3l6VAHIHT@U_9MGtovbs^2nq&TjNJOk-dand8mqT$We!B%k-94gT}|cu^+vtjK%O zX3xAV6OX3F=&-tZROH3H$g@#j9@up@1e`NzSr#Q>dD_7u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n)ic9TO*yZfZ~+w$*7H_9Z{!)Mg0JP44)6@slgf;Xap5DiVqrVK zxR3U-If7!HSWkL;47!tUksb(}TZOlwEp#GGYJZ`Rj*>Cz=-&Y_(z|ejaiRp=Hm5B? zHZUahDLU}>4m<$A8nNWQPd$A+7bEN#_hps^FKj9&dU$%~*5I3iTYm~?V+aQT diff --git a/src/commands/download.rs b/src/commands/download.rs index 1e49808e..af810a25 100644 --- a/src/commands/download.rs +++ b/src/commands/download.rs @@ -59,7 +59,9 @@ impl DownloadCommand { if let Some(path) = self .output .map(|mut p| { - if p.is_file() { + if p.extension() + .is_some_and(|ext| ext.eq_ignore_ascii_case("wasm")) + { p } else { p.push(&default_file_name); @@ -81,7 +83,12 @@ impl DownloadCommand { } }) { - std::fs::copy(download.path, path)?; + std::fs::copy(download.path, &path)?; + println!( + "Wrote `{name}` to {path}", + name = self.name, + path = path.display(), + ); } Ok(())