Open Legend-Master opened 5 months ago
Shell plugin is bloated because of regex I think (this reminds me that Lua doesn't have standard regex, because regex itself is bigger than the entire Lua interpreter + libraries (~500 KB))
1.47 MB for (empty main is 130 KB)
fn main() {
use regex::Regex;
let re = Regex::new(r"\b\w{13}\b").unwrap();
let hay = "I categorically deny having triskaidekaphobia.";
assert!(re.is_match(hay));
}
We're currently using regex to control open scope permissions, maybe we can put it in to a feature?
Removing regex reduced the size to total of 3.68 MB, 0.34 MB increase from base line compare to 1.38 MB
I only see shell plugin as an issue, other plugins size are fine IMO and not sure if they can be trimmed even further.
Regex was used in v1 but was behind a feature flag based on the allowlist config but now that we moved to ACL in v2, it is no longer feature flagged and is always included in the final binary, I guess we need to figure out a way to bring a similar behavior back. cc @lucasfernog
updater plugin's size can be reduced by moving updater out of zip/tar, and remove them as dependencies (#1083), other plugins are fine though
cli plugin uses clap, which is also quite big (~0.7MB), but it's not that important since you can use something else like argh without the plugin anyway
Also, about the regex, can we switch to something like the one we used for the fs plugin, and put regex one behind a feature? I think most of the time we just need to control the path, and regex is pretty hard to use on paths anyway
shell uses regexes to validate arguments (both to commands and the open() API). removing this support only lets you use fixed arguments, so I think we should move regex to a feature flag but enable it by default.
I think binary size is important for tauri plugins, as this is the biggest advantage for Tauri vs Electron
Did some testing on plugin size compiling
examples/api
, I commented out all extensions, and add in one at a time, here's the increased size of some pluginsBase size 3.34 MB (On Windows)