Skip to content
This repository was archived by the owner on Jun 14, 2023. It is now read-only.
Open
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
1,499 changes: 859 additions & 640 deletions Cargo.lock

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,57 @@ description = "WebAssembly Package Manager CLI"
license = "MIT"

[dependencies]
billboard = { version = "0.1.0", optional = true }
billboard = { version = "0.2.0", optional = true }
chrono = { version = "0.4", features = ["serde"] }
colored = { version = "1.8", optional = true }
colored = { version = "2.0", optional = true }
dirs = { version = "4", optional = true }
anyhow = "1"
thiserror = "1.0"
fern = {version = "0.6", features = ["colored"]}
flate2 = "1.0.7"
graphql_client = "0.9"
graphql_client = "0.12"
lazy_static = "1.3"
license-exprs = "1.4.0"
log = "0.4"
maplit = { version = "1", optional = true }
minisign = "0.5"
prettytable-rs = { version = "0.8.0", optional = true }
minisign = "0.7"
prettytable-rs = { version = "0.10.0", optional = true }
regex = "1"
rpassword-wasi = "5"
rusqlite = { version = "0.24", optional = true }
rusqlite = { version = "0.28", optional = true }
semver = { version = "1.0", features = ["serde"] }
sentry = { version = "0.22.0", optional = true, features = ["anyhow", "panic", "backtrace"] }
sentry = { version = "0.30.0", optional = true, features = ["anyhow", "panic", "backtrace"] }
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
structopt = { version = "0.3", features = ["color"] }
tempfile = "3"
time = "0.1"
toml = "0.5.6"
toml = "0.7"
url = "2"
wapm-toml = { version = "0.3.0" }
wasmer-wasm-interface = { version = "0.1.0", path = "lib/wasm-interface" }
wasmparser = "0.51.4"
dialoguer = "0.4.0"
wasmparser = "0.102"
dialoguer = "0.10.0"
hex = { version = "0.4", optional = true }
blake3 = { version = "0.3.1", optional = true }
blake3 = { version = "1.3.3", optional = true }
sublime_fuzzy = "0.7.0"
indicatif = { version = "0.17.1", features = ["improved_unicode"] }
console = "0.15.2"

[target.'cfg(not(target_os = "wasi"))'.dependencies]
whoami = "1.1.5"
whoami = "1.3"
atty = "0.2"
reqwest = { version = "0.11.0", features = ["native-tls-vendored", "blocking", "json", "gzip","socks","multipart"], optional = true }
tar = { version = "0.4" }

[target.'cfg(target_os = "wasi")'.dependencies]
whoami = "0.5"
whoami = "1.3"
wasm-bus-reqwest = "1.0"
wasm-bus-process = "1.0"
getrandom = "0.2.3"
tar = { package = "tar-wasi", version = "0.4" }
serde_yaml = { version = "^0.8" }
serde_yaml = { version = "^0.9" }

[dev-dependencies]
tempfile = "3"
Expand Down
1 change: 0 additions & 1 deletion src/commands/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ pub fn sign_compressed_archive(
)?),
&private_key,
compressed_archive,
false,
None,
None,
)?
Expand Down
2 changes: 1 addition & 1 deletion src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ fn apply_migration(conn: &mut Connection, migration_number: i32) -> Result<(), M
));
}
}
tx.pragma_update(None, "user_version", &(migration_number + 1))
tx.pragma_update(None, "user_version", migration_number + 1)
.map_err(|e| MigrationError::TransactionFailed(migration_number, format!("{}", e)))?;
tx.commit()
.map_err(|_| MigrationError::CommitFailed(migration_number))
Expand Down
2 changes: 1 addition & 1 deletion src/dataflow/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub enum Error {
#[graphql(
schema_path = "graphql/schema.graphql",
query_path = "graphql/queries/get_bindings.graphql",
response_derives = "Debug"
response_derives = "Debug,PartialEq"
)]
struct GetBindingsQuery;

Expand Down
2 changes: 1 addition & 1 deletion src/dataflow/installed_packages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,6 @@ fn verify_signature_on_package(
let sig_box = minisign::SignatureBox::from_string(signature_to_use)
.map_err(|e| anyhow!("Error with downloaded signature: {}", e.to_string()))?;

minisign::verify(&public_key, &sig_box, dest, true, false)
minisign::verify(&public_key, &sig_box, dest, true, false, true)
.map_err(|e| anyhow!("Could not validate signature: {}", e.to_string()))
}
9 changes: 2 additions & 7 deletions src/dataflow/lockfile_packages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ pub enum LockfileError {
}

/// A ternary for a lockfile: Some, None, Error.
#[derive(Debug)]
#[derive(Debug, Default)]
pub enum LockfileResult {
Lockfile(Lockfile),
#[default]
NoLockfile,
LockfileError(LockfileError),
}
Expand Down Expand Up @@ -72,12 +73,6 @@ impl LockfileResult {
}
}

impl Default for LockfileResult {
fn default() -> Self {
LockfileResult::NoLockfile
}
}

/// A convenient structure containing all modules and commands for a package stored lockfile.
#[derive(Clone, Debug, Default)]
pub struct LockfilePackage {
Expand Down
10 changes: 5 additions & 5 deletions src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::data::manifest::MANIFEST_FILE_NAME;
use crate::data::manifest::{Command, CommandV2, Manifest, Module, Package};
use crate::util;

use dialoguer::{Confirmation, Input, Select};
use dialoguer::{Confirm, Input, Select};
use semver::Version;
use std::{
any::Any,
Expand Down Expand Up @@ -283,8 +283,8 @@ Press ^C at any time to quit."
all_commands.extend(module_commands);
}

let continue_loop = Confirmation::new()
.with_text("Add more commands? (no)")
let continue_loop = Confirm::new()
.with_prompt("Add more commands? (no)")
.default(false)
.interact()?;

Expand Down Expand Up @@ -321,8 +321,8 @@ Press ^C at any time to quit."
);

if force_yes
|| Confirmation::new()
.with_text("Is this OK? (yes)")
|| Confirm::new()
.with_prompt("Is this OK? (yes)")
.default(true)
.interact()?
{
Expand Down
2 changes: 1 addition & 1 deletion src/update_notifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl WapmUpdate {
Billboard::builder()
.border_style(BorderStyle::Round)
.build()
.display(&message);
.print(message);
self.last_notified = Some(now);
self.save()
}
Expand Down
55 changes: 30 additions & 25 deletions src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use std::{
};
use thiserror::Error;
use wasmer_wasm_interface::{validate, Interface};
use wasmparser::{Validator, WasmFeatures};

#[cfg(feature = "full")]
pub fn validate_directory(pkg_path: PathBuf) -> anyhow::Result<()> {
Expand Down Expand Up @@ -123,31 +124,35 @@ pub enum ValidationError {

// legacy function, validates wasm. TODO: clean up
pub fn validate_wasm_and_report_errors_old(wasm: &[u8], file_name: String) -> anyhow::Result<()> {
use wasmparser::WasmDecoder;
let mut parser = wasmparser::ValidatingParser::new(
wasm,
Some(wasmparser::ValidatingParserConfig {
operator_config: wasmparser::OperatorValidatorConfig {
enable_threads: true,
enable_reference_types: true,
enable_simd: true,
enable_bulk_memory: true,
enable_multi_value: true,
},
}),
);
loop {
let state = parser.read();
match state {
wasmparser::ParserState::EndWasm => return Ok(()),
wasmparser::ParserState::Error(e) => {
return Err(ValidationError::InvalidWasm {
file: file_name,
error: format!("{}", e),
}
.into());
}
_ => {}
let mut v = Validator::new_with_features(WasmFeatures {
mutable_global: true,
saturating_float_to_int: true,
sign_extension: true,
reference_types: true,
multi_value: true,
bulk_memory: true,
simd: true,
relaxed_simd: true,
threads: true,
tail_call: true,
floats: true,
multi_memory: true,
exceptions: true,
memory64: true,
extended_const: true,
component_model: true,
function_references: true,
memory_control: true,
});

match v.validate_all(wasm) {
Ok(_) => Ok(()),
Err(e) => {
let error = ValidationError::InvalidWasm {
file: file_name,
error: e.to_string(),
};
Err(error.into())
}
}
}