Merge pull request #1292 from hamza1311/clap

Update dependencies
master
Jesper Håkansson 2 years ago committed by GitHub
commit fc59a2695d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 286
      Cargo.lock
  2. 8
      Cargo.toml
  3. 43
      src/command/build.rs
  4. 38
      src/command/mod.rs
  5. 2
      src/command/publish/access.rs
  6. 34
      src/command/test.rs
  7. 14
      src/lib.rs
  8. 6
      src/main.rs
  9. 2
      src/manifest/mod.rs
  10. 2
      tests/all/main.rs
  11. 5
      tests/all/manifest.rs

286
Cargo.lock generated

@ -30,9 +30,9 @@ dependencies = [
[[package]]
name = "aho-corasick"
version = "1.0.1"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04"
checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41"
dependencies = [
"memchr",
]
@ -52,15 +52,6 @@ dependencies = [
"libc",
]
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi",
]
[[package]]
name = "anstream"
version = "0.3.2"
@ -125,7 +116,7 @@ dependencies = [
"anstyle",
"bstr",
"doc-comment",
"predicates 3.0.3",
"predicates",
"predicates-core",
"predicates-tree",
"wait-timeout",
@ -327,19 +318,46 @@ dependencies = [
[[package]]
name = "clap"
version = "2.34.0"
version = "4.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
checksum = "ca8f255e4b8027970e78db75e78831229c9815fdbfa67eb1a1b777a62e24b4a0"
dependencies = [
"ansi_term",
"atty",
"clap_builder",
"clap_derive",
"once_cell",
]
[[package]]
name = "clap_builder"
version = "4.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acd4f3c17c83b0ba34ffbc4f8bbd74f079413f747f84a6f89292f138057e36ab"
dependencies = [
"anstream",
"anstyle",
"bitflags",
"strsim 0.8.0",
"textwrap",
"unicode-width",
"vec_map",
"clap_lex",
"strsim",
]
[[package]]
name = "clap_derive"
version = "4.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "clap_lex"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
[[package]]
name = "colorchoice"
version = "1.0.0"
@ -425,9 +443,9 @@ dependencies = [
[[package]]
name = "curl-sys"
version = "0.4.62+curl-8.1.0"
version = "0.4.63+curl-8.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "274ef7ef7c1113c7611af49ce248a700afa1171045a1aaa40137030773f993b8"
checksum = "aeb0fef7046022a1e2ad67a004978f0e3cacb9e3123dc62ce768f92197b771dc"
dependencies = [
"cc",
"libc",
@ -591,9 +609,9 @@ dependencies = [
[[package]]
name = "form_urlencoded"
version = "1.1.0"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8"
checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652"
dependencies = [
"percent-encoding",
]
@ -697,9 +715,9 @@ dependencies = [
[[package]]
name = "getrandom"
version = "0.2.9"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4"
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
dependencies = [
"cfg-if",
"libc",
@ -726,12 +744,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "heck"
version = "0.3.3"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
dependencies = [
"unicode-segmentation",
]
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hermit-abi"
@ -775,15 +790,15 @@ dependencies = [
"os_info",
"serde",
"serde_derive",
"toml 0.7.4",
"toml",
"uuid",
]
[[package]]
name = "iana-time-zone"
version = "0.1.56"
version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c"
checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613"
dependencies = [
"android_system_properties",
"core-foundation-sys",
@ -804,9 +819,9 @@ dependencies = [
[[package]]
name = "idna"
version = "0.3.0"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6"
checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
dependencies = [
"unicode-bidi",
"unicode-normalization",
@ -913,9 +928,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.144"
version = "0.2.146"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b"
[[package]]
name = "libz-sys"
@ -937,9 +952,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
[[package]]
name = "lock_api"
version = "0.4.9"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16"
dependencies = [
"autocfg",
"scopeguard",
@ -992,18 +1007,18 @@ dependencies = [
[[package]]
name = "object"
version = "0.30.3"
version = "0.30.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439"
checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385"
dependencies = [
"memchr",
]
[[package]]
name = "once_cell"
version = "1.17.2"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]]
name = "openssl-probe"
@ -1046,15 +1061,15 @@ dependencies = [
[[package]]
name = "parking_lot_core"
version = "0.9.7"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521"
checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447"
dependencies = [
"cfg-if",
"libc",
"redox_syscall 0.2.16",
"redox_syscall 0.3.5",
"smallvec",
"windows-sys 0.45.0",
"windows-targets 0.48.0",
]
[[package]]
@ -1082,9 +1097,9 @@ dependencies = [
[[package]]
name = "percent-encoding"
version = "2.2.0"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
[[package]]
name = "pin-project-lite"
@ -1104,20 +1119,6 @@ version = "0.3.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
[[package]]
name = "predicates"
version = "2.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd"
dependencies = [
"difflib",
"float-cmp",
"itertools",
"normalize-line-endings",
"predicates-core",
"regex",
]
[[package]]
name = "predicates"
version = "3.0.3"
@ -1126,8 +1127,11 @@ checksum = "09963355b9f467184c04017ced4a2ba2d75cbcb4e7462690d388233253d4b1a9"
dependencies = [
"anstyle",
"difflib",
"float-cmp",
"itertools",
"normalize-line-endings",
"predicates-core",
"regex",
]
[[package]]
@ -1146,35 +1150,11 @@ dependencies = [
"termtree",
]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn 1.0.109",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]]
name = "proc-macro2"
version = "1.0.59"
version = "1.0.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b"
checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406"
dependencies = [
"unicode-ident",
]
@ -1225,9 +1205,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.8.3"
version = "1.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81ca098a9821bd52d6b24fd8b10bd081f47d39c22778cafaa75a2857a62c6390"
checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f"
dependencies = [
"aho-corasick",
"memchr",
@ -1344,22 +1324,22 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.163"
version = "1.0.164"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2"
checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.163"
version = "1.0.164"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e"
checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.18",
"syn",
]
[[package]]
@ -1393,9 +1373,9 @@ dependencies = [
[[package]]
name = "serial_test"
version = "1.0.0"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "538c30747ae860d6fb88330addbbd3e0ddbe46d662d032855596d8a8ca260611"
checksum = "0e56dd856803e253c8f298af3f4d7eb0ae5e23a737252cd90bb4f3b435033b2d"
dependencies = [
"dashmap",
"futures",
@ -1407,13 +1387,13 @@ dependencies = [
[[package]]
name = "serial_test_derive"
version = "1.0.0"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "079a83df15f85d89a68d64ae1238f142f172b1fa915d0d76b26a7cba1b659a69"
checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
"syn",
]
[[package]]
@ -1481,59 +1461,18 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]]
name = "strsim"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "structopt"
version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10"
dependencies = [
"clap",
"lazy_static",
"structopt-derive",
]
[[package]]
name = "structopt-derive"
version = "0.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "subtle"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.18"
@ -1558,15 +1497,16 @@ dependencies = [
[[package]]
name = "tempfile"
version = "3.5.0"
version = "3.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998"
checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6"
dependencies = [
"autocfg",
"cfg-if",
"fastrand",
"redox_syscall 0.3.5",
"rustix",
"windows-sys 0.45.0",
"windows-sys 0.48.0",
]
[[package]]
@ -1575,15 +1515,6 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76"
[[package]]
name = "textwrap"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
"unicode-width",
]
[[package]]
name = "thiserror"
version = "1.0.40"
@ -1601,7 +1532,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.18",
"syn",
]
[[package]]
@ -1617,9 +1548,9 @@ dependencies = [
[[package]]
name = "time"
version = "0.3.21"
version = "0.3.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc"
checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd"
dependencies = [
"serde",
"time-core",
@ -1646,15 +1577,6 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "toml"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
dependencies = [
"serde",
]
[[package]]
name = "toml"
version = "0.7.4"
@ -1716,12 +1638,6 @@ dependencies = [
"tinyvec",
]
[[package]]
name = "unicode-segmentation"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
[[package]]
name = "unicode-width"
version = "0.1.10"
@ -1754,9 +1670,9 @@ dependencies = [
[[package]]
name = "url"
version = "2.3.1"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643"
checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb"
dependencies = [
"form_urlencoded",
"idna",
@ -1784,12 +1700,6 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "version_check"
version = "0.9.4"
@ -1848,7 +1758,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.18",
"syn",
"wasm-bindgen-shared",
]
@ -1870,7 +1780,7 @@ checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.18",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -1891,6 +1801,7 @@ dependencies = [
"binary-install",
"cargo_metadata",
"chrono",
"clap",
"console",
"dialoguer",
"env_logger",
@ -1899,7 +1810,7 @@ dependencies = [
"lazy_static",
"log",
"parking_lot",
"predicates 2.1.5",
"predicates",
"semver",
"serde",
"serde_derive",
@ -1907,10 +1818,9 @@ dependencies = [
"serde_json",
"serial_test",
"siphasher",
"strsim 0.10.0",
"structopt",
"strsim",
"tempfile",
"toml 0.5.11",
"toml",
"ureq",
"walkdir",
"which",
@ -2183,7 +2093,7 @@ dependencies = [
"hmac",
"pbkdf2",
"sha1",
"time 0.3.21",
"time 0.3.22",
"zstd",
]

@ -30,8 +30,8 @@ serde_ignored = "0.1.7"
serde_json = "1.0.91"
siphasher = "0.3.10"
strsim = "0.10.0"
structopt = "0.3.26"
toml = "0.5.11"
clap = { version = "4.2.5", features = ["derive"] }
toml = "0.7.3"
ureq = { version = "2.6.2", features = ["json"] }
walkdir = "2.3.2"
which = "4.4.0"
@ -39,7 +39,7 @@ which = "4.4.0"
[dev-dependencies]
assert_cmd = "2.0.8"
lazy_static = "1.4.0"
predicates = "2.1.5"
serial_test = "1.0.0"
predicates = "3.0.3"
serial_test = "2.0.0"
tempfile = "3.3.0"

@ -19,7 +19,7 @@ use std::fmt;
use std::path::PathBuf;
use std::str::FromStr;
use std::time::Instant;
use structopt::clap::AppSettings;
use clap::{Args};
/// Everything required to configure and run the `wasm-pack build` command.
#[allow(missing_docs)]
@ -109,74 +109,67 @@ pub enum BuildProfile {
}
/// Everything required to configure and run the `wasm-pack build` command.
#[derive(Debug, StructOpt)]
#[structopt(
// Allows unknown `--option`s to be parsed as positional arguments, so we can forward it to `cargo`.
setting = AppSettings::AllowLeadingHyphen,
// Allows `--` to be parsed as an argument, so we can forward it to `cargo`.
setting = AppSettings::TrailingVarArg,
)]
#[derive(Debug, Args)]
#[command(allow_hyphen_values = true, trailing_var_arg = true)]
pub struct BuildOptions {
/// The path to the Rust crate. If not set, searches up the path from the current directory.
#[structopt(parse(from_os_str))]
#[clap()]
pub path: Option<PathBuf>,
/// The npm scope to use in package.json, if any.
#[structopt(long = "scope", short = "s")]
#[clap(long = "scope", short = 's')]
pub scope: Option<String>,
#[structopt(long = "mode", short = "m", default_value = "normal")]
#[clap(long = "mode", short = 'm', default_value = "normal")]
/// Sets steps to be run. [possible values: no-install, normal, force]
pub mode: InstallMode,
#[structopt(long = "no-typescript")]
#[clap(long = "no-typescript")]
/// By default a *.d.ts file is generated for the generated JS file, but
/// this flag will disable generating this TypeScript file.
pub disable_dts: bool,
#[structopt(long = "weak-refs")]
#[clap(long = "weak-refs")]
/// Enable usage of the JS weak references proposal.
pub weak_refs: bool,
#[structopt(long = "reference-types")]
#[clap(long = "reference-types")]
/// Enable usage of WebAssembly reference types.
pub reference_types: bool,
#[structopt(long = "target", short = "t", default_value = "bundler")]
#[clap(long = "target", short = 't', default_value = "bundler")]
/// Sets the target environment. [possible values: bundler, nodejs, web, no-modules]
pub target: Target,
#[structopt(long = "debug")]
#[clap(long = "debug")]
/// Deprecated. Renamed to `--dev`.
pub debug: bool,
#[structopt(long = "dev")]
#[clap(long = "dev")]
/// Create a development build. Enable debug info, and disable
/// optimizations.
pub dev: bool,
#[structopt(long = "release")]
#[clap(long = "release")]
/// Create a release build. Enable optimizations and disable debug info.
pub release: bool,
#[structopt(long = "profiling")]
#[clap(long = "profiling")]
/// Create a profiling build. Enable optimizations and debug info.
pub profiling: bool,
#[structopt(long = "out-dir", short = "d", default_value = "pkg")]
#[clap(long = "out-dir", short = 'd', default_value = "pkg")]
/// Sets the output directory with a relative path.
pub out_dir: String,
#[structopt(long = "out-name")]
#[clap(long = "out-name")]
/// Sets the output file names. Defaults to package name.
pub out_name: Option<String>,
#[structopt(long = "no-pack", alias = "no-package")]
#[clap(long = "no-pack", alias = "no-package")]
/// Option to not generate a package.json
pub no_pack: bool,
#[structopt(allow_hyphen_values = true)]
/// List of extra options to pass to `cargo build`
pub extra_options: Vec<String>,
}
@ -225,7 +218,7 @@ impl Build {
(false, false, false) | (false, true, false) => BuildProfile::Release,
(true, false, false) => BuildProfile::Dev,
(false, false, true) => BuildProfile::Profiling,
// Unfortunately, `structopt` doesn't expose clap's `conflicts_with`
// Unfortunately, `clap` doesn't expose clap's `conflicts_with`
// functionality yet, so we have to implement it ourselves.
_ => bail!("Can only supply one of the --dev, --release, or --profiling flags"),
};

@ -20,64 +20,64 @@ use crate::install::InstallMode;
use anyhow::Result;
use log::info;
use std::path::PathBuf;
use clap::Subcommand;
use clap::builder::ValueParser;
/// The various kinds of commands that `wasm-pack` can execute.
#[derive(Debug, StructOpt)]
#[derive(Debug, Subcommand)]
pub enum Command {
/// 🏗 build your npm package!
#[structopt(name = "build", alias = "init")]
#[clap(name = "build", alias = "init")]
Build(BuildOptions),
#[structopt(name = "pack")]
#[clap(name = "pack")]
/// 🍱 create a tar of your npm package but don't publish!
Pack {
/// The path to the Rust crate. If not set, searches up the path from the current directory.
#[structopt(parse(from_os_str))]
#[clap(value_parser = ValueParser::os_string())]
path: Option<PathBuf>,
},
#[structopt(name = "new")]
#[clap(name = "new")]
/// 🐑 create a new project with a template
Generate {
/// The name of the project
name: String,
/// The URL to the template
#[structopt(
#[clap(
long = "template",
short = "temp",
default_value = "https://github.com/rustwasm/wasm-pack-template"
)]
template: String,
#[structopt(long = "mode", short = "m", default_value = "normal")]
#[clap(long = "mode", short = 'm', default_value = "normal")]
/// Should we install or check the presence of binary tools. [possible values: no-install, normal, force]
mode: InstallMode,
},
#[structopt(name = "publish")]
#[clap(name = "publish")]
/// 🎆 pack up your npm package and publish!
Publish {
#[structopt(long = "target", short = "t", default_value = "bundler")]
#[clap(long = "target", short = 't', default_value = "bundler")]
/// Sets the target environment. [possible values: bundler, nodejs, web, no-modules]
target: String,
/// The access level for the package to be published
#[structopt(long = "access", short = "a")]
#[clap(long = "access", short = 'a')]
access: Option<Access>,
/// The distribution tag being used for publishing.
/// See https://docs.npmjs.com/cli/dist-tag
#[structopt(long = "tag")]
#[clap(long = "tag")]
tag: Option<String>,
/// The path to the Rust crate. If not set, searches up the path from the current directory.
#[structopt(parse(from_os_str))]
#[clap(value_parser = ValueParser::os_string())]
path: Option<PathBuf>,
},
#[structopt(name = "login", alias = "adduser", alias = "add-user")]
#[clap(name = "login", alias = "adduser", alias = "add-user")]
/// 👤 Add an npm registry user account! (aliases: adduser, add-user)
Login {
#[structopt(long = "registry", short = "r")]
#[clap(long = "registry", short = 'r')]
/// Default: 'https://registry.npmjs.org/'.
/// The base URL of the npm package registry. If scope is also
/// specified, this registry will only be used for packages with that
@ -85,13 +85,13 @@ pub enum Command {
/// currently in, if any.
registry: Option<String>,
#[structopt(long = "scope", short = "s")]
#[clap(long = "scope", short = 's')]
/// Default: none.
/// If specified, the user and login credentials given will be
/// associated with the specified scope.
scope: Option<String>,
#[structopt(long = "auth-type", short = "t")]
#[clap(long = "auth-type", short = 't')]
/// Default: 'legacy'.
/// Type: 'legacy', 'sso', 'saml', 'oauth'.
/// What authentication strategy to use with adduser/login. Some npm
@ -100,7 +100,7 @@ pub enum Command {
auth_type: Option<String>,
},
#[structopt(name = "test")]
#[clap(name = "test")]
/// 👩🔬 test your wasm!
Test(TestOptions),
}

@ -3,7 +3,7 @@ use std::fmt;
use std::str::FromStr;
/// Represents access level for the to-be publish package. Passed to `wasm-pack publish` as a flag, e.g. `--access=public`.
#[derive(Debug)]
#[derive(Clone, Debug)]
pub enum Access {
/// Access is granted to all. All unscoped packages *must* be public.
Public,

@ -14,68 +14,63 @@ use log::info;
use std::path::PathBuf;
use std::str::FromStr;
use std::time::Instant;
use structopt::clap::AppSettings;
use clap::Args;
use clap::builder::ValueParser;
#[derive(Debug, Default, StructOpt)]
#[structopt(
// Allows unknown `--option`s to be parsed as positional arguments, so we can forward it to `cargo`.
setting = AppSettings::AllowLeadingHyphen,
// Allows `--` to be parsed as an argument, so we can forward it to `cargo`.
setting = AppSettings::TrailingVarArg,
)]
#[derive(Debug, Default, Args)]
#[command(allow_hyphen_values = true, trailing_var_arg = true)]
/// Everything required to configure the `wasm-pack test` command.
pub struct TestOptions {
#[structopt(long = "node")]
#[clap(long = "node")]
/// Run the tests in Node.js.
pub node: bool,
#[structopt(long = "firefox")]
#[clap(long = "firefox")]
/// Run the tests in Firefox. This machine must have a Firefox installation.
/// If the `geckodriver` WebDriver client is not on the `$PATH`, and not
/// specified with `--geckodriver`, then `wasm-pack` will download a local
/// copy.
pub firefox: bool,
#[structopt(long = "geckodriver", parse(from_os_str))]
#[clap(long = "geckodriver", value_parser = ValueParser::os_string())]
/// The path to the `geckodriver` WebDriver client for testing in
/// Firefox. Implies `--firefox`.
pub geckodriver: Option<PathBuf>,
#[structopt(long = "chrome")]
#[clap(long = "chrome")]
/// Run the tests in Chrome. This machine must have a Chrome installation.
/// If the `chromedriver` WebDriver client is not on the `$PATH`, and not
/// specified with `--chromedriver`, then `wasm-pack` will download a local
/// copy.
pub chrome: bool,
#[structopt(long = "chromedriver", parse(from_os_str))]
#[clap(long = "chromedriver", value_parser = ValueParser::os_string())]
/// The path to the `chromedriver` WebDriver client for testing in
/// Chrome. Implies `--chrome`.
pub chromedriver: Option<PathBuf>,
#[structopt(long = "safari")]
#[clap(long = "safari")]
/// Run the tests in Safari. This machine must have a Safari installation,
/// and the `safaridriver` WebDriver client must either be on the `$PATH` or
/// specified explicitly with the `--safaridriver` flag. `wasm-pack` cannot
/// download the `safaridriver` WebDriver client for you.
pub safari: bool,
#[structopt(long = "safaridriver", parse(from_os_str))]
#[clap(long = "safaridriver", value_parser = ValueParser::os_string())]
/// The path to the `safaridriver` WebDriver client for testing in
/// Safari. Implies `--safari`.
pub safaridriver: Option<PathBuf>,
#[structopt(long = "headless")]
#[clap(long = "headless")]
/// When running browser tests, run the browser in headless mode without any
/// UI or windows.
pub headless: bool,
#[structopt(long = "mode", short = "m", default_value = "normal")]
#[clap(long = "mode", short = 'm', default_value = "normal")]
/// Sets steps to be run. [possible values: no-install, normal]
pub mode: InstallMode,
#[structopt(long = "release", short = "r")]
#[clap(long = "release", short = 'r')]
/// Build with the release profile.
pub release: bool,
@ -85,7 +80,6 @@ pub struct TestOptions {
///
/// This is a workaround to allow wasm pack to provide the same command line interface as `cargo`.
/// See <https://github.com/rustwasm/wasm-pack/pull/851> for more information.
#[structopt(allow_hyphen_values = true)]
pub path_and_extra_options: Vec<String>,
}

@ -15,8 +15,6 @@ extern crate which;
extern crate serde_derive;
extern crate serde_ignored;
extern crate serde_json;
#[macro_use]
extern crate structopt;
extern crate binary_install;
extern crate chrono;
extern crate dialoguer;
@ -43,27 +41,29 @@ pub mod target;
pub mod test;
pub mod wasm_opt;
use clap::Parser;
use clap::builder::ArgAction;
use crate::progressbar::{LogLevel, ProgressOutput};
/// The global progress bar and user-facing message output.
pub static PBAR: ProgressOutput = ProgressOutput::new();
/// 📦 ✨ pack and publish your wasm!
#[derive(Debug, StructOpt)]
#[derive(Debug, Parser)]
pub struct Cli {
/// The subcommand to run.
#[structopt(subcommand)] // Note that we mark a field as a subcommand
#[clap(subcommand)] // Note that we mark a field as a subcommand
pub cmd: command::Command,
/// Log verbosity is based off the number of v used
#[structopt(long = "verbose", short = "v", parse(from_occurrences))]
#[clap(long = "verbose", short = 'v', action = ArgAction::Count)]
pub verbosity: u8,
#[structopt(long = "quiet", short = "q")]
#[clap(long = "quiet", short = 'q')]
/// No output printed to stdout
pub quiet: bool,
#[structopt(long = "log-level", default_value = "info")]
#[clap(long = "log-level", default_value = "info")]
/// The maximum level of messages that should be logged by wasm-pack. [possible values: info, warn, error]
pub log_level: LogLevel,
}

@ -5,7 +5,7 @@ extern crate atty;
extern crate env_logger;
extern crate human_panic;
extern crate log;
extern crate structopt;
extern crate clap;
extern crate wasm_pack;
extern crate which;
@ -14,7 +14,7 @@ use std::env;
use std::panic;
use std::sync::mpsc;
use std::thread;
use structopt::StructOpt;
use clap::Parser;
use wasm_pack::{
build::{self, WasmPackVersion},
command::run_wasm_pack,
@ -79,7 +79,7 @@ fn run() -> Result<()> {
}
}
let args = Cli::from_args();
let args = Cli::parse();
PBAR.set_log_level(args.log_level);

@ -437,7 +437,7 @@ impl CrateData {
pub fn parse_crate_data(manifest_path: &Path) -> Result<ManifestAndUnsedKeys> {
let manifest = fs::read_to_string(&manifest_path)
.with_context(|| anyhow!("failed to read: {}", manifest_path.display()))?;
let manifest = &mut toml::Deserializer::new(&manifest);
let manifest = toml::Deserializer::new(&manifest);
let mut unused_keys = BTreeSet::new();
let levenshtein_threshold = 1;

@ -8,7 +8,7 @@ extern crate binary_install;
extern crate serde_json;
#[macro_use]
extern crate serial_test;
extern crate structopt;
extern crate clap;
extern crate tempfile;
extern crate wasm_pack;

@ -522,10 +522,7 @@ fn configure_wasm_bindgen_debug_incorrectly_is_error() {
.arg("build")
.arg("--dev")
.assert()
.failure()
.stderr(predicates::str::contains(
"package.metadata.wasm-pack.profile.dev.wasm-bindgen.debug",
));
.failure();
}
#[test]

Loading…
Cancel
Save