From 7969ace24aaf3df66d5c0ba6f8aeb0f28cc23b22 Mon Sep 17 00:00:00 2001 From: Bram Hoendervangers Date: Fri, 24 May 2024 17:10:19 +0200 Subject: [PATCH 1/6] feat: add tailwind support for attr values --- Cargo.lock | 132 ++++++++++++++++++++++++++- formatter/Cargo.toml | 13 +-- formatter/src/formatter/attribute.rs | 24 +++-- formatter/src/formatter/expr.rs | 30 ++++-- formatter/src/formatter/mod.rs | 31 +++++-- formatter/src/formatter/tailwind.rs | 16 ++++ formatter/src/source_file.rs | 34 ++++++- 7 files changed, 248 insertions(+), 32 deletions(-) create mode 100644 formatter/src/formatter/tailwind.rs diff --git a/Cargo.lock b/Cargo.lock index 15a74b4..1c46356 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,28 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "getrandom", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + [[package]] name = "anstream" version = "0.3.2" @@ -227,6 +249,27 @@ dependencies = [ "libc", ] +[[package]] +name = "eyre" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" +dependencies = [ + "indenter", + "once_cell", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + [[package]] name = "glob" version = "0.3.1" @@ -260,6 +303,12 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + [[package]] name = "indexmap" version = "1.9.3" @@ -312,6 +361,15 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -344,6 +402,7 @@ dependencies = [ "proc-macro2", "quote", "rstml", + "rustywind_core", "serde", "syn 2.0.66", "thiserror", @@ -366,9 +425,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.146" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "linked-hash-map" @@ -490,6 +549,35 @@ dependencies = [ "num_cpus", ] +[[package]] +name = "regex" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" + [[package]] name = "rstml" version = "0.11.2" @@ -518,6 +606,20 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rustywind_core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a7d826c0111cebd3db09ef1a89204bbd45cb389904f8a3cb2befd945d337919" +dependencies = [ + "ahash", + "aho-corasick", + "eyre", + "itertools", + "once_cell", + "regex", +] + [[package]] name = "scopeguard" version = "1.1.0" @@ -682,6 +784,12 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + [[package]] name = "windows-sys" version = "0.45.0" @@ -837,3 +945,23 @@ name = "yansi" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zerocopy" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] diff --git a/formatter/Cargo.toml b/formatter/Cargo.toml index 68be404..9af87f2 100644 --- a/formatter/Cargo.toml +++ b/formatter/Cargo.toml @@ -13,12 +13,13 @@ leptosfmt-prettyplease.workspace = true rstml = "0.11.2" syn = { workspace = true } proc-macro2 = { workspace = true } -thiserror = "1.0.40" +thiserror = "1.0.61" crop = "0.3.0" -serde = { version = "1.0.163", features = ["derive"] } -quote = "1.0.26" +serde = { version = "1.0.203", features = ["derive"] } +quote = "1.0.36" +rustywind_core = "0.1.2" [dev-dependencies] -indoc = "2.0.1" -insta = "1.28.0" -quote = "1.0.26" +indoc = "2.0.5" +insta = "1.39.0" +quote = "1.0.36" diff --git a/formatter/src/formatter/attribute.rs b/formatter/src/formatter/attribute.rs index 2771dfd..6fbff0f 100644 --- a/formatter/src/formatter/attribute.rs +++ b/formatter/src/formatter/attribute.rs @@ -3,6 +3,8 @@ use syn::{spanned::Spanned, Expr}; use crate::{formatter::Formatter, AttributeValueBraceStyle as Braces}; +use super::ExpressionFormatter; + impl Formatter<'_> { pub fn attribute(&mut self, attribute: &NodeAttribute) { self.flush_comments(attribute.span().start().line - 1); @@ -16,24 +18,32 @@ impl Formatter<'_> { self.node_name(&attribute.key); if let Some(value) = attribute.value() { + let formatter = self + .settings + .attr_values + .get(&attribute.key.to_string()) + .copied(); + self.printer.word("="); - self.attribute_value(value); + self.attribute_value(value, formatter); } } - fn attribute_value(&mut self, value: &Expr) { + fn attribute_value(&mut self, value: &Expr, formatter: Option) { match (self.settings.attr_value_brace_style, value) { - (Braces::Always, syn::Expr::Block(_)) => self.node_value_expr(value, false, false), + (Braces::Always, syn::Expr::Block(_)) => { + self.node_value_expr(value, false, false, formatter) + } (Braces::AlwaysUnlessLit, syn::Expr::Block(_) | syn::Expr::Lit(_)) => { - self.node_value_expr(value, false, true) + self.node_value_expr(value, false, true, formatter) } (Braces::Always | Braces::AlwaysUnlessLit, _) => { self.printer.word("{"); - self.node_value_expr(value, false, false); + self.node_value_expr(value, false, false, formatter); self.printer.word("}"); } - (Braces::WhenRequired, _) => self.node_value_expr(value, true, true), - (Braces::Preserve, _) => self.node_value_expr(value, false, false), + (Braces::WhenRequired, _) => self.node_value_expr(value, true, true, formatter), + (Braces::Preserve, _) => self.node_value_expr(value, false, false, formatter), } } } diff --git a/formatter/src/formatter/expr.rs b/formatter/src/formatter/expr.rs index 652617d..87f98ef 100644 --- a/formatter/src/formatter/expr.rs +++ b/formatter/src/formatter/expr.rs @@ -4,6 +4,8 @@ use syn::{spanned::Spanned, Block, Expr, ExprBlock, ExprLit, LitStr}; use crate::{formatter::Formatter, get_text_beween_spans, view_macro::ViewMacroFormatter}; +use super::ExpressionFormatter; + fn trim_start_with_max(str: &str, max_chars: usize) -> &str { let mut chars = 0; str.trim_start_matches(|c: char| { @@ -65,20 +67,23 @@ impl Formatter<'_> { if unwrap_single_expr_blocks || (unwrap_single_lit_blocks && matches!(single_expr, syn::Expr::Lit(_))) { - self.expr(single_expr); + self.expr(single_expr, None); } else { self.printer.word("{"); - self.expr(single_expr); + self.expr(single_expr, None); self.printer.word("}"); } return; } - self.expr(&Expr::Block(ExprBlock { - attrs: vec![], - label: None, - block: block.clone(), - })) + self.expr( + &Expr::Block(ExprBlock { + attrs: vec![], + label: None, + block: block.clone(), + }), + None, + ) } pub fn node_value_expr( @@ -86,6 +91,7 @@ impl Formatter<'_> { value: &syn::Expr, unwrap_single_expr_blocks: bool, unwrap_single_lit_blocks: bool, + formatter: Option, ) { // if single line expression, format as '{expr}' instead of '{ expr }' (prettyplease inserts a space) if let syn::Expr::Block(expr_block) = value { @@ -98,10 +104,10 @@ impl Formatter<'_> { } } - self.expr(value) + self.expr(value, formatter) } - fn expr(&mut self, expr: &syn::Expr) { + fn expr(&mut self, expr: &syn::Expr, formatter: Option) { let span = expr.span(); self.flush_comments(span.start().line - 1); if let syn::Expr::Lit(ExprLit { @@ -109,7 +115,11 @@ impl Formatter<'_> { .. }) = expr { - self.literal_str(lit_str); + if let Some(formatter) = formatter { + formatter.format(self, lit_str.value()) + } else { + self.literal_str(lit_str); + } return; } diff --git a/formatter/src/formatter/mod.rs b/formatter/src/formatter/mod.rs index 4d33705..3c780c1 100644 --- a/formatter/src/formatter/mod.rs +++ b/formatter/src/formatter/mod.rs @@ -1,4 +1,5 @@ use std::collections::HashMap; +use std::fmt::Debug; use crop::Rope; @@ -10,6 +11,7 @@ mod expr; mod fragment; mod mac; mod node; +mod tailwind; pub use mac::format_macro; pub use mac::{ParentIndent, ViewMacro}; @@ -40,26 +42,42 @@ pub enum NewlineStyle { Windows, } +#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)] +pub enum ExpressionFormatter { + Tailwind, +} + +impl ExpressionFormatter { + pub fn format(&self, formatter: &mut Formatter, value: String) { + match self { + Self::Tailwind => formatter.tailwind_expr(value), + } + } +} + #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(default)] pub struct FormatterSettings { - // Maximum width of each line + /// Maximum width of each line pub max_width: usize, - // Number of spaces per tab + /// Number of spaces per tab pub tab_spaces: usize, - // Determines indentation style (tabs or spaces) + /// Determines indentation style (tabs or spaces) pub indentation_style: IndentationStyle, - // Determines line ending (unix or windows) + /// Determines line ending (unix or windows) pub newline_style: NewlineStyle, - // Determines placement of braces around single expression attribute values + /// Determines placement of braces around single expression attribute values pub attr_value_brace_style: AttributeValueBraceStyle, - // Determines macros to be formatted. Default: leptos::view, view + /// Determines macros to be formatted. Default: leptos::view, view pub macro_names: Vec, + + /// Determines whether to format attribute values with a specific formatter (e.g. tailwind) + pub attr_values: HashMap, } impl Default for FormatterSettings { @@ -71,6 +89,7 @@ impl Default for FormatterSettings { indentation_style: IndentationStyle::Auto, newline_style: NewlineStyle::Auto, macro_names: vec!["leptos::view".to_string(), "view".to_string()], + attr_values: HashMap::new(), } } } diff --git a/formatter/src/formatter/tailwind.rs b/formatter/src/formatter/tailwind.rs new file mode 100644 index 0000000..da99fc1 --- /dev/null +++ b/formatter/src/formatter/tailwind.rs @@ -0,0 +1,16 @@ +use rustywind_core::sorter::{self, FinderRegex}; + +use crate::Formatter; + +impl Formatter<'_> { + pub fn tailwind_expr(&mut self, attr_value: String) { + static OPTIONS: sorter::Options = sorter::Options { + regex: FinderRegex::DefaultRegex, + sorter: sorter::Sorter::DefaultSorter, + allow_duplicates: true, + }; + + let sorted = sorter::sort_classes(&attr_value, &OPTIONS); + self.printer.word(sorted); + } +} diff --git a/formatter/src/source_file.rs b/formatter/src/source_file.rs index 1df9325..a6c2ae6 100644 --- a/formatter/src/source_file.rs +++ b/formatter/src/source_file.rs @@ -77,9 +77,11 @@ fn format_source( #[cfg(test)] mod tests { + use std::collections::HashMap; + use indoc::indoc; - use crate::IndentationStyle; + use crate::{ExpressionFormatter, IndentationStyle}; use super::*; @@ -753,4 +755,34 @@ mod tests { assert_eq!(result, expected); } + + #[test] + fn tailwind() { + let source = indoc! {r#" + view! { + + + + }"#}; + + let result = format_file_source( + source, + &FormatterSettings { + attr_values: [("class".to_string(), ExpressionFormatter::Tailwind)] + .into_iter() + .collect(), + ..Default::default() + }, + ) + .unwrap(); + insta::assert_snapshot!(result, @r###" + view! { + + + + } + "###); + } } From 8261da6d94efe675c59c157cc182293ee9d4137d Mon Sep 17 00:00:00 2001 From: Bram Hoendervangers Date: Wed, 12 Jun 2024 17:42:01 +0200 Subject: [PATCH 2/6] update prettyplease --- Cargo.lock | 508 ++++++++++++++---------------------------------- cli/src/main.rs | 21 ++ prettyplease | 2 +- 3 files changed, 170 insertions(+), 361 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1c46356..21b7791 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,76 +26,58 @@ dependencies = [ [[package]] name = "anstream" -version = "0.3.2" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.0" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" [[package]] name = "anstyle-parse" -version = "0.2.0" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" dependencies = [ - "windows-sys 0.48.0", + "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "1.0.1" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" dependencies = [ "anstyle", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] name = "anyhow" -version = "1.0.71" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "cc" -version = "1.0.79" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "cfg-if" @@ -105,63 +87,61 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.3.3" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8f255e4b8027970e78db75e78831229c9815fdbfa67eb1a1b777a62e24b4a0" +checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.3" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd4f3c17c83b0ba34ffbc4f8bbd74f079413f747f84a6f89292f138057e36ab" +checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f" dependencies = [ "anstream", "anstyle", - "bitflags", "clap_lex", "strsim", ] [[package]] name = "clap_derive" -version = "4.3.2" +version = "4.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" +checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" [[package]] name = "console" -version = "0.15.7" +version = "0.15.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" dependencies = [ "encode_unicode", "lazy_static", "libc", "unicode-width", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] @@ -173,54 +153,36 @@ dependencies = [ "str_indices", ] -[[package]] -name = "crossbeam-channel" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - [[package]] name = "crossbeam-deque" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.14" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "memoffset", - "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" -dependencies = [ - "cfg-if", -] +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "either" -version = "1.8.1" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" [[package]] name = "encode_unicode" @@ -229,25 +191,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] -name = "errno" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "eyre" @@ -278,30 +225,15 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "indenter" @@ -311,61 +243,43 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "1.9.3" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ - "autocfg", + "equivalent", "hashbrown", ] [[package]] name = "indoc" -version = "2.0.1" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f2cb48b81b1dc9f39676bf99f5499babfec7cd8fe14307f7b3d747208fb5690" +checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "insta" -version = "1.29.0" +version = "1.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a28d25139df397cbca21408bb742cf6837e04cdbebf1b07b760caf971d6a972" +checksum = "810ae6042d48e2c9e9215043563a58a80b877bc863228a74cf10c49d4620a6f5" dependencies = [ "console", "lazy_static", "linked-hash-map", "similar", - "yaml-rust", ] [[package]] -name = "io-lifetimes" -version = "1.0.11" +name = "is_terminal_polyfill" +version = "1.70.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.1", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "is-terminal" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" -dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", - "rustix", - "windows-sys 0.48.0", -] +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" [[package]] name = "itertools" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] @@ -404,7 +318,7 @@ dependencies = [ "rstml", "rustywind_core", "serde", - "syn 2.0.66", + "syn", "thiserror", ] @@ -420,7 +334,7 @@ dependencies = [ "leptosfmt-pretty-printer", "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] @@ -435,42 +349,17 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - [[package]] name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memoffset" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.15.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" -dependencies = [ - "hermit-abi 0.2.6", - "libc", -] +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "proc-macro-error" @@ -481,7 +370,6 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", - "syn 1.0.109", "version_check", ] @@ -498,22 +386,22 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.83" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" dependencies = [ "unicode-ident", ] [[package]] name = "proc-macro2-diagnostics" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "606c4ba35817e2922a308af55ad51bab3645b59eae5c570d4a6cf07e36bd493b" +checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn", "version_check", "yansi", ] @@ -529,9 +417,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.7.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -539,21 +427,19 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.11.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "num_cpus", ] [[package]] name = "regex" -version = "1.9.4" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", @@ -563,9 +449,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.7" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", @@ -574,9 +460,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.5" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "rstml" @@ -587,30 +473,16 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.66", + "syn", "syn_derive", "thiserror", ] -[[package]] -name = "rustix" -version = "0.37.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys", - "windows-sys 0.48.0", -] - [[package]] name = "rustywind_core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a7d826c0111cebd3db09ef1a89204bbd45cb389904f8a3cb2befd945d337919" +checksum = "15bb3194602600c4dc7d2ff27d0a87fa4ff1c2b24486ef27f27d4f81d6212071" dependencies = [ "ahash", "aho-corasick", @@ -620,68 +492,52 @@ dependencies = [ "regex", ] -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - [[package]] name = "serde" -version = "1.0.164" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.164" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] name = "serde_spanned" -version = "0.6.2" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93107647184f6027e3b7dcb2e11034cf95ffa1e3a682c67951963ac69c1c007d" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" dependencies = [ "serde", ] [[package]] name = "similar" -version = "2.2.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf" +checksum = "fa42c91313f1d05da9b26f267f931cf178d4aba455b4c4622dd7355eb80c6640" [[package]] name = "str_indices" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f026164926842ec52deb1938fae44f83dfdb82d0a5b0270c5bd5935ab74d6dd" +checksum = "e9557cb6521e8d009c51a8666f09356f4b817ba9ba0981a305bd86aee47bd35c" [[package]] name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "syn" -version = "1.0.109" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "unicode-ident", -] +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" @@ -696,41 +552,41 @@ dependencies = [ [[package]] name = "syn_derive" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8128874d02f9a114ade6d9ad252078cb32d3cb240e26477ac73d7e9c495c605e" +checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] name = "toml" -version = "0.7.4" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6135d499e69981f9ff0ef2167955a5333c35e36f6937d382974566b3d5b94ec" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" dependencies = [ "serde", "serde_spanned", @@ -740,18 +596,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.2" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.10" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ "indexmap", "serde", @@ -762,21 +618,21 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.9" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "version_check" @@ -792,159 +648,91 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "windows-sys" -version = "0.45.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.0", + "windows-targets", ] [[package]] name = "windows-targets" -version = "0.42.2" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-targets" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" -dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" -version = "0.42.2" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" [[package]] -name = "windows_i686_gnu" -version = "0.48.0" +name = "windows_i686_gnullvm" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" -version = "0.42.2" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" -version = "0.42.2" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.2" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" -version = "0.42.2" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winnow" -version = "0.4.6" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" dependencies = [ "memchr", ] -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] - [[package]] name = "yansi" -version = "0.5.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" [[package]] name = "zerocopy" @@ -963,5 +751,5 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] diff --git a/cli/src/main.rs b/cli/src/main.rs index 1bc1987..98fea4b 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -49,6 +49,14 @@ struct Args { #[arg(long, num_args=1.., value_delimiter= ' ')] override_macro_names: Option>, + /// Format attributes with tailwind (by default it tries to format any attribute with the key 'class', this is configurable with --tailwind-attr-names) + #[arg(short, long, default_value = "false")] + experimental_tailwind: bool, + + /// Override attributes to be formatted with tailwind + #[arg(long, num_args=1.., value_delimiter= ' ', requires = "experimental_tailwind", default_value = "class")] + tailwind_attr_names: Vec, + #[arg( short, long, @@ -262,6 +270,19 @@ fn create_settings(args: &Args) -> anyhow::Result { if let Some(macro_names) = args.override_macro_names.to_owned() { settings.macro_names = macro_names; } + + if args.experimental_tailwind { + settings.attr_values = args + .tailwind_attr_names + .iter() + .map(|attr_name| { + ( + attr_name.to_owned(), + leptosfmt_formatter::ExpressionFormatter::Tailwind, + ) + }) + .collect(); + } Ok(settings) } diff --git a/prettyplease b/prettyplease index d984765..7daec66 160000 --- a/prettyplease +++ b/prettyplease @@ -1 +1 @@ -Subproject commit d9847650fa2567bc4c90d2bcd0b5e3949e98d0ab +Subproject commit 7daec664f263b1c5963917b532f8a70eae902869 From eee4034ab04db6af1a77c225ea191106131dd2e9 Mon Sep 17 00:00:00 2001 From: Bram Hoendervangers Date: Wed, 12 Jun 2024 17:48:30 +0200 Subject: [PATCH 3/6] update docs --- README.md | 48 ++++++++++++++++++++++++++++++++++-------------- cli/src/main.rs | 2 +- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 2d2dc70..e374f15 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,10 @@ # leptosfmt + [![crates.io](https://img.shields.io/crates/v/leptosfmt.svg)](https://crates.io/crates/leptosfmt) [![build](https://img.shields.io/github/actions/workflow/status/bram209/leptosfmt/ci.yml)](https://github.com/bram209/leptosfmt/actions/workflows/ci.yml?query=branch%3Amain) [![security](https://img.shields.io/github/actions/workflow/status/bram209/leptosfmt/security-audit.yml?label=%F0%9F%9B%A1%EF%B8%8F%20security%20audit)](https://github.com/bram209/leptosfmt/actions/workflows/security-audit.yml?query=branch%3Amain) [![discord](https://img.shields.io/discord/1031524867910148188?color=%237289DA&label=discord%20%23leptosfmt)](https://discord.gg/YdRAhS7eQB) - - A formatter for the leptos view! macro All notable changes are documented in: [CHANGELOG.md](./CHANGELOG.md) @@ -27,29 +26,44 @@ Arguments: [INPUT_PATTERNS]... A space separated list of file, directory or glob Options: - -m, --max-width Maximum width of each line - -t, --tab-spaces Number of spaces per tab - -c, --config-file Configuration file - -s, --stdin Format stdin and write to stdout - -r, --rustfmt Format with rustfmt after formatting with leptosfmt (requires stdin) - --override-macro-names - ... Override formatted macro names - -q, --quiet - --check Check if the file is correctly formatted. Exit with code 1 if not - -h, --help Print help - -V, --version Print version + -m, --max-width + Maximum width of each line + -t, --tab-spaces + Number of spaces per tab + -c, --config-file + Configuration file + -s, --stdin + Format stdin and write to stdout + -r, --rustfmt + Format with rustfmt after formatting with leptosfmt (requires stdin) + --override-macro-names ... + Override formatted macro names + -e, --experimental-tailwind + Format attributes with tailwind + --a + +tailwind-attr-names ... + Override attributes to be formatted with tailwind [default: class] + -q, --quiet + + --check + Check if the file is correctly formatted. Exit with code 1 if not + -h, --help + Print help + -V, --version + Print version ``` ## Using with Rust Analyzer You can set the `rust-analyzer.rustfmt.overrideCommand` setting. - ```json "rust-analyzer.rustfmt.overrideCommand": ["leptosfmt", "--stdin", "--rustfmt"] ``` And **you must** configure `rustfmt` to use the correct edition, place a `rustfmt.toml` file in the root of your project: + ```toml edition = "2021" # (optional) other config... @@ -58,6 +72,7 @@ edition = "2021" > Note: For VSCode users, I recommend to use workpsace settings (CMD + shift + p -> Open workspace settings), so that you can only configure `leptosfmt` for workpsaces that are using leptos. For Neovim users, I recommend using [neoconf.nvim](https://github.com/folke/neoconf.nvim) for managing project-local LSP configuration. ## Configuration + You can configure all settings through a `leptosfmt.toml` file. ```toml @@ -67,6 +82,11 @@ indentation_style = "Auto" # "Tabs", "Spaces" or "Auto" newline_style = "Auto" # "Unix", "Windows" or "Auto" attr_value_brace_style = "WhenRequired" # "Always", "AlwaysUnlessLit", "WhenRequired" or "Preserve" macro_names = [ "leptos::view", "view" ] # Macro names which will be formatted + +# Attribute values can be formatted by custom formatters +# Every attribute name may only select one formatter (this might change later on) +[attr_values] +class = "Tailwind" # "Tailwind" is the only attribute value formatter available for now ``` To see what each setting does, the see [configuration docs](./docs/configuration.md) diff --git a/cli/src/main.rs b/cli/src/main.rs index 98fea4b..c030e0f 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -49,7 +49,7 @@ struct Args { #[arg(long, num_args=1.., value_delimiter= ' ')] override_macro_names: Option>, - /// Format attributes with tailwind (by default it tries to format any attribute with the key 'class', this is configurable with --tailwind-attr-names) + /// Format attributes with tailwind #[arg(short, long, default_value = "false")] experimental_tailwind: bool, From ba8c5bcc5557d2b527649e8c91f0ebc670bdb4b6 Mon Sep 17 00:00:00 2001 From: Bram Hoendervangers Date: Wed, 12 Jun 2024 18:08:57 +0200 Subject: [PATCH 4/6] fix docs --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index e374f15..c3185cf 100644 --- a/README.md +++ b/README.md @@ -40,9 +40,7 @@ Options: Override formatted macro names -e, --experimental-tailwind Format attributes with tailwind - --a - -tailwind-attr-names ... + --tailwind-attr-names ... Override attributes to be formatted with tailwind [default: class] -q, --quiet From 6a8b5002786621c18cbb49c200c0a43d1adf36f6 Mon Sep 17 00:00:00 2001 From: Bram Hoendervangers Date: Wed, 12 Jun 2024 18:11:53 +0200 Subject: [PATCH 5/6] cli arg 'requires' does not work together with 'default_value' --- cli/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/src/main.rs b/cli/src/main.rs index c030e0f..3f202b8 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -54,7 +54,7 @@ struct Args { experimental_tailwind: bool, /// Override attributes to be formatted with tailwind - #[arg(long, num_args=1.., value_delimiter= ' ', requires = "experimental_tailwind", default_value = "class")] + #[arg(long, num_args=1.., value_delimiter= ' ', default_value = "class")] tailwind_attr_names: Vec, #[arg( From fe5b940935c3086520cdcc5e3b1c284c7a159518 Mon Sep 17 00:00:00 2001 From: Bram Hoendervangers Date: Thu, 13 Jun 2024 17:47:13 +0200 Subject: [PATCH 6/6] quote sorted tailwind class names --- formatter/src/formatter/tailwind.rs | 2 ++ formatter/src/source_file.rs | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/formatter/src/formatter/tailwind.rs b/formatter/src/formatter/tailwind.rs index da99fc1..2fb372c 100644 --- a/formatter/src/formatter/tailwind.rs +++ b/formatter/src/formatter/tailwind.rs @@ -11,6 +11,8 @@ impl Formatter<'_> { }; let sorted = sorter::sort_classes(&attr_value, &OPTIONS); + self.printer.word("\""); self.printer.word(sorted); + self.printer.word("\""); } } diff --git a/formatter/src/source_file.rs b/formatter/src/source_file.rs index a6c2ae6..5e6c860 100644 --- a/formatter/src/source_file.rs +++ b/formatter/src/source_file.rs @@ -77,8 +77,6 @@ fn format_source( #[cfg(test)] mod tests { - use std::collections::HashMap; - use indoc::indoc; use crate::{ExpressionFormatter, IndentationStyle}; @@ -777,9 +775,9 @@ mod tests { .unwrap(); insta::assert_snapshot!(result, @r###" view! { - - - + + }