Skip to content

Commit

Permalink
Update test plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Oct 26, 2023
1 parent 82be6c7 commit b1c4da0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 27 deletions.
1 change: 1 addition & 0 deletions crates/pdk-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ pub use hooks::*;
pub use host::*;
pub use host_funcs::*;
pub use system_env::{DependencyConfig, DependencyName, SystemDependency, SystemPackageManager};
pub use version_spec::*;
pub use warpgate_api::*;
2 changes: 1 addition & 1 deletion crates/version-spec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub fn is_alias_name<T: AsRef<str>>(value: T) -> bool {
})
}

pub static CLEAN_VERSION: Lazy<Regex> = Lazy::new(|| Regex::new(r"([><]=?)\s+(\d)").unwrap());
static CLEAN_VERSION: Lazy<Regex> = Lazy::new(|| Regex::new(r"([><]=?)\s+(\d)").unwrap());

pub fn clean_version_string<T: AsRef<str>>(value: T) -> String {
let value = value.as_ref().trim().replace(".*", "");
Expand Down
38 changes: 16 additions & 22 deletions plugins/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions plugins/wasm-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ pub fn parse_version_file(

if input.file == ".proto-wasm-version" {
if input.content.starts_with("version=") {
version = Some(input.content[8..].into());
version = Some(UnresolvedVersionSpec::parse(&input.content[8..])?);
}
} else {
version = Some(input.content);
version = Some(UnresolvedVersionSpec::parse(input.content)?);
}

Ok(Json(ParseVersionFileOutput { version }))
Expand Down Expand Up @@ -148,8 +148,10 @@ pub fn resolve_version(
) -> FnResult<Json<ResolveVersionOutput>> {
let mut output = ResolveVersionOutput::default();

if input.initial == "node" {
output.candidate = Some("latest".into());
if let UnresolvedVersionSpec::Alias(alias) = &input.initial {
if alias == "node" {
output.candidate = Some(UnresolvedVersionSpec::Alias("latest".into()));
}
}

Ok(Json(output))
Expand Down

0 comments on commit b1c4da0

Please sign in to comment.