chore: remove (most) syn 1 dependencies (#1670)

This commit is contained in:
blorbb 2023-09-09 04:46:38 +10:00 committed by GitHub
parent b3a4c95dad
commit c87212f2d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 15 deletions

View file

@ -12,7 +12,6 @@ async-recursion = "1"
base64 = { version = "0.21", optional = true }
cfg-if = "1"
drain_filter_polyfill = "0.1"
educe = "0.4"
futures = "0.3"
getrandom = { version = "0.2", optional = true }
html-escape = "0.2"

View file

@ -25,11 +25,9 @@ pub use unit::*;
use wasm_bindgen::JsCast;
/// The core foundational leptos components.
#[derive(educe::Educe)]
#[educe(Default, Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq)]
pub enum CoreComponent {
/// The [Unit] component.
#[educe(Default)]
Unit(UnitRepr),
/// The [DynChild] component.
DynChild(DynChildRepr),
@ -37,6 +35,12 @@ pub enum CoreComponent {
Each(EachRepr),
}
impl Default for CoreComponent {
fn default() -> Self {
Self::Unit(UnitRepr::default())
}
}
impl fmt::Debug for CoreComponent {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {

View file

@ -506,9 +506,14 @@ where
}
}
#[derive(educe::Educe)]
#[educe(Debug)]
struct HashRun<T>(#[educe(Debug(ignore))] T);
struct HashRun<T>(T);
impl<T> fmt::Debug for HashRun<T> {
#[inline]
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.debug_tuple("HashRun").finish()
}
}
/// Calculates the operations needed to get from `from` to `to`.
#[allow(dead_code)] // not used in SSR but useful to have available for testing

View file

@ -294,21 +294,30 @@ cfg_if! {
// Server needs to build a virtualized DOM tree
} else {
/// Represents an HTML element.
#[derive(educe::Educe, Clone)]
#[educe(Debug)]
#[derive(Clone)]
pub struct HtmlElement<El: ElementDescriptor> {
pub(crate) element: El,
pub(crate) attrs: SmallVec<[(Oco<'static, str>, Oco<'static, str>); 4]>,
#[educe(Debug(ignore))]
pub(crate) children: ElementChildren,
#[cfg(debug_assertions)]
pub(crate) view_marker: Option<String>
}
#[derive(Clone, educe::Educe, PartialEq, Eq)]
#[educe(Default)]
// debug without `children` field
impl<El: ElementDescriptor> fmt::Debug for HtmlElement<El> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut builder = f.debug_struct("HtmlElement");
builder.field("element", &self.element);
builder.field("attrs", &self.attrs);
#[cfg(debug_assertions)]
builder.field("view_marker", &self.view_marker);
builder.finish()
}
}
#[derive(Clone, Default, PartialEq, Eq)]
pub(crate) enum ElementChildren {
#[educe(Default)]
#[default]
Empty,
Children(Vec<View>),
InnerHtml(Oco<'static, str>),

View file

@ -17,7 +17,7 @@ cfg-if = "1"
html-escape = "0.2"
itertools = "0.10"
prettyplease = "0.2.4"
proc-macro-error = "1"
proc-macro-error = { version = "1", default-features = false }
proc-macro2 = "1"
quote = "1"
syn = { version = "2", features = ["full"] }

View file

@ -13,7 +13,7 @@ serde = { version = "1", features = ["derive"] }
quote = "1"
syn = { version = "2", features = ["full", "parsing", "extra-traits"] }
proc-macro2 = "1"
proc-macro-error = "1"
proc-macro-error = { version = "1", default-features = false }
xxhash-rust = { version = "0.8.6", features = ["const_xxh64"] }
const_format = "0.2.30"