From 981dfc83ea88799cb4ca41e9f072c4caef37b91b Mon Sep 17 00:00:00 2001 From: owjs3901 Date: Mon, 9 Jun 2025 16:41:26 +0900 Subject: [PATCH 1/3] To phf --- Cargo.lock | 87 ++++---- libs/css/Cargo.toml | 1 + libs/css/src/lib.rs | 132 +++++------- libs/extractor/Cargo.toml | 16 +- libs/extractor/src/extract_style/mod.rs | 43 ++-- libs/extractor/src/utils.rs | 269 ++++++++++++------------ libs/sheet/src/lib.rs | 6 +- 7 files changed, 258 insertions(+), 296 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 788a8a8e..41381a54 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -47,9 +47,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "bumpalo" @@ -253,6 +253,7 @@ name = "css" version = "0.1.0" dependencies = [ "once_cell", + "phf", "regex", "serde", "serial_test", @@ -300,7 +301,6 @@ version = "0.1.0" dependencies = [ "css", "insta", - "once_cell", "oxc_allocator", "oxc_ast", "oxc_ast_visit", @@ -308,6 +308,7 @@ dependencies = [ "oxc_parser", "oxc_span", "oxc_syntax", + "phf", "serial_test", ] @@ -583,9 +584,9 @@ checksum = "1036865bb9422d3300cf723f657c2851d0e9ab12567854b1f4eba3d77decf564" [[package]] name = "oxc-miette" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8c278d00ecc50ee84aba4768a7ab74eb325dff4dca8c0581495b850d53480ba" +checksum = "98b2c44324a4372caf6e3128a22744263c973e809fc598db3749ef3ff5e9fed4" dependencies = [ "cfg-if", "owo-colors", @@ -597,9 +598,9 @@ dependencies = [ [[package]] name = "oxc-miette-derive" -version = "2.1.2" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c0c893f53900e3fe01eca3d6d3b54085573c3e48fe25af9d57dd94ef600dcd3" +checksum = "3bd3da01a295024fa79e3b4aba14b590d91256a274ff29cc5ee8f55183b2df24" dependencies = [ "proc-macro2", "quote", @@ -608,23 +609,22 @@ dependencies = [ [[package]] name = "oxc_allocator" -version = "0.70.0" +version = "0.72.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffa6f20cba9bfb3486abc83c438f6a9278e4e030b6e9a16d2b5880132f96a1c" +checksum = "92e50218e74886659d1d13de8e6a4ff13c7e96924ed0017bc193a1feb8001b18" dependencies = [ "allocator-api2", "bumpalo", "hashbrown", "oxc_data_structures", "rustc-hash", - "simdutf8", ] [[package]] name = "oxc_ast" -version = "0.70.0" +version = "0.72.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "406a3454475f817e71a4b8fc0a92f04e149730bc4c07d0d1803d5fc9ef75c357" +checksum = "3a2c546ff7887418facf35f7996f0ca2099bde75931597429b408746bbaaddcd" dependencies = [ "bitflags", "cow-utils", @@ -639,10 +639,11 @@ dependencies = [ [[package]] name = "oxc_ast_macros" -version = "0.70.0" +version = "0.72.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d894148693dad702ad668945908f8712fe260c23aaf69bbf9d63a8213a350cdd" +checksum = "4ce8952bd09048ac55421aeecc06cc69db9f7220a25d69f3da8c6da3d95e5d6d" dependencies = [ + "phf", "proc-macro2", "quote", "syn", @@ -650,9 +651,9 @@ dependencies = [ [[package]] name = "oxc_ast_visit" -version = "0.70.0" +version = "0.72.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dba3ad9293c9eed98116a01ef008229895d9640d8a1abca12aa54fdc588a62f3" +checksum = "9a02f6d1e34a893acd0d6a0994ff56c861b08d472476c1bea95f9c04c6da3426" dependencies = [ "oxc_allocator", "oxc_ast", @@ -662,9 +663,9 @@ dependencies = [ [[package]] name = "oxc_cfg" -version = "0.70.0" +version = "0.72.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cf77762b883cd93185b9b132c9bb4ad35084bbf3bc75cb8bcb6242c1eb6363c" +checksum = "d869bb28669f0747c181d5f5e28d9aad063e6e4043af3222c9ab7358b9e8788f" dependencies = [ "bitflags", "itertools 0.14.0", @@ -677,9 +678,9 @@ dependencies = [ [[package]] name = "oxc_codegen" -version = "0.70.0" +version = "0.72.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3add299d3a1b4148e4ab85e59bb5c855fbfb2405a4719aad2a199a802495ba0" +checksum = "88e275fbd0f26987ef15aa29fef129e75d8e3799e309797444c6ed4c5761ba2b" dependencies = [ "bitflags", "cow-utils", @@ -698,15 +699,18 @@ dependencies = [ [[package]] name = "oxc_data_structures" -version = "0.70.0" +version = "0.72.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fc6d1eb979f77be6685a7a67ee5d5124c66ef611c601a84327e7d339db69c41" +checksum = "caccf3f0c0515f32520b6207a0ef4bafd0858f94685e84a50f38c53464418e8b" +dependencies = [ + "rustversion", +] [[package]] name = "oxc_diagnostics" -version = "0.70.0" +version = "0.72.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ba161cb61925de34f40b11c1d0d2f20e1894d5333d12f7c455a66244453512" +checksum = "79d4d0062c704ee11dbd56d6178f91ea17ccac05a59fe655b120a2b64d038739" dependencies = [ "cow-utils", "oxc-miette", @@ -714,9 +718,9 @@ dependencies = [ [[package]] name = "oxc_ecmascript" -version = "0.70.0" +version = "0.72.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92c1827f0741fae82618b6129c7a3248e8334336879f4968cfce231dd65a9ebf" +checksum = "3e0e3cc7daeec1ed3ed75abc02a456d7046c5878c61bda972d26e39850f25298" dependencies = [ "cow-utils", "num-bigint", @@ -728,9 +732,9 @@ dependencies = [ [[package]] name = "oxc_estree" -version = "0.70.0" +version = "0.72.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c671fd76e9990c90762b7f7f7dd5c3038bf72e3295989b2a71ba11870a193b07" +checksum = "68bb8e3cedd84c69241a0438d14ca09294ab95049b52dc7813bba017554c96fb" [[package]] name = "oxc_index" @@ -740,9 +744,9 @@ checksum = "2fa07b0cfa997730afed43705766ef27792873fdf5215b1391949fec678d2392" [[package]] name = "oxc_parser" -version = "0.70.0" +version = "0.72.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "959f68446d66542753f2fe081189b729ed89f8ed5302de1a522640ff42eba31e" +checksum = "d3bb3f8ed289796dcd7fecc4cfec895fbe29c269cf63658b63f352ce8fd7caf7" dependencies = [ "bitflags", "cow-utils", @@ -763,10 +767,11 @@ dependencies = [ [[package]] name = "oxc_regular_expression" -version = "0.70.0" +version = "0.72.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db7f5710da3fea0f40aaba14d547c61ac30c2840fb5d6a1ea9887766b72310c9" +checksum = "b8e58c2970fa7dcb10a5c757706c5824c43f13abb908a4651b221033c96c1ddc" dependencies = [ + "bitflags", "oxc_allocator", "oxc_ast_macros", "oxc_diagnostics", @@ -778,9 +783,9 @@ dependencies = [ [[package]] name = "oxc_semantic" -version = "0.70.0" +version = "0.72.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "425bec6c2ac20ff88573b8fbd87fc67aa97e49de9539979a98bcf79c37011077" +checksum = "ee61a7e935fa88d87b02c2279ffcf0704433006fa06a635e827fcdfc53b8f741" dependencies = [ "itertools 0.14.0", "oxc_allocator", @@ -814,9 +819,9 @@ dependencies = [ [[package]] name = "oxc_span" -version = "0.70.0" +version = "0.72.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbc66dc0868f4492562d37733754ef147073410004a44551acb102cf2562f66b" +checksum = "f290a8f173016c5b84327297bb3f2b9c158b0733703ac2f29d9e77f9b4821ddd" dependencies = [ "compact_str", "oxc-miette", @@ -827,9 +832,9 @@ dependencies = [ [[package]] name = "oxc_syntax" -version = "0.70.0" +version = "0.72.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68bfa728cbbf2161b9afc3325addde64feeb39e8167a0ef1472ad1f0efbc9c48" +checksum = "1d83f7a8a718db14fd6e8f864b70b0961e3b4ae44c9a28102262357c27aee944" dependencies = [ "bitflags", "cow-utils", @@ -1207,12 +1212,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" -[[package]] -name = "simdutf8" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" - [[package]] name = "similar" version = "2.7.0" diff --git a/libs/css/Cargo.toml b/libs/css/Cargo.toml index 619be9e0..ce729657 100644 --- a/libs/css/Cargo.toml +++ b/libs/css/Cargo.toml @@ -5,6 +5,7 @@ edition = "2024" [dependencies] once_cell = "1.21.3" +phf = "0.11" serial_test = "3.2.0" serde = { version = "1.0.219", features = ["derive"] } regex = "1.11.1" diff --git a/libs/css/src/lib.rs b/libs/css/src/lib.rs index f319a3ef..bba6d662 100644 --- a/libs/css/src/lib.rs +++ b/libs/css/src/lib.rs @@ -1,8 +1,9 @@ use once_cell::sync::Lazy; +use phf::{phf_map, phf_set}; use regex::Regex; use serde::{Deserialize, Serialize}; use std::cmp::Ordering; -use std::collections::{HashMap, HashSet}; +use std::collections::HashMap; use std::fmt; use std::fmt::{Display, Formatter}; use std::hash::{DefaultHasher, Hash, Hasher}; @@ -26,7 +27,7 @@ static SELECTOR_ORDER_MAP: Lazy> = Lazy::new(|| { map }); -static DEBUG: Lazy> = Lazy::new(|| Mutex::new(false)); +static DEBUG: Mutex = Mutex::new(false); pub fn set_debug(value: bool) { let mut debug = DEBUG.lock().unwrap(); @@ -165,10 +166,7 @@ impl Display for SelectorSeparator { } } -static DOUBLE_SEPARATOR: Lazy> = Lazy::new(|| { - let mut set = HashSet::new(); - - for key in [ +static DOUBLE_SEPARATOR: phf::Set<&str> = phf_set! { "placeholder", "before", "after", @@ -178,11 +176,7 @@ static DOUBLE_SEPARATOR: Lazy> = Lazy::new(|| { "view-transition-image-pair", "view-transition-new", "view-transition-old", - ] { - set.insert(key); - } - set -}); +}; pub fn get_selector_separator(key: &str) -> SelectorSeparator { if key.starts_with(":") || key.is_empty() || key.starts_with("[") { @@ -218,71 +212,47 @@ impl From<[&str; 2]> for PropertyType { } } -static GLOBAL_STYLE_PROPERTY: Lazy> = Lazy::new(|| { - let mut map = HashMap::new(); - - for (key, value) in [ - ("bg", "background"), - ("bgAttachment", "background-attachment"), - ("bgClip", "background-clip"), - ("bgColor", "background-color"), - ("bgImage", "background-image"), - ("bgOrigin", "background-origin"), - ("bgPosition", "background-position"), - ("bgPositionX", "background-position-x"), - ("bgPositionY", "background-position-y"), - ("bgRepeat", "background-repeat"), - ("bgSize", "background-size"), - ("animationDir", "animation-direction"), - ("flexDir", "flex-direction"), - ("pos", "position"), - ("m", "margin"), - ("mt", "margin-top"), - ("mr", "margin-right"), - ("mb", "margin-bottom"), - ("ml", "margin-left"), - ("p", "padding"), - ("pt", "padding-top"), - ("pr", "padding-right"), - ("pb", "padding-bottom"), - ("pl", "padding-left"), - ("w", "width"), - ("h", "height"), - ("minW", "min-width"), - ("minH", "min-height"), - ("maxW", "max-width"), - ("maxH", "max-height"), - ] { - map.insert(key, value.into()); - } - - for (key, value) in [ - ("mx", ["margin-left", "margin-right"]), - ("my", ["margin-top", "margin-bottom"]), - ("px", ["padding-left", "padding-right"]), - ("py", ["padding-top", "padding-bottom"]), - ("boxSize", ["width", "height"]), - ( - "borderBottomRadius", - ["border-bottom-left-radius", "border-bottom-right-radius"], - ), - ( - "borderTopRadius", - ["border-top-left-radius", "border-top-right-radius"], - ), - ( - "borderLeftRadius", - ["border-top-left-radius", "border-bottom-left-radius"], - ), - ( - "borderRightRadius", - ["border-top-right-radius", "border-bottom-right-radius"], - ), - ] { - map.insert(key, value.into()); - } - map -}); +static GLOBAL_STYLE_PROPERTY: phf::Map<&str, &[&str]> = phf_map! { + "bg" => &["background"], + "bgAttachment" => &["background-attachment"], + "bgClip" => &["background-clip"], + "bgColor" => &["background-color"], + "bgImage" => &["background-image"], + "bgOrigin" => &["background-origin"], + "bgPosition" => &["background-position"], + "bgPositionX" => &["background-position-x"], + "bgPositionY" => &["background-position-y"], + "bgRepeat" => &["background-repeat"], + "bgSize" => &["background-size"], + "animationDir" => &["animation-direction"], + "flexDir" => &["flex-direction"], + "pos" => &["position"], + "m" => &["margin"], + "mt" => &["margin-top"], + "mr" => &["margin-right"], + "mb" => &["margin-bottom"], + "ml" => &["margin-left"], + "p" => &["padding"], + "pt" => &["padding-top"], + "pr" => &["padding-right"], + "pb" => &["padding-bottom"], + "pl" => &["padding-left"], + "w" => &["width"], + "h" => &["height"], + "minW" => &["min-width"], + "minH" => &["min-height"], + "maxW" => &["max-width"], + "maxH" => &["max-height"], + "mx" => &["margin-left", "margin-right"], + "my" => &["margin-top", "margin-bottom"], + "px" => &["padding-left", "padding-right"], + "py" => &["padding-top", "padding-bottom"], + "boxSize" => &["width", "height"], + "borderBottomRadius" => &["border-bottom-left-radius", "border-bottom-right-radius"], + "borderTopRadius" => &["border-top-left-radius", "border-top-right-radius"], + "borderLeftRadius" => &["border-top-left-radius", "border-bottom-left-radius"], + "borderRightRadius" => &["border-top-right-radius", "border-bottom-right-radius"], +}; static GLOBAL_CLASS_MAP: Lazy>> = Lazy::new(|| Mutex::new(HashMap::new())); @@ -338,15 +308,19 @@ pub fn convert_property(property: &str) -> PropertyType { GLOBAL_STYLE_PROPERTY .get(property) .cloned() + .map(|v| match v.len() { + 1 => PropertyType::Single(v[0].to_string()), + _ => PropertyType::Multi(v.iter().map(|v| v.to_string()).collect()), + }) .unwrap_or_else(|| to_kebab_case(property).into()) } pub fn short_to_long(property: &str) -> String { GLOBAL_STYLE_PROPERTY .get(property) - .map(|v| match v { - PropertyType::Single(value) => to_camel_case(value), - PropertyType::Multi(_) => property.to_string(), + .map(|v| match v.len() { + 1 => to_camel_case(v[0]), + _ => property.to_string(), }) .unwrap_or_else(|| property.to_string()) } diff --git a/libs/extractor/Cargo.toml b/libs/extractor/Cargo.toml index 9546905d..26af5650 100644 --- a/libs/extractor/Cargo.toml +++ b/libs/extractor/Cargo.toml @@ -4,15 +4,15 @@ version = "0.1.0" edition = "2024" [dependencies] -oxc_parser = "0.70.0" -oxc_syntax = "0.70.0" -oxc_span = "0.70.0" -oxc_allocator = "0.70.0" -oxc_ast = "0.70.0" -oxc_ast_visit = "0.70.0" -oxc_codegen = "0.70.0" +oxc_parser = "0.72.3" +oxc_syntax = "0.72.3" +oxc_span = "0.72.3" +oxc_allocator = "0.72.3" +oxc_ast = "0.72.3" +oxc_ast_visit = "0.72.3" +oxc_codegen = "0.72.3" css = { path = "../css" } -once_cell = "1.21.3" +phf = "0.11" [dev-dependencies] insta = "1.43.1" diff --git a/libs/extractor/src/extract_style/mod.rs b/libs/extractor/src/extract_style/mod.rs index 9dd5291c..c9632b66 100644 --- a/libs/extractor/src/extract_style/mod.rs +++ b/libs/extractor/src/extract_style/mod.rs @@ -4,8 +4,7 @@ use css::{ StyleSelector, css_to_classname, optimize_value, sheet_to_classname, sheet_to_variable_name, short_to_long, }; -use once_cell::sync::Lazy; -use std::collections::HashSet; +use phf::phf_set; #[derive(Debug, PartialEq, Clone, Eq, Hash, Ord, PartialOrd)] pub struct ExtractStaticStyle { @@ -21,27 +20,25 @@ pub struct ExtractStaticStyle { style_order: Option, } -static MAINTAIN_VALUE_PROPERTIES: Lazy> = Lazy::new(|| { - let mut set = HashSet::::new(); - set.insert("opacity".to_string()); - set.insert("flex".to_string()); - set.insert("zIndex".to_string()); - set.insert("lineClamp".to_string()); - set.insert("fontWeight".to_string()); - set.insert("scale".to_string()); - set.insert("aspectRatio".to_string()); - set.insert("flexGrow".to_string()); - set.insert("flexShrink".to_string()); - set.insert("order".to_string()); - set.insert("gridColumn".to_string()); - set.insert("gridColumnStart".to_string()); - set.insert("gridColumnEnd".to_string()); - set.insert("gridRow".to_string()); - set.insert("gridRowStart".to_string()); - set.insert("gridRowEnd".to_string()); - set.insert("animationIterationCount".to_string()); - set -}); +static MAINTAIN_VALUE_PROPERTIES: phf::Set<&str> = phf_set! { + "opacity", + "flex", + "zIndex", + "lineClamp", + "fontWeight", + "scale", + "aspectRatio", + "flexGrow", + "flexShrink", + "order", + "gridColumn", + "gridColumnStart", + "gridColumnEnd", + "gridRow", + "gridRowStart", + "gridRowEnd", + "animationIterationCount" +}; impl ExtractStaticStyle { /// create a new ExtractStaticStyle diff --git a/libs/extractor/src/utils.rs b/libs/extractor/src/utils.rs index 70d5f4c2..405337ea 100644 --- a/libs/extractor/src/utils.rs +++ b/libs/extractor/src/utils.rs @@ -1,11 +1,10 @@ -use once_cell::sync::Lazy; use oxc_allocator::{Allocator, CloneIn}; use oxc_ast::ast::{Expression, JSXAttributeValue, Statement}; use oxc_codegen::Codegen; use oxc_parser::Parser; use oxc_span::{SPAN, SourceType}; use oxc_syntax::operator::UnaryOperator; -use std::collections::HashSet; +use phf::phf_set; /// Convert a value to a pixel value pub fn convert_value(value: &str) -> String { @@ -28,142 +27,136 @@ pub fn expression_to_code(expression: &Expression) -> String { code[0..code.len() - 2].to_string() } -static SPECIAL_PROPERTIES: Lazy> = Lazy::new(|| { - let mut set = HashSet::<&str>::new(); - for prop in [ - "style", - "className", - "role", - "ref", - "key", - "id", - "alt", - "type", - "src", - "children", - "placeholder", - "tabIndex", - "maxLength", - "minLength", - "disabled", - "readOnly", - "autoFocus", - "required", - "checked", - "defaultChecked", - "value", - "defaultValue", - "selected", - "multiple", - "accept", - "step", - "autoComplete", - "capture", - "form", - "formAction", - "formEncType", - "formMethod", - "formNoValidate", - "formTarget", - "list", - "max", - "min", - "name", - "pattern", - "size", - "challenge", - "keyType", - "keyParams", - "htmlFor", - "crossOrigin", - "fetchPriority", - "href", - "hrefLang", - "integrity", - "media", - "imageSrcSet", - "imageSizes", - "referrerPolicy", - "sizes", - "charSet", - "precedence", - "autoPlay", - "controls", - "controlsList", - "loop", - "mediaGroup", - "muted", - "playsInline", - "preload", - "httpEquiv", - "high", - "low", - "optimum", - "classID", - "data", - "useMap", - "wmode", - "reversed", - "start", - "label", - "async", - "defer", - "noModule", - "srcSet", - "scoped", - "align", - "bgcolor", - "cellPadding", - "cellSpacing", - "frame", - "rules", - "summary", - "cols", - "dirName", - "rows", - "wrap", - "colSpan", - "headers", - "rowSpan", - "scope", - "abbr", - "valign", - "dateTime", - "default", - "kind", - "srcLang", - "poster", - "disablePictureInPicture", - "disableRemotePlayback", - "download", - "target", - "rel", - "ping", - "coords", - "shape", - "isMap", - "longDesc", - "loading", - "decoding", - "importance", - "axis", - "char", - "charOff", - "span", - "noWrap", - "vSpace", - "hSpace", - "compact", - "scheme", - "indeterminate", - "defaultSelected", - "selectedIndex", - "selectedOptions", - ] { - set.insert(prop); - } - set -}); +static SPECIAL_PROPERTIES: phf::Set<&str> = phf_set! { + "style", + "className", + "role", + "ref", + "key", + "id", + "alt", + "type", + "src", + "children", + "placeholder", + "tabIndex", + "maxLength", + "minLength", + "disabled", + "readOnly", + "autoFocus", + "required", + "checked", + "defaultChecked", + "value", + "defaultValue", + "selected", + "multiple", + "accept", + "step", + "autoComplete", + "capture", + "form", + "formAction", + "formEncType", + "formMethod", + "formNoValidate", + "formTarget", + "list", + "max", + "min", + "name", + "pattern", + "size", + "challenge", + "keyType", + "keyParams", + "htmlFor", + "crossOrigin", + "fetchPriority", + "href", + "hrefLang", + "integrity", + "media", + "imageSrcSet", + "imageSizes", + "referrerPolicy", + "sizes", + "charSet", + "precedence", + "autoPlay", + "controls", + "controlsList", + "loop", + "mediaGroup", + "muted", + "playsInline", + "preload", + "httpEquiv", + "high", + "low", + "optimum", + "classID", + "data", + "useMap", + "wmode", + "reversed", + "start", + "label", + "async", + "defer", + "noModule", + "srcSet", + "scoped", + "align", + "bgcolor", + "cellPadding", + "cellSpacing", + "frame", + "rules", + "summary", + "cols", + "dirName", + "rows", + "wrap", + "colSpan", + "headers", + "rowSpan", + "scope", + "abbr", + "valign", + "dateTime", + "default", + "kind", + "srcLang", + "poster", + "disablePictureInPicture", + "disableRemotePlayback", + "download", + "target", + "rel", + "ping", + "coords", + "shape", + "isMap", + "longDesc", + "loading", + "decoding", + "importance", + "axis", + "char", + "charOff", + "span", + "noWrap", + "vSpace", + "hSpace", + "compact", + "scheme", + "indeterminate", + "defaultSelected", + "selectedIndex", + "selectedOptions" +}; pub fn is_special_property(name: &str) -> bool { name.starts_with("on") diff --git a/libs/sheet/src/lib.rs b/libs/sheet/src/lib.rs index 5f57e192..58934734 100644 --- a/libs/sheet/src/lib.rs +++ b/libs/sheet/src/lib.rs @@ -1,7 +1,7 @@ pub mod theme; use crate::theme::Theme; -use css::{convert_property, merge_selector, PropertyType, StyleSelector}; +use css::{PropertyType, StyleSelector, convert_property, merge_selector}; use once_cell::sync::Lazy; use regex::Regex; use serde::de::Error; @@ -193,9 +193,7 @@ impl StyleSheet { .enumerate() .find(|(idx, _)| (*idx as u8) == *level) .map(|(_, bp)| *bp) - .unwrap_or_else(|| { - self.theme.breakpoints.last().cloned().unwrap_or(0) - }), + .unwrap_or_else(|| self.theme.breakpoints.last().cloned().unwrap_or(0)), ) }; if !sorted_props.is_empty() { From f942fd6c7dd3e8c71405bab65a035f837e1b1bfe Mon Sep 17 00:00:00 2001 From: owjs3901 Date: Mon, 9 Jun 2025 16:56:23 +0900 Subject: [PATCH 2/3] Add profile --- benchmark.js | 5 +++++ benchmark/next-chakra-ui/package.json | 4 ++-- benchmark/next-devup-ui/package.json | 4 ++-- benchmark/next-kuma-ui/package.json | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/benchmark.js b/benchmark.js index 5f87ae89..9a124a0b 100644 --- a/benchmark.js +++ b/benchmark.js @@ -20,6 +20,11 @@ function clearBuildFile() { recursive: true, force: true, }) + if (existsSync('./benchmark/next-devup-ui/.df')) + rmSync('./benchmark/next-devup-ui/.df', { + recursive: true, + force: true, + }) } function checkDirSize(path) { diff --git a/benchmark/next-chakra-ui/package.json b/benchmark/next-chakra-ui/package.json index 0fb94dc5..649f5b67 100644 --- a/benchmark/next-chakra-ui/package.json +++ b/benchmark/next-chakra-ui/package.json @@ -5,7 +5,7 @@ "private": true, "scripts": { "dev": "next dev", - "build": "next build", + "build": "next build --experimental-debug-memory-usage", "start": "next start", "lint": "next lint" }, @@ -24,4 +24,4 @@ "@types/react-dom": "^19", "typescript": "^5" } -} +} \ No newline at end of file diff --git a/benchmark/next-devup-ui/package.json b/benchmark/next-devup-ui/package.json index 46b1be75..65474ce6 100644 --- a/benchmark/next-devup-ui/package.json +++ b/benchmark/next-devup-ui/package.json @@ -5,7 +5,7 @@ "private": true, "scripts": { "dev": "next dev", - "build": "next build", + "build": "next build --experimental-debug-memory-usage", "start": "next start", "lint": "eslint" }, @@ -22,4 +22,4 @@ "@types/react": "^19", "@types/react-dom": "^19" } -} +} \ No newline at end of file diff --git a/benchmark/next-kuma-ui/package.json b/benchmark/next-kuma-ui/package.json index d3a0bbd7..c2c2d9b5 100644 --- a/benchmark/next-kuma-ui/package.json +++ b/benchmark/next-kuma-ui/package.json @@ -5,7 +5,7 @@ "private": true, "scripts": { "dev": "next dev", - "build": "next build", + "build": "next build --experimental-debug-memory-usage", "start": "next start", "lint": "next lint" }, @@ -22,4 +22,4 @@ "@types/react": "^19", "@types/react-dom": "^19" } -} +} \ No newline at end of file From 94681ffa84c6167ee3121ba58e94bebf4e3a9563 Mon Sep 17 00:00:00 2001 From: owjs3901 Date: Mon, 9 Jun 2025 17:05:55 +0900 Subject: [PATCH 3/3] To phf --- .changeset/olive-guests-grin.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/olive-guests-grin.md diff --git a/.changeset/olive-guests-grin.md b/.changeset/olive-guests-grin.md new file mode 100644 index 00000000..aec58199 --- /dev/null +++ b/.changeset/olive-guests-grin.md @@ -0,0 +1,5 @@ +--- +"@devup-ui/wasm": patch +--- + +to phf