mirror of
https://github.com/nushell/nushell.git
synced 2026-11-26 03:25:39 +08:00
## Description I'm not sure how helpful this will be since we change things all the time but it's probably a good practice to look around and see how we can reduce the amount of crates we use. This PR removes dependencies nushell can do without. Rewriting `random pass` without aegis turned up three bugs in it, and moving `get_umask` turned up a race in `umask`. The PR fixes those too. - `nu-cmd-extra`'s build script included `theme.rs`, which derives `nu_protocol::IntoValue`. To read one JSON file, cargo built a second copy of nu-protocol and everything under it. The build script now has its own serde struct, and the generated theme list is byte-identical. - `nu-system` depended on uucore (with clap, fluent and ICU) only for `get_umask`, and only nu-command calls it. nu-command now has that function, so every plugin drops 44 crates. `nu_system::get_umask` stays as a deprecated function that reads the umask through nix. - `random pass` uses `rand` 0.10 directly instead of `aegis-password-generator`, which pulled in rand 0.9 and thiserror 1. - `random uuid -v 3` hashes with the `md-5` 0.11 crate that `hash md5` already uses, instead of uuid's `v3` feature and its older RustCrypto stack. - Hand-written setters with the same signatures replace `derive_setters` and darling 0.21. `ParseOptions::with_keep_styles` is now deprecated, like the `keep_styles` field it sets. - `UniqueString` wraps a `Box<str>` instead of byteyarn's `Yarn`, which brought zerocopy 0.7. - parking_lot, lru and nix go back one minor version to match crossterm, ratatui and uucore, so each one is built once. - Lockfile bumps of instability and kasuari let ratatui share darling 0.24 and hashbrown 0.17. serde-saphyr stays at 2.1.1 but now resolves base64 0.23, which its `>=0.21, <0.24` range already allows. - 31 unused entries are gone from crate manifests, along with the `dirs-sys` and `webpki-roots` workspace entries that nothing uses. The `random pass` fixes: - `--chars` below 4 returned 4 characters, because the password always took one character from each enabled set. It now returns the requested length. `--require-each-type` with fewer than 4 characters is an error. - `--include-ambiguous` and `--include-similar` did nothing, because aegis ignored them. Passwords now leave out `O 0 l 1 i` by default, as the help text says, and each flag adds its characters back. - A negative `--chars` failed with "must be less than or equal to 128". It now says "greater than 0", and length errors point at the `--chars` value. The `umask` fix: reading the umask sets it to 0 for a moment. `umask <mask>` didn't take the lock that reads take, so a set that landed in that moment reported `rwxrwxrwx` as the previous mask, and the read then undid it. Reads and sets now share one lock. | macOS, default features | main | this PR | |---|---|---| | crates in the `nu` build | 582 | 554 | | crates in a plugin build (`nu_plugin_inc`) | 209 | 150 | | crates in `nu_plugin_polars` | 481 | 448 | | packages in `Cargo.lock` | 1029 | 1011 | | compile units, `cargo build` | 648 | 572 | | compile units, `cargo build --release` | 740 | 587 | ## User-facing changes (Release notes) - `random pass --chars` returns exactly the requested length. Below 4 it used to return 4 characters. - `random pass` leaves out the look-alike characters `O 0 l 1 i` unless `--include-ambiguous` or `--include-similar` is given, as its help says. - `umask <mask>` no longer reports `rwxrwxrwx` as the previous mask, or loses the new one, when another thread reads the umask at the same time. - Plugins built on `nu-plugin` compile 59 fewer crates (209 to 150 for `nu_plugin_inc` on macOS). ## Additional notes <!-- Optional. Examples: - fixes #123 - closes #456 - related #789 Anything else reviewers should know. Remove this section if not needed. -->
Collection of small utilities that are shared across Nushell crates.
This crate should compile early in the crate graph and thus not depend on major dependencies or core-nushell crates itself.
Internal Nushell crate
This crate implements components of Nushell and is not designed to support plugin authors or other users directly.