fix: use prettier-please just in tests - no custom wrapper (#2767)
* fix: use prettier-please just in tests - no custom wrapper
This commit is contained in:
1 parent
e5e578d27b
commit
ae4a2464b3
12 files changed
+56
-47
No files matched your search
Generated
+34
-25
@@ -1326,9 +1326,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytes"
|
name = "bytes"
|
||||||
version = "1.7.0"
|
version = "1.7.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fca2be1d5c43812bae364ee3f30b3afcb7877cf59f4aeb94c66f313a41d2fac9"
|
checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bzip2"
|
name = "bzip2"
|
||||||
@@ -5940,9 +5940,9 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "liquid"
|
name = "liquid"
|
||||||
version = "0.26.8"
|
version = "0.26.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4e9338405fdbc0bce9b01695b2a2ef6b20eca5363f385d47bce48ddf8323cc25"
|
checksum = "7cdcc72b82748f47c2933c172313f5a9aea5b2c4eb3fa4c66b4ea55bb60bb4b1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"doc-comment",
|
"doc-comment",
|
||||||
"liquid-core",
|
"liquid-core",
|
||||||
@@ -5953,9 +5953,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "liquid-core"
|
name = "liquid-core"
|
||||||
version = "0.26.8"
|
version = "0.26.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "feb8fed70857010ed9016ed2ce5a7f34e7cc51d5d7255c9c9dc2e3243e490b42"
|
checksum = "2752e978ffc53670f3f2e8b3ef09f348d6f7b5474a3be3f8a5befe5382e4effb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anymap2",
|
"anymap2",
|
||||||
"itertools 0.13.0",
|
"itertools 0.13.0",
|
||||||
@@ -5971,9 +5971,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "liquid-derive"
|
name = "liquid-derive"
|
||||||
version = "0.26.7"
|
version = "0.26.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "77a5aa659a76b649f0d639ef0b9c067a9499c42a9d7f3e7832e279f791704966"
|
checksum = "3b51f1d220e3fa869e24cfd75915efe3164bd09bb11b3165db3f37f57bf673e3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -5982,9 +5982,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "liquid-lib"
|
name = "liquid-lib"
|
||||||
version = "0.26.8"
|
version = "0.26.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ee1794b5605e9f8864a8a4f41aa97976b42512cc81093f8c885d29fb94c6c556"
|
checksum = "59b1a298d3d2287ee5b1e43840d885b8fdfc37d3f4e90d82aacfd04d021618da"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itertools 0.13.0",
|
"itertools 0.13.0",
|
||||||
"liquid-core",
|
"liquid-core",
|
||||||
@@ -6826,12 +6826,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "os_pipe"
|
name = "os_pipe"
|
||||||
version = "1.2.0"
|
version = "1.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "29d73ba8daf8fac13b0501d1abeddcfe21ba7401ada61a819144b6c2a4f32209"
|
checksum = "5ffd2b0a5634335b135d5728d84c5e0fd726954b87111f7506a61c502280d982"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -7428,9 +7428,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prettier-please"
|
name = "prettier-please"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "22020dfcf177fcc7bf5deaf7440af371400c67c0de14c399938d8ed4fb4645d3"
|
checksum = "32db37eb2b0ec0af154e9c1b33425902d8cd9481e35167c4e9ffb28fec3916bb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"syn 2.0.72",
|
"syn 2.0.72",
|
||||||
@@ -8647,9 +8647,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.121"
|
version = "1.0.122"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4ab380d7d9f22ef3f21ad3e6c1ebe8e4fc7a2000ccba2e4d71fc96f15b2cb609"
|
checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa 1.0.11",
|
"itoa 1.0.11",
|
||||||
"memchr",
|
"memchr",
|
||||||
@@ -9638,9 +9638,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "swc_common"
|
name = "swc_common"
|
||||||
version = "0.36.2"
|
version = "0.36.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1802b1642488aec58597dc55ea88992c165660d6e44e9838d4d93f7b78ab95f3"
|
checksum = "457fb92efa9f0c849d6bc4e86561982d464176bc3df96bb22baed5e98309e090"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash 0.8.11",
|
"ahash 0.8.11",
|
||||||
"ast_node",
|
"ast_node",
|
||||||
@@ -10019,9 +10019,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "swc_ecma_minifier"
|
name = "swc_ecma_minifier"
|
||||||
version = "0.200.4"
|
version = "0.200.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b92feddb27f3ad89dd296696f55e04f8e96cdc778df95a73a6f06664bf6919f3"
|
checksum = "624e23b532c9a2f74ea850120b19079ab67f6e85af53c83d1984adbecc820b03"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"indexmap 2.3.0",
|
"indexmap 2.3.0",
|
||||||
@@ -10054,9 +10054,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "swc_ecma_parser"
|
name = "swc_ecma_parser"
|
||||||
version = "0.148.1"
|
version = "0.148.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a8204235f635274dba4adc30c47ac896fd126ddfc53b27210676722423cbb2e7"
|
checksum = "a05ef8f80461e19374d9e8197f459a399b2802da19f72ea951ef343752ff3c04"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"either",
|
"either",
|
||||||
"new_debug_unreachable",
|
"new_debug_unreachable",
|
||||||
@@ -10302,9 +10302,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "swc_ecma_transforms_typescript"
|
name = "swc_ecma_transforms_typescript"
|
||||||
version = "0.194.3"
|
version = "0.194.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4f73c4ae3eb15adc5865dc729c4e111040529cec5a349d56ed0b4a0de1a86242"
|
checksum = "99619353488c1dae960159faef86f0261e7fefe43b84ed1ba80c8cbc5a539434"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ryu-js",
|
"ryu-js",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -12262,6 +12262,15 @@ dependencies = [
|
|||||||
"windows-targets 0.52.6",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.59.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets 0.52.6",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-targets"
|
name = "windows-targets"
|
||||||
version = "0.42.2"
|
version = "0.42.2"
|
||||||
|
|||||||
@@ -96,6 +96,10 @@ manganis-cli-support = { version = "0.3.0-alpha.0", features = ["html"] }
|
|||||||
manganis = { version = "0.3.0-alpha.0", default-features = false }
|
manganis = { version = "0.3.0-alpha.0", default-features = false }
|
||||||
warnings = { version = "0.2.0" }
|
warnings = { version = "0.2.0" }
|
||||||
|
|
||||||
|
|
||||||
|
# a fork of pretty please for tests
|
||||||
|
prettier-please = { version = "0.3.0", features = ["verbatim"]}
|
||||||
|
|
||||||
tracing = "0.1.37"
|
tracing = "0.1.37"
|
||||||
tracing-futures = "0.2.5"
|
tracing-futures = "0.2.5"
|
||||||
toml = "0.8"
|
toml = "0.8"
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ serde = { workspace = true, features = ["derive"], optional = true }
|
|||||||
internment = { version = "0.7.0", optional = true }
|
internment = { version = "0.7.0", optional = true }
|
||||||
tracing = { workspace = true }
|
tracing = { workspace = true }
|
||||||
proc-macro2-diagnostics = { version = "0.10", default-features = false }
|
proc-macro2-diagnostics = { version = "0.10", default-features = false }
|
||||||
prettier-please = { version = "*" }
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["hot_reload"]
|
default = ["hot_reload"]
|
||||||
@@ -31,6 +30,7 @@ serde = ["dep:serde", "dioxus-core/serialize"]
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
prettyplease = { workspace = true }
|
prettyplease = { workspace = true }
|
||||||
|
prettier-please = { workspace = true }
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
|
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
|
||||||
@@ -341,6 +341,11 @@ fn normalize_path(name: &mut syn::Path) -> Option<AngleBracketedGenericArguments
|
|||||||
generics
|
generics
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use prettier_please::PrettyUnparse;
|
||||||
|
|
||||||
/// Ensure we can parse a component
|
/// Ensure we can parse a component
|
||||||
#[test]
|
#[test]
|
||||||
fn parses() {
|
fn parses() {
|
||||||
@@ -477,3 +482,4 @@ fn incomplete_components() {
|
|||||||
|
|
||||||
let _parsed: syn::Path = syn::parse2(input).unwrap();
|
let _parsed: syn::Path = syn::parse2(input).unwrap();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -404,6 +404,11 @@ impl Display for ElementName {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use prettier_please::PrettyUnparse;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parses_name() {
|
fn parses_name() {
|
||||||
let _parsed: ElementName = syn::parse2(quote::quote! { div }).unwrap();
|
let _parsed: ElementName = syn::parse2(quote::quote! { div }).unwrap();
|
||||||
@@ -617,3 +622,4 @@ fn parses_raw_elements() {
|
|||||||
|
|
||||||
let _parsed: Element = syn::parse2(input).unwrap();
|
let _parsed: Element = syn::parse2(input).unwrap();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -34,7 +34,7 @@ impl ToTokens for ExprNode {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn no_commas() {
|
fn no_commas() {
|
||||||
use crate::PrettyUnparse;
|
use prettier_please::PrettyUnparse;
|
||||||
let input = quote! {
|
let input = quote! {
|
||||||
div {
|
div {
|
||||||
{label("Hello, world!")},
|
{label("Hello, world!")},
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ impl Parse for IfmtInput {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::PrettyUnparse;
|
use prettier_please::PrettyUnparse;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn raw_tokens() {
|
fn raw_tokens() {
|
||||||
|
|||||||
@@ -78,8 +78,6 @@ pub use partial_closure::PartialClosure;
|
|||||||
pub use rsx_call::*;
|
pub use rsx_call::*;
|
||||||
pub use template_body::TemplateBody;
|
pub use template_body::TemplateBody;
|
||||||
|
|
||||||
pub use util::PrettyUnparse;
|
|
||||||
|
|
||||||
pub mod hot_reload;
|
pub mod hot_reload;
|
||||||
|
|
||||||
#[cfg(feature = "hot_reload_traits")]
|
#[cfg(feature = "hot_reload_traits")]
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ impl ToTokens for HotReloadFormattedSegment {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::PrettyUnparse;
|
use prettier_please::PrettyUnparse;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parses_lits() {
|
fn parses_lits() {
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ impl TextNode {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::PrettyUnparse;
|
use prettier_please::PrettyUnparse;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parses() {
|
fn parses() {
|
||||||
|
|||||||
@@ -19,20 +19,6 @@ pub(crate) fn intern<T: Eq + Hash + Send + Sync + ?Sized + 'static>(
|
|||||||
s.into().as_ref()
|
s.into().as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// These are just helpful methods for tests to pretty print the token stream - they are not used in the actual code
|
|
||||||
// #[cfg(test)]
|
|
||||||
pub trait PrettyUnparse {
|
|
||||||
fn pretty_unparse(&self) -> String;
|
|
||||||
}
|
|
||||||
|
|
||||||
// #[cfg(test)]
|
|
||||||
impl PrettyUnparse for TokenStream2 {
|
|
||||||
fn pretty_unparse(&self) -> String {
|
|
||||||
let parsed = syn::parse2::<syn::Expr>(self.clone()).unwrap();
|
|
||||||
prettier_please::unparse_expr(&parsed)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Parse a raw ident and return a new ident with the r# prefix added
|
/// Parse a raw ident and return a new ident with the r# prefix added
|
||||||
pub fn parse_raw_ident(parse_buffer: &ParseBuffer) -> syn::Result<Ident> {
|
pub fn parse_raw_ident(parse_buffer: &ParseBuffer) -> syn::Result<Ident> {
|
||||||
// First try to parse as a normal ident
|
// First try to parse as a normal ident
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use dioxus_rsx::CallBody;
|
use dioxus_rsx::CallBody;
|
||||||
use quote::ToTokens;
|
use quote::ToTokens;
|
||||||
|
|
||||||
use dioxus_rsx::PrettyUnparse;
|
use prettier_please::PrettyUnparse;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn callbody_ctx() {
|
fn callbody_ctx() {
|
||||||
|
|||||||
Reference in new issue
Block a user