Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to 2018 edition and update dependencies #1048

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
1,460 changes: 462 additions & 998 deletions Cargo.lock

Large diffs are not rendered by default.

59 changes: 30 additions & 29 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,43 @@ license = "MIT/Apache-2.0"
readme = "README.md"
categories = ["wasm"]
documentation = "https://rustwasm.github.io/wasm-pack/"
edition = "2018"

[dependencies]
atty = "0.2.11"
cargo_metadata = "0.8.0"
console = "0.6.1"
dialoguer = "0.3.0"
curl = "0.4.13"
env_logger = { version = "0.5.13", default-features = false }
failure = "0.1.2"
human-panic = "1.0.1"
glob = "0.2"
log = "0.4.6"
openssl = { version = '0.10.11', optional = true }
parking_lot = "0.6"
reqwest = "0.9.14"
semver = "0.9.0"
serde = "1.0.74"
serde_derive = "1.0.74"
serde_ignored = "0.0.4"
serde_json = "1.0.26"
atty = "0.2.14"
cargo_metadata = "0.14.0"
console = "0.14.1"
dialoguer = "0.8.0"
curl = "0.4.38"
env_logger = { version = "0.9.0", default-features = false }
failure = "0.1.8"
human-panic = "1.0.3"
glob = "0.3.0"
log = "0.4.14"
openssl = { version = '0.10.35', optional = true }
parking_lot = "0.11.1"
reqwest = { version = "0.11.4", features = ["blocking"] }
semver = "1.0.4"
serde = "1.0.127"
serde_derive = "1.0.127"
serde_ignored = "0.1.2"
serde_json = "1.0.66"
strsim = "0.8.0"
siphasher = "0.2.3"
structopt = "0.3"
toml = "0.4"
which = "2.0.0"
structopt = "0.3.22"
toml = "0.5.8"
which = "4.2.2"
binary-install = "0.0.2"
walkdir = "2"
chrono = "0.4.6"
walkdir = "2.3.2"
chrono = "0.4.19"

[dev-dependencies]
assert_cmd = "0.11"
lazy_static = "1.1.0"
predicates = "1.0.0"
serial_test = "0.2"
serial_test_derive = "0.2"
tempfile = "3"
assert_cmd = "2.0.0"
lazy_static = "1.4.0"
predicates = "2.0.1"
serial_test = "0.5.1"
serial_test_derive = "0.5.1"
tempfile = "3.2.0"

[features]
# OpenSSL is vendored by default, can use system OpenSSL through feature flag.
Expand Down
8 changes: 4 additions & 4 deletions src/bindgen.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! Functionality related to running `wasm-bindgen`.

use child;
use command::build::{BuildProfile, Target};
use crate::child;
use crate::command::build::{BuildProfile, Target};
use crate::install::{self, Tool};
use crate::manifest::CrateData;
use failure::{self, ResultExt};
use install::{self, Tool};
use manifest::CrateData;
use semver;
use std::path::{Path, PathBuf};
use std::process::Command;
Expand Down
10 changes: 5 additions & 5 deletions src/build/mod.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//! Building a Rust crate into a `.wasm` binary.

use child;
use command::build::BuildProfile;
use emoji;
use crate::child;
use crate::command::build::BuildProfile;
use crate::emoji;
use crate::manifest::Crate;
use crate::PBAR;
use failure::{Error, ResultExt};
use manifest::Crate;
use std::path::Path;
use std::process::Command;
use std::str;
use PBAR;

pub mod wasm_target;

Expand Down
6 changes: 3 additions & 3 deletions src/build/wasm_target.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//! Checking for the wasm32 target

use child;
use emoji;
use crate::child;
use crate::emoji;
use crate::PBAR;
use failure::{Error, ResultExt};
use log::info;
use std::fmt;
use std::path::PathBuf;
use std::process::Command;
use PBAR;

struct Wasm32Check {
rustc_path: PathBuf,
Expand Down
2 changes: 1 addition & 1 deletion src/child.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
//! This module helps us ensure that all child processes that we spawn get
//! properly logged and their output is logged as well.

use crate::install::Tool;
use failure::Error;
use install::Tool;
use log::info;
use std::process::{Command, Stdio};

Expand Down
22 changes: 11 additions & 11 deletions src/command/build.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
//! Implementation of the `wasm-pack build` command.

use crate::bindgen;
use crate::build;
use crate::cache;
use crate::command::utils::{create_pkg_dir, get_crate_path};
use crate::emoji;
use crate::install::{self, InstallMode, Tool};
use crate::license;
use crate::lockfile::Lockfile;
use crate::manifest;
use crate::readme;
use crate::wasm_opt;
use crate::PBAR;
use binary_install::Cache;
use bindgen;
use build;
use cache;
use command::utils::{create_pkg_dir, get_crate_path};
use emoji;
use failure::Error;
use install::{self, InstallMode, Tool};
use license;
use lockfile::Lockfile;
use log::info;
use manifest;
use readme;
use std::fmt;
use std::path::PathBuf;
use std::str::FromStr;
use std::time::Instant;
use structopt::clap::AppSettings;
use PBAR;

/// Everything required to configure and run the `wasm-pack build` command.
#[allow(missing_docs)]
Expand Down
8 changes: 4 additions & 4 deletions src/command/generate.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use cache;
use crate::cache;
use crate::generate;
use crate::install::{self, Tool};
use crate::PBAR;
use failure::Error;
use generate;
use install::{self, Tool};
use log::info;
use std::result;
use PBAR;

/// Executes the 'cargo-generate' command in the current directory
/// which generates a new rustwasm project from a template.
Expand Down
4 changes: 2 additions & 2 deletions src/command/login.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::npm;
use crate::PBAR;
use log::info;
use npm;
use std::result;
use PBAR;

pub fn login(
registry: Option<String>,
Expand Down
6 changes: 3 additions & 3 deletions src/command/pack.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use command::utils::{find_pkg_directory, get_crate_path};
use crate::command::utils::{find_pkg_directory, get_crate_path};
use crate::npm;
use crate::PBAR;
use failure::Error;
use log::info;
use npm;
use std::path::PathBuf;
use std::result;
use PBAR;

/// Executes the 'npm pack' command on the 'pkg' directory
/// which creates a tarball that can be published to the NPM registry
Expand Down
14 changes: 7 additions & 7 deletions src/command/publish/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
pub mod access;

use self::access::Access;
use command::build::{Build, BuildOptions, Target};
use command::utils::{find_pkg_directory, get_crate_path};
use dialoguer::{Confirmation, Input, Select};
use crate::command::build::{Build, BuildOptions, Target};
use crate::command::utils::{find_pkg_directory, get_crate_path};
use crate::npm;
use crate::PBAR;
use dialoguer::{Confirm, Input, Select};
use failure::Error;
use log::info;
use npm;
use std::path::PathBuf;
use std::result;
use std::str::FromStr;
use PBAR;

/// Creates a tarball from a 'pkg' directory
/// and publishes it to the NPM registry
Expand All @@ -31,8 +31,8 @@ pub fn publish(
None => {
// while `wasm-pack publish`, if the pkg directory cannot be found,
// then try to `wasm-pack build`
if Confirmation::new()
.with_text("Your package hasn't been built, build it?")
if Confirm::new()
.with_prompt("Your package hasn't been built, build it?")
.interact()?
{
let out_dir = Input::new()
Expand Down
14 changes: 7 additions & 7 deletions src/command/test.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
//! Implementation of the `wasm-pack test` command.

use crate::build;
use crate::cache;
use crate::command::utils::get_crate_path;
use crate::install::{self, InstallMode, Tool};
use crate::lockfile::Lockfile;
use crate::manifest;
use crate::test::{self, webdriver};
use binary_install::Cache;
use build;
use cache;
use command::utils::get_crate_path;
use console::style;
use failure::Error;
use install::{self, InstallMode, Tool};
use lockfile::Lockfile;
use log::info;
use manifest;
use std::path::PathBuf;
use std::str::FromStr;
use std::time::Instant;
use structopt::clap::AppSettings;
use test::{self, webdriver};

#[derive(Debug, Default, StructOpt)]
#[structopt(
Expand Down
6 changes: 3 additions & 3 deletions src/generate.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! Functionality related to running `cargo-generate`.

use child;
use emoji;
use crate::child;
use crate::emoji;
use crate::install::{self, Tool};
use failure::{self, ResultExt};
use install::{self, Tool};
use std::process::Command;

/// Run `cargo generate` in the current directory to create a new
Expand Down
6 changes: 2 additions & 4 deletions src/install/krate.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use install::Tool;
use serde::Deserialize;
use crate::install::Tool;

#[derive(Debug, Deserialize)]
pub struct Krate {
Expand All @@ -15,8 +14,7 @@ pub struct KrateResponse {
impl Krate {
pub fn new(name: &Tool) -> Result<Krate, failure::Error> {
let krate_address = format!("https://crates.io/api/v1/crates/{}", name);
let client = reqwest::Client::new();
let mut res = client.get(&krate_address).send()?;
let res = reqwest::blocking::get(&krate_address)?;

let kr: KrateResponse = serde_json::from_str(&res.text()?)?;
Ok(kr.krate)
Expand Down
10 changes: 5 additions & 5 deletions src/install/mod.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
//! Functionality related to installing prebuilt binaries and/or running cargo install.

use self::krate::Krate;
use crate::child;
use crate::emoji;
use crate::install;
use crate::target;
use crate::PBAR;
use binary_install::{Cache, Download};
use child;
use emoji;
use failure::{self, ResultExt};
use install;
use log::debug;
use log::{info, warn};
use std::env;
use std::fs;
use std::path::PathBuf;
use std::process::Command;
use target;
use which::which;
use PBAR;

mod krate;
mod mode;
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub mod target;
pub mod test;
pub mod wasm_opt;

use progressbar::{LogLevel, ProgressOutput};
use crate::progressbar::{LogLevel, ProgressOutput};

/// The global progress bar and user-facing message output.
pub static PBAR: ProgressOutput = ProgressOutput::new();
Expand Down
4 changes: 2 additions & 2 deletions src/license.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use failure;
use std::fs;
use std::path::Path;

use crate::manifest::CrateData;
use crate::PBAR;
use glob::glob;
use manifest::CrateData;
use PBAR;

fn glob_license_files(path: &Path) -> Result<Vec<String>, failure::Error> {
let mut license_files: Vec<String> = Vec::new();
Expand Down
2 changes: 1 addition & 1 deletion src/lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
use std::fs;
use std::path::PathBuf;

use crate::manifest::CrateData;
use console::style;
use failure::{Error, ResultExt};
use manifest::CrateData;
use toml;

/// This struct represents the contents of `Cargo.lock`.
Expand Down
6 changes: 3 additions & 3 deletions src/manifest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ use std::path::Path;
use self::npm::{
repository::Repository, CommonJSPackage, ESModulesPackage, NoModulesPackage, NpmPackage,
};
use crate::command::build::{BuildProfile, Target};
use crate::PBAR;
use cargo_metadata::Metadata;
use chrono::offset;
use chrono::DateTime;
use command::build::{BuildProfile, Target};
use curl::easy;
use failure::{Error, ResultExt};
use serde::{self, Deserialize};
Expand All @@ -27,7 +28,6 @@ use std::env;
use std::io::Write;
use strsim::levenshtein;
use toml;
use PBAR;

const WASM_PACK_METADATA_KEY: &str = "package.metadata.wasm-pack";
const WASM_PACK_VERSION: Option<&'static str> = option_env!("CARGO_PKG_VERSION");
Expand Down Expand Up @@ -426,7 +426,7 @@ impl CrateData {
.iter()
.position(|pkg| {
pkg.name == manifest.package.name
&& CrateData::is_same_path(&pkg.manifest_path, &manifest_path)
&& CrateData::is_same_path(&pkg.manifest_path.as_std_path(), &manifest_path)
})
.ok_or_else(|| format_err!("failed to find package in metadata"))?;

Expand Down
2 changes: 1 addition & 1 deletion src/manifest/npm/commonjs.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use manifest::npm::repository::Repository;
use crate::manifest::npm::repository::Repository;

#[derive(Serialize)]
pub struct CommonJSPackage {
Expand Down
Loading