zxcvbn-rs
zxcvbn-rs copied to clipboard
Use minimal regex/fancy-regex build features to reduce build size
When building a WASM module that uses zxcvbn-rs, I found I was able to reduce the build size by roughly 25% by setting the regex and fancy-regex package features to use only standard library support, and avoid using unicode character classes such as \s
.
This PR replaces \s
with \t\r\n
in MAYBE_DATE_WITH_SEPARATOR_REGEX
, and sets features = ["std"]
on the regex and fancy-regex dependencies.
See here for more info on this optimization for the regex dependency: https://github.com/rust-lang/regex?tab=readme-ov-file#crate-features.
Looks like there's a feature missing on one of the dependencies, that's conditionally required for wasm.