-
Notifications
You must be signed in to change notification settings - Fork 115
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
Use libraries instead of locally installed binaries for Cargo Generate and Wasm Opt #429
base: main
Are you sure you want to change the base?
Conversation
@@ -31,7 +31,7 @@ categories = ["development-tools", "wasm", "web-programming"] | |||
keywords = ["leptos"] | |||
version = "0.2.27" | |||
edition = "2021" | |||
rust-version = "1.71" | |||
rust-version = "1.82.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clippy was giving warnings that the earliest rust version to support is_none_or
(which is used in this project) is 1.82.0.
wait_interruptible("wasm-opt", process, interrupt).await | ||
fn optimize(file: &Utf8Path) -> Result<()> { | ||
OptimizationOptions::new_optimize_for_size_aggressively() | ||
.run(file, file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how to make this interruptable since run
is synchronous. It might not be needed since it's not a child process anymore.
@@ -18,7 +18,7 @@ pub async fn compile_tailwind(proj: &Project, tw_conf: &TailwindConfig) -> Resul | |||
create_default_tailwind_config(tw_conf).await?; | |||
} | |||
|
|||
let (line, process) = tailwind_process(&proj, "tailwindcss", tw_conf).await?; | |||
let (line, process) = tailwind_process(proj, "tailwindcss", tw_conf).await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to fix a Clippy warning.
@@ -76,7 +75,7 @@ pub struct ExeCache<'a> { | |||
meta: &'a ExeMeta, | |||
} | |||
|
|||
impl<'a> ExeCache<'a> { | |||
impl ExeCache<'_> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes a Clippy warning.
.chars() | ||
.skip_while(|c| !c.is_ascii_digit() || *c == '_') | ||
.collect::<String>() | ||
fn sanitize_version_prefix<'a>(ver_string: &'a str) -> Result<&'a str> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since wasm-opt
is now used as a library instead of a binary downloaded from Github, I figured the check for "version_" is unnecessary.
Build(_) => command::build_all(&config).await, | ||
Serve(_) => command::serve(&config.current_project()?).await, | ||
Test(_) => command::test_all(&config).await, | ||
EndToEnd(_) => command::end2end_all(&config).await, | ||
Watch(_) => command::watch(&config.current_project()?).await, | ||
New(_) => unreachable!(r#""new" command should have already been run"#), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figure unreachable!
is closer to what is meant semantically here. The docs for that macro say that it's useful whenver the compiler can't determine if some code is unreachable; I'm unsure if that means it will aid the compiler in optimization, but it seems more appropriate regardless.
I made a PR for |
While working on the Tailwind v4 PR, I noticed that there were some things that are handled with separate binaries that have libraries that do the same thing. I took the liberty of switching to using those libraries. This might also make it easier to handle the version issue I an into with the Tailwind v4 PR.
Even though this PR says it has a lot of additions, almost all of them are from the lockfile. As far as actual source code is concerned, this allowed me to rip out a lot of now unnecessary code.