From 9aba0a186402b79b8ba6433e56dcbbdf2e85ea2d Mon Sep 17 00:00:00 2001 From: owjs3901 Date: Tue, 8 Apr 2025 22:15:21 +0900 Subject: [PATCH 1/6] Fix vite plugin, Apply css optimize --- .changeset/fast-ravens-rescue.md | 5 + .changeset/young-chairs-yawn.md | 5 + Cargo.lock | 4 +- apps/vite/src/App.tsx | 21 +- benchmark/next-chakra-ui/package.json | 2 +- bindings/devup-ui-wasm/src/lib.rs | 2 +- libs/css/src/lib.rs | 2 +- libs/extractor/src/extract_style/mod.rs | 23 +- libs/extractor/src/lib.rs | 674 +++++----- .../extractor__tests__apply_typography-2.snap | 8 +- .../extractor__tests__apply_typography-3.snap | 8 +- .../extractor__tests__apply_typography.snap | 8 +- ...ractor__tests__apply_var_typography-2.snap | 6 +- ...ractor__tests__apply_var_typography-3.snap | 6 +- ...xtractor__tests__apply_var_typography.snap | 6 +- ...tor__tests__avoid_same_name_component.snap | 8 +- .../extractor__tests__backtick_prop-2.snap | 8 +- .../extractor__tests__backtick_prop.snap | 8 +- .../extractor__tests__component_in_func.snap | 24 +- .../extractor__tests__convert_tag-2.snap | 6 +- .../extractor__tests__convert_tag-3.snap | 6 +- .../extractor__tests__convert_tag.snap | 6 +- ..._css_props_destructuring_assignment-2.snap | 24 +- ...s__css_props_destructuring_assignment.snap | 16 +- .../extractor__tests__custom_selector-2.snap | 8 +- .../extractor__tests__custom_selector-3.snap | 8 +- .../extractor__tests__custom_selector.snap | 8 +- ...tractor__tests__duplicate_style_props.snap | 8 +- ...ts__extract_class_name_from_component.snap | 16 +- ...tract_compound_responsive_style_props.snap | 38 +- ...tests__extract_conditional_selector-2.snap | 8 +- ...tests__extract_conditional_selector-3.snap | 6 +- ...tests__extract_conditional_selector-4.snap | 8 +- ...__tests__extract_conditional_selector.snap | 8 +- ...ts__extract_conditional_style_props-2.snap | 8 +- ...ts__extract_conditional_style_props-3.snap | 8 +- ...ts__extract_conditional_style_props-4.snap | 6 +- ...ts__extract_conditional_style_props-5.snap | 8 +- ...ts__extract_conditional_style_props-6.snap | 8 +- ...ts__extract_conditional_style_props-7.snap | 8 +- ...ts__extract_conditional_style_props-8.snap | 8 +- ...ts__extract_conditional_style_props-9.snap | 18 + ...ests__extract_conditional_style_props.snap | 12 +- ...xtract_dynamic_responsive_style_props.snap | 24 +- ..._tests__extract_dynamic_style_props-2.snap | 8 +- ..._tests__extract_dynamic_style_props-3.snap | 8 +- ..._tests__extract_dynamic_style_props-4.snap | 8 +- ...r__tests__extract_dynamic_style_props.snap | 16 +- ...tract_dynamic_style_props_with_type-2.snap | 8 +- ...tract_dynamic_style_props_with_type-3.snap | 8 +- ...extract_dynamic_style_props_with_type.snap | 8 +- .../extractor__tests__extract_just_tsx-2.snap | 6 +- .../extractor__tests__extract_just_tsx.snap | 6 +- ...ractor__tests__extract_logical_case-2.snap | 8 +- ...ractor__tests__extract_logical_case-3.snap | 8 +- ...ractor__tests__extract_logical_case-4.snap | 8 +- ...xtractor__tests__extract_logical_case.snap | 8 +- ..._responsive_conditional_style_props-2.snap | 28 +- ..._responsive_conditional_style_props-3.snap | 26 +- ..._responsive_conditional_style_props-4.snap | 44 +- ..._responsive_conditional_style_props-5.snap | 48 +- ..._responsive_conditional_style_props-6.snap | 52 +- ..._responsive_conditional_style_props-7.snap | 8 +- ..._responsive_conditional_style_props-8.snap | 8 +- ...ct_responsive_conditional_style_props.snap | 12 +- ...itional_style_props_with_class_name-2.snap | 8 +- ...nditional_style_props_with_class_name.snap | 14 +- ...sts__extract_responsive_style_props-2.snap | 16 +- ...tests__extract_responsive_style_props.snap | 20 +- .../extractor__tests__extract_selector.snap | 8 +- ...s__extract_selector_with_responsive-2.snap | 8 +- ...sts__extract_selector_with_responsive.snap | 8 +- ...extract_static_css_class_name_props-2.snap | 8 +- ...extract_static_css_class_name_props-3.snap | 16 +- ...extract_static_css_class_name_props-4.snap | 8 +- ...extract_static_css_class_name_props-5.snap | 8 +- ...extract_static_css_class_name_props-6.snap | 12 +- ...extract_static_css_class_name_props-7.snap | 6 +- ...extract_static_css_class_name_props-8.snap | 6 +- ...__extract_static_css_class_name_props.snap | 8 +- ...ests__extract_static_css_with_theme-2.snap | 8 +- ...ests__extract_static_css_with_theme-3.snap | 8 +- ..._tests__extract_static_css_with_theme.snap | 8 +- ...tractor__tests__extract_style_props-2.snap | 16 +- ...tractor__tests__extract_style_props-3.snap | 16 +- ...tractor__tests__extract_style_props-4.snap | 16 +- ...tractor__tests__extract_style_props-5.snap | 16 +- ...tractor__tests__extract_style_props-6.snap | 8 +- ...extractor__tests__extract_style_props.snap | 16 +- ...extract_style_props_with_class_name-2.snap | 16 +- ...extract_style_props_with_class_name-3.snap | 16 +- ...extract_style_props_with_class_name-4.snap | 16 +- ...extract_style_props_with_class_name-5.snap | 16 +- ...extract_style_props_with_class_name-6.snap | 16 +- ...__extract_style_props_with_class_name.snap | 16 +- ...act_variable_style_props_with_style-2.snap | 8 +- ...tract_variable_style_props_with_style.snap | 8 +- ..._extract_wrong_responsive_style_props.snap | 6 +- ...xtractor__tests__group_selector_props.snap | 8 +- ...ractor__tests__ignore_special_props-2.snap | 6 +- ...xtractor__tests__ignore_special_props.snap | 8 +- ...ractor__tests__import_wrong_component.snap | 6 +- .../extractor__tests__maintain_value.snap | 22 +- .../extractor__tests__negative_props-2.snap | 8 +- .../extractor__tests__negative_props-3.snap | 8 +- .../extractor__tests__negative_props-4.snap | 8 +- .../extractor__tests__negative_props-5.snap | 8 +- .../extractor__tests__negative_props-6.snap | 8 +- .../extractor__tests__negative_props-7.snap | 8 +- .../extractor__tests__negative_props.snap | 8 +- ...rops_direct_array_responsive_select-2.snap | 32 +- ..._props_direct_array_responsive_select.snap | 32 +- ...r__tests__props_direct_array_select-2.snap | 12 +- ...r__tests__props_direct_array_select-3.snap | 24 +- ...r__tests__props_direct_array_select-4.snap | 24 +- ...r__tests__props_direct_array_select-5.snap | 44 +- ...r__tests__props_direct_array_select-6.snap | 8 +- ...r__tests__props_direct_array_select-7.snap | 12 +- ...tor__tests__props_direct_array_select.snap | 8 +- ...props_direct_hybrid_responsive_select.snap | 30 +- ...ops_direct_object_responsive_select-2.snap | 32 +- ...props_direct_object_responsive_select.snap | 32 +- ...__tests__props_direct_object_select-2.snap | 8 +- ...__tests__props_direct_object_select-3.snap | 20 +- ...__tests__props_direct_object_select-4.snap | 24 +- ...or__tests__props_direct_object_select.snap | 8 +- ...rect_variable_array_responsive_select.snap | 24 +- ...ect_variable_object_responsive_select.snap | 24 +- ...props_direct_variable_object_select-2.snap | 8 +- ...__props_direct_variable_object_select.snap | 12 +- ...ts__props_wrong_direct_array_select-2.snap | 8 +- ...ts__props_wrong_direct_array_select-3.snap | 8 +- ...ts__props_wrong_direct_array_select-4.snap | 8 +- ...ests__props_wrong_direct_array_select.snap | 8 +- ...s__props_wrong_direct_object_select-2.snap | 8 +- ...s__props_wrong_direct_object_select-3.snap | 8 +- ...s__props_wrong_direct_object_select-4.snap | 8 +- ...sts__props_wrong_direct_object_select.snap | 6 +- .../extractor__tests__rest_props.snap | 8 +- .../extractor__tests__style_order-2.snap | 30 +- .../extractor__tests__style_order-3.snap | 8 +- .../extractor__tests__style_order-4.snap | 8 +- .../extractor__tests__style_order-5.snap | 8 +- .../extractor__tests__style_order-6.snap | 54 +- .../extractor__tests__style_order-7.snap | 8 +- .../extractor__tests__style_order.snap | 38 +- ...actor__tests__support_transpile_cjs-2.snap | 30 +- ...actor__tests__support_transpile_cjs-3.snap | 30 +- ...tractor__tests__support_transpile_cjs.snap | 30 +- ...actor__tests__support_transpile_mjs-2.snap | 30 +- ...tractor__tests__support_transpile_mjs.snap | 30 +- ...ctor__tests__template_literal_props-2.snap | 8 +- ...ctor__tests__template_literal_props-3.snap | 8 +- ...ctor__tests__template_literal_props-4.snap | 8 +- ...ractor__tests__template_literal_props.snap | 8 +- ...tests__ternary_operator_in_selector-2.snap | 30 +- ...tests__ternary_operator_in_selector-3.snap | 38 +- ...__tests__ternary_operator_in_selector.snap | 30 +- .../extractor__tests__theme_props.snap | 16 +- .../extractor__tests__theme_selector-2.snap | 16 +- .../extractor__tests__theme_selector-3.snap | 8 +- .../extractor__tests__theme_selector.snap | 8 +- libs/extractor/src/style_extractor.rs | 3 +- libs/extractor/src/visit.rs | 38 +- package.json | 2 +- .../vite-plugin/src/__tests__/plugin.test.ts | 37 + packages/vite-plugin/src/plugin.ts | 10 + pnpm-lock.yaml | 1111 +++++++++-------- 168 files changed, 2115 insertions(+), 1990 deletions(-) create mode 100644 .changeset/fast-ravens-rescue.md create mode 100644 .changeset/young-chairs-yawn.md create mode 100644 libs/extractor/src/snapshots/extractor__tests__extract_conditional_style_props-9.snap diff --git a/.changeset/fast-ravens-rescue.md b/.changeset/fast-ravens-rescue.md new file mode 100644 index 00000000..d0677808 --- /dev/null +++ b/.changeset/fast-ravens-rescue.md @@ -0,0 +1,5 @@ +--- +"@devup-ui/vite-plugin": patch +--- + +Fix css duplicate issue when exporting diff --git a/.changeset/young-chairs-yawn.md b/.changeset/young-chairs-yawn.md new file mode 100644 index 00000000..9b510f94 --- /dev/null +++ b/.changeset/young-chairs-yawn.md @@ -0,0 +1,5 @@ +--- +"@devup-ui/wasm": patch +--- + +Apply css optimize diff --git a/Cargo.lock b/Cargo.lock index 95424235..c8a6f6ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -399,9 +399,9 @@ dependencies = [ [[package]] name = "half" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7db2ff139bba50379da6aa0766b52fdcb62cb5b263009b09ed58ba604e14bbd1" +checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" dependencies = [ "cfg-if", "crunchy", diff --git a/apps/vite/src/App.tsx b/apps/vite/src/App.tsx index a980c083..e9a0cb82 100644 --- a/apps/vite/src/App.tsx +++ b/apps/vite/src/App.tsx @@ -1,4 +1,4 @@ -import { Box, Text } from '@devup-ui/react' +import { Box, Center, Text } from '@devup-ui/react' import { Lib } from 'vite-lib-example' export default function App() { @@ -14,7 +14,26 @@ export default function App() { hello + + + typo + ) } +export function NoContent(props: { text?: string; background?: boolean }) { + const { text, background } = props + return ( +
+ + {text ?? '표시할 정보가 없습니다.'} + +
+ ) +} diff --git a/benchmark/next-chakra-ui/package.json b/benchmark/next-chakra-ui/package.json index 4df1f662..181698b8 100644 --- a/benchmark/next-chakra-ui/package.json +++ b/benchmark/next-chakra-ui/package.json @@ -10,7 +10,7 @@ "lint": "next lint" }, "dependencies": { - "@chakra-ui/react": "^3.15.0", + "@chakra-ui/react": "^3.15.1", "@emotion/react": "^11.14.0", "next": "^15.2.4", "next-themes": "^0.4.6", diff --git a/bindings/devup-ui-wasm/src/lib.rs b/bindings/devup-ui-wasm/src/lib.rs index 6673309f..6cbfb559 100644 --- a/bindings/devup-ui-wasm/src/lib.rs +++ b/bindings/devup-ui-wasm/src/lib.rs @@ -13,7 +13,7 @@ static GLOBAL_STYLE_SHEET: Lazy> = #[wasm_bindgen] pub struct Output { code: String, - styles: Vec, + styles: HashSet, } #[wasm_bindgen] extern "C" { diff --git a/libs/css/src/lib.rs b/libs/css/src/lib.rs index be8667f0..4fd13bc2 100644 --- a/libs/css/src/lib.rs +++ b/libs/css/src/lib.rs @@ -372,7 +372,7 @@ fn optimize_color(value: &str) -> String { format!("#{}", ret) } -fn optimize_value(value: &str) -> String { +pub fn optimize_value(value: &str) -> String { let mut ret = value.trim().to_string(); if ret.contains(",") { ret = F_SPACE_RE.replace_all(&ret, ",").trim().to_string(); diff --git a/libs/extractor/src/extract_style/mod.rs b/libs/extractor/src/extract_style/mod.rs index 6c6e61ba..d97d078a 100644 --- a/libs/extractor/src/extract_style/mod.rs +++ b/libs/extractor/src/extract_style/mod.rs @@ -1,12 +1,13 @@ -use crate::utils::convert_value; use crate::StyleProperty; +use crate::utils::convert_value; use css::{ - css_to_classname, sheet_to_classname, sheet_to_variable_name, short_to_long, StyleSelector, + 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; -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Clone, Eq, Hash, Ord, PartialOrd)] pub struct ExtractStaticStyle { /// property property: String, @@ -46,11 +47,11 @@ impl ExtractStaticStyle { /// create a new ExtractStaticStyle pub fn new(property: &str, value: &str, level: u8, selector: Option) -> Self { Self { - value: if MAINTAIN_VALUE_PROPERTIES.contains(property) { + value: optimize_value(&if MAINTAIN_VALUE_PROPERTIES.contains(property) { value.to_string() } else { convert_value(value) - }, + }), property: short_to_long(property), level, selector, @@ -65,11 +66,11 @@ impl ExtractStaticStyle { selector: Option, ) -> Self { Self { - value: if MAINTAIN_VALUE_PROPERTIES.contains(property) { + value: optimize_value(&if MAINTAIN_VALUE_PROPERTIES.contains(property) { value.to_string() } else { convert_value(value) - }, + }), property: property.to_string(), level, selector, @@ -113,7 +114,7 @@ impl ExtractStyleProperty for ExtractStaticStyle { if MAINTAIN_VALUE_PROPERTIES.contains(self.property.as_str()) { self.value.to_string() } else { - convert_value(self.value.as_str()) + optimize_value(convert_value(self.value.as_str()).as_str()) } .as_str(), ), @@ -122,7 +123,7 @@ impl ExtractStyleProperty for ExtractStaticStyle { )) } } -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Clone, Eq, Hash, Ord, PartialOrd)] pub struct ExtractCss { /// css code pub css: String, @@ -135,7 +136,7 @@ impl ExtractStyleProperty for ExtractCss { } } -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Clone, Eq, Hash, Ord, PartialOrd)] pub struct ExtractDynamicStyle { /// property property: String, @@ -207,7 +208,7 @@ impl ExtractStyleProperty for ExtractDynamicStyle { } } } -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Clone, Eq, Hash, Ord, PartialOrd)] pub enum ExtractStyleValue { Static(ExtractStaticStyle), Typography(String), diff --git a/libs/extractor/src/lib.rs b/libs/extractor/src/lib.rs index 8b059780..d41e0930 100644 --- a/libs/extractor/src/lib.rs +++ b/libs/extractor/src/lib.rs @@ -14,7 +14,7 @@ use oxc_ast_visit::VisitMut; use oxc_codegen::Codegen; use oxc_parser::{Parser, ParserReturn}; use oxc_span::SourceType; -use std::collections::BTreeMap; +use std::collections::{BTreeMap, HashSet}; use std::error::Error; #[derive(Debug)] pub enum ExtractStyleProp<'a> { @@ -73,10 +73,10 @@ pub enum StyleProperty { }, } -#[derive(Debug, PartialEq)] +#[derive(Debug)] pub struct ExtractOutput { // used styles - pub styles: Vec, + pub styles: HashSet, // output source pub code: String, @@ -96,7 +96,7 @@ pub fn extract( if !code.contains(option.package.as_str()) { // skip if not using package return Ok(ExtractOutput { - styles: vec![], + styles: HashSet::new(), code: code.to_string(), }); } @@ -128,16 +128,39 @@ pub fn extract( #[cfg(test)] mod tests { + use std::collections::BTreeSet; + use super::*; use css::reset_class_map; use insta::assert_debug_snapshot; use serial_test::serial; + #[derive(Debug)] + struct ToBTreeSet { + // used styles + styles: BTreeSet, + + // output source + code: String, + } + + impl From for ToBTreeSet { + fn from(output: ExtractOutput) -> Self { + Self { + styles: { + let mut set = BTreeSet::new(); + set.extend(output.styles); + set + }, + code: output.code, + } + } + } #[test] #[serial] fn extract_just_tsx() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", "const a = 1;", @@ -147,10 +170,10 @@ mod tests { }, ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", "", @@ -160,26 +183,28 @@ mod tests { }, ) .unwrap() - ); + )); } #[test] #[serial] fn ignore_special_props() { reset_class_map(); - assert_debug_snapshot!(extract( - "test.tsx", - r#"import {Box} from '@devup-ui/core' + assert_debug_snapshot!(ToBTreeSet::from( + extract( + "test.tsx", + r#"import {Box} from '@devup-ui/core' {}} aria-valuenow={24} key={2} tabIndex={1} id="id" /> "#, - ExtractOption { - package: "@devup-ui/core".to_string(), - css_file: None - } - ) - .unwrap()); + ExtractOption { + package: "@devup-ui/core".to_string(), + css_file: None + } + ) + .unwrap() + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Input} from '@devup-ui/core' @@ -191,14 +216,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn convert_tag() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box} from '@devup-ui/core' @@ -210,10 +235,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box} from '@devup-ui/core' @@ -225,8 +250,8 @@ mod tests { } ) .unwrap() - ); - assert_debug_snapshot!( + )); + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box} from '@devup-ui/core' @@ -238,7 +263,7 @@ mod tests { } ) .unwrap() - ); + )); // assert_debug_snapshot!(extract( // "test.tsx", // r#"import {Box} from '@devup-ui/core' @@ -289,7 +314,7 @@ mod tests { #[serial] fn extract_style_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Box} from '@devup-ui/core' @@ -301,9 +326,9 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Box as C} from '@devup-ui/core' @@ -315,9 +340,9 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Input} from '@devup-ui/core' @@ -329,10 +354,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Button} from '@devup-ui/core' @@ -344,10 +369,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Flex} from '@devup-ui/core' @@ -359,10 +384,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Flex} from '@devup-ui/core' @@ -374,14 +399,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_style_props_with_class_name() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box as C} from '@devup-ui/core' @@ -393,10 +418,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box as C} from '@devup-ui/core' @@ -408,10 +433,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box as C} from '@devup-ui/core' @@ -423,10 +448,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box as C} from '@devup-ui/core' @@ -438,9 +463,9 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box as C} from '@devup-ui/core' @@ -452,10 +477,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Image} from '@devup-ui/core' @@ -473,14 +498,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_class_name_from_component() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {VStack as C} from '@devup-ui/core' @@ -492,13 +517,13 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_responsive_style_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -510,8 +535,8 @@ mod tests { } ) .unwrap() - ); - assert_debug_snapshot!( + )); + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Flex } from "@devup-ui/core"; @@ -523,14 +548,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_dynamic_style_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -542,10 +567,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -557,10 +582,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -572,10 +597,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -587,14 +612,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_dynamic_style_props_with_type() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -606,10 +631,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -621,10 +646,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -636,14 +661,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_dynamic_responsive_style_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -655,14 +680,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_compound_responsive_style_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -674,14 +699,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_wrong_responsive_style_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -693,14 +718,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_variable_style_props_with_style() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -712,10 +737,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -727,14 +752,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_conditional_style_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -746,10 +771,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -761,10 +786,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -776,10 +801,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -791,10 +816,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -806,10 +831,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -821,10 +846,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -836,10 +861,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -851,14 +876,29 @@ mod tests { } ) .unwrap() - ); + )); + + reset_class_map(); + assert_debug_snapshot!(ToBTreeSet::from( + extract( + "test.tsx", + r#"import { Box } from "@devup-ui/core"; +; +"#, + ExtractOption { + package: "@devup-ui/core".to_string(), + css_file: None + } + ) + .unwrap() + )); } #[test] #[serial] fn extract_responsive_conditional_style_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -870,25 +910,25 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; - ; - "#, +; +"#, ExtractOption { package: "@devup-ui/core".to_string(), css_file: None } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -900,10 +940,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -915,10 +955,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -930,10 +970,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -945,9 +985,9 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -959,10 +999,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -974,14 +1014,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_logical_case() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -993,10 +1033,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -1008,10 +1048,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -1023,10 +1063,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -1038,13 +1078,13 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_responsive_conditional_style_props_with_class_name() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -1056,10 +1096,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { Box } from "@devup-ui/core"; @@ -1071,14 +1111,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_selector() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Box} from '@devup-ui/core' @@ -1092,14 +1132,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_conditional_selector() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Box} from '@devup-ui/core' @@ -1113,10 +1153,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Box} from '@devup-ui/core' @@ -1130,10 +1170,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Box} from '@devup-ui/core' @@ -1145,10 +1185,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Box} from '@devup-ui/core' @@ -1163,14 +1203,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_selector_with_responsive() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Box} from '@devup-ui/core' @@ -1184,10 +1224,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r"import {Box} from '@devup-ui/core' @@ -1203,14 +1243,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_static_css_class_name_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { css } from "@devup-ui/core"; @@ -1224,10 +1264,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { css as c } from "@devup-ui/core"; @@ -1241,10 +1281,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { css } from "@devup-ui/core"; @@ -1259,10 +1299,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { css as c } from "@devup-ui/core"; @@ -1276,10 +1316,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { css } from "@devup-ui/core"; @@ -1296,10 +1336,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { css } from "@devup-ui/core"; @@ -1311,10 +1351,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { css } from "@devup-ui/core"; @@ -1326,10 +1366,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import { css } from "@devup-ui/core"; @@ -1341,14 +1381,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn extract_static_css_with_theme() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box} from '@devup-ui/core' @@ -1360,10 +1400,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box} from '@devup-ui/core' @@ -1375,10 +1415,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Box} from '@devup-ui/core' @@ -1390,14 +1430,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn apply_typography() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Text} from '@devup-ui/core' @@ -1409,10 +1449,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Text} from '@devup-ui/core' @@ -1424,10 +1464,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Text} from '@devup-ui/core' @@ -1439,13 +1479,13 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn apply_var_typography() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Text} from '@devup-ui/core' @@ -1457,10 +1497,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Text} from '@devup-ui/core' @@ -1472,10 +1512,10 @@ mod tests { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {Text} from '@devup-ui/core' @@ -1487,7 +1527,7 @@ mod tests { } ) .unwrap() - ); + )); } #[test] @@ -1528,7 +1568,7 @@ mod tests { #[serial] fn import_wrong_component() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.tsx", r#"import {W} from '@devup-ui/core' @@ -1539,14 +1579,14 @@ mod tests { } ) .unwrap() - ); + )); } #[test] #[serial] fn support_transpile_mjs() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.mjs", r#"import { jsxs as r, jsx as e } from "react/jsx-runtime"; @@ -1577,10 +1617,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import { jsxs as r, jsx as e } from "react/jsx-runtime"; @@ -1611,14 +1651,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn support_transpile_cjs() { reset_class_map(); - assert_debug_snapshot!(extract( + assert_debug_snapshot!(ToBTreeSet::from(extract( "test.cjs", r#""use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("@devup-ui/react");function t(){return e.jsxs("div",{children:[e.jsx(r.Box,{_hover:{bg:"blue"},bg:"$text",color:"red",children:"hello"}),e.jsx(r.Text,{typography:"header",children:"typo"}),e.jsx(r.Flex,{as:"section",mt:2,children:"section"})]})}exports.Lib=t;"#, ExtractOption { @@ -1626,10 +1666,10 @@ export { css_file: None } ) - .unwrap()); + .unwrap())); reset_class_map(); - assert_debug_snapshot!(extract( + assert_debug_snapshot!(ToBTreeSet::from(extract( "test.cjs", r#""use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const {jsx:e1, jsxs:e2}=require("react/jsx-runtime"),r=require("@devup-ui/react");function t(){return e2("div",{children:[e1(r.Box,{_hover:{bg:"blue"},bg:"$text",color:"red",children:"hello"}),e1(r.Text,{typography:"header",children:"typo"}),e1(r.Flex,{as:"section",mt:2,children:"section"})]})}exports.Lib=t;"#, ExtractOption { @@ -1637,10 +1677,10 @@ export { css_file: None } ) - .unwrap()); + .unwrap())); reset_class_map(); - assert_debug_snapshot!(extract( + assert_debug_snapshot!(ToBTreeSet::from(extract( "test.js", r#""use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("@devup-ui/react");function t(){return e.jsxs("div",{children:[e.jsx(r.Box,{_hover:{bg:"blue"},bg:"$text",color:"red",children:"hello"}),e.jsx(r.Text,{typography:"header",children:"typo"}),e.jsx(r.Flex,{as:"section",mt:2,children:"section"})]})}exports.Lib=t;"#, ExtractOption { @@ -1648,14 +1688,14 @@ export { css_file: None } ) - .unwrap()); + .unwrap())); } #[test] #[serial] fn maintain_value() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1667,14 +1707,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn ternary_operator_in_selector() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1686,10 +1726,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1701,10 +1741,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1716,14 +1756,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn test_rest_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1735,14 +1775,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_wrong_direct_array_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1754,10 +1794,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1769,10 +1809,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1784,10 +1824,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1799,13 +1839,13 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn negative_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -1817,10 +1857,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -1832,10 +1872,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -1847,10 +1887,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -1862,10 +1902,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -1877,10 +1917,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -1892,10 +1932,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -1907,14 +1947,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_wrong_direct_object_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -1926,10 +1966,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1941,10 +1981,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1956,10 +1996,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1971,14 +2011,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_direct_array_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -1990,10 +2030,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2005,10 +2045,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2020,10 +2060,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2035,10 +2075,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Center} from '@devup-ui/core' @@ -2053,10 +2093,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2068,10 +2108,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2083,14 +2123,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_direct_object_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2102,10 +2142,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2117,10 +2157,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2132,10 +2172,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2147,14 +2187,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_direct_variable_object_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2166,9 +2206,9 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2180,14 +2220,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_direct_object_responsive_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2199,10 +2239,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2214,13 +2254,13 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_direct_variable_object_responsive_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2232,14 +2272,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_direct_array_responsive_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2251,10 +2291,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2266,13 +2306,13 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_direct_variable_array_responsive_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2284,14 +2324,14 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn props_direct_hybrid_responsive_select() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2303,13 +2343,13 @@ export { } ) .unwrap() - ); + )); } #[test] #[serial] fn test_component_in_func() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Flex} from '@devup-ui/core' @@ -2326,14 +2366,14 @@ PROCESS_DATA.map(({ id, title, content }, idx) => ( } ) .unwrap() - ); + )); } #[test] #[serial] fn backtick_prop() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2345,10 +2385,10 @@ PROCESS_DATA.map(({ id, title, content }, idx) => ( } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2360,14 +2400,14 @@ PROCESS_DATA.map(({ id, title, content }, idx) => ( } ) .unwrap() - ); + )); } #[test] #[serial] fn group_selector_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2379,14 +2419,14 @@ PROCESS_DATA.map(({ id, title, content }, idx) => ( } ) .unwrap() - ); + )); } #[test] #[serial] fn test_duplicate_style_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2398,14 +2438,14 @@ PROCESS_DATA.map(({ id, title, content }, idx) => ( } ) .unwrap() - ); + )); } #[test] #[serial] fn avoid_same_name_component() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2419,14 +2459,14 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); } #[test] #[serial] fn css_props_destructuring_assignment() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {css} from '@devup-ui/core' @@ -2441,10 +2481,10 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {css} from '@devup-ui/core' @@ -2459,14 +2499,14 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); } #[test] #[serial] fn theme_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2478,14 +2518,14 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); } #[test] #[serial] fn template_literal_props() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2497,10 +2537,10 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2512,10 +2552,10 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2527,10 +2567,10 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2542,14 +2582,14 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); } #[test] #[serial] fn theme_selector() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2561,9 +2601,9 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2575,10 +2615,10 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2597,14 +2637,14 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); } #[test] #[serial] fn custom_selector() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2620,10 +2660,10 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2639,10 +2679,10 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2658,14 +2698,14 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); } #[test] #[serial] fn style_order() { reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box} from '@devup-ui/core' @@ -2681,10 +2721,10 @@ import {Button} from '@devup/ui' } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.mjs", r#"import { jsxs as r, jsx as e } from "react/jsx-runtime"; @@ -2716,10 +2756,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box, css} from '@devup-ui/core' @@ -2731,10 +2771,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box, css} from '@devup-ui/core' @@ -2746,10 +2786,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box, css} from '@devup-ui/core' @@ -2761,10 +2801,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box, css} from '@devup-ui/core' @@ -2783,10 +2823,10 @@ export { } ) .unwrap() - ); + )); reset_class_map(); - assert_debug_snapshot!( + assert_debug_snapshot!(ToBTreeSet::from( extract( "test.js", r#"import {Box, css} from '@devup-ui/core' @@ -2806,6 +2846,6 @@ export { } ) .unwrap() - ); + )); } } diff --git a/libs/extractor/src/snapshots/extractor__tests__apply_typography-2.snap b/libs/extractor/src/snapshots/extractor__tests__apply_typography-2.snap index 84bffb23..96205e24 100644 --- a/libs/extractor/src/snapshots/extractor__tests__apply_typography-2.snap +++ b/libs/extractor/src/snapshots/extractor__tests__apply_typography-2.snap @@ -1,12 +1,12 @@ --- source: libs/extractor/src/lib.rs -expression: "extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap()" +expression: "ToBTreeSet::from(extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap())" --- -ExtractOutput { - styles: [ +ToBTreeSet { + styles: { Typography( "bold", ), - ], + }, code: "import \"@devup-ui/core/devup-ui.css\";\n;\n", } diff --git a/libs/extractor/src/snapshots/extractor__tests__apply_typography-3.snap b/libs/extractor/src/snapshots/extractor__tests__apply_typography-3.snap index f3f6128f..d91897e2 100644 --- a/libs/extractor/src/snapshots/extractor__tests__apply_typography-3.snap +++ b/libs/extractor/src/snapshots/extractor__tests__apply_typography-3.snap @@ -1,15 +1,15 @@ --- source: libs/extractor/src/lib.rs -expression: "extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap()" +expression: "ToBTreeSet::from(extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap())" --- -ExtractOutput { - styles: [ +ToBTreeSet { + styles: { Typography( "bold", ), Typography( "bold2", ), - ], + }, code: "import \"@devup-ui/core/devup-ui.css\";\n;\n", } diff --git a/libs/extractor/src/snapshots/extractor__tests__apply_typography.snap b/libs/extractor/src/snapshots/extractor__tests__apply_typography.snap index aae74d9d..70a43587 100644 --- a/libs/extractor/src/snapshots/extractor__tests__apply_typography.snap +++ b/libs/extractor/src/snapshots/extractor__tests__apply_typography.snap @@ -1,12 +1,12 @@ --- source: libs/extractor/src/lib.rs -expression: "extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap()" +expression: "ToBTreeSet::from(extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap())" --- -ExtractOutput { - styles: [ +ToBTreeSet { + styles: { Typography( "bold", ), - ], + }, code: "import \"@devup-ui/core/devup-ui.css\";\n;\n", } diff --git a/libs/extractor/src/snapshots/extractor__tests__apply_var_typography-2.snap b/libs/extractor/src/snapshots/extractor__tests__apply_var_typography-2.snap index 32088fdd..15555283 100644 --- a/libs/extractor/src/snapshots/extractor__tests__apply_var_typography-2.snap +++ b/libs/extractor/src/snapshots/extractor__tests__apply_var_typography-2.snap @@ -1,8 +1,8 @@ --- source: libs/extractor/src/lib.rs -expression: "extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap()" +expression: "ToBTreeSet::from(extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap())" --- -ExtractOutput { - styles: [], +ToBTreeSet { + styles: {}, code: ";\n", } diff --git a/libs/extractor/src/snapshots/extractor__tests__apply_var_typography-3.snap b/libs/extractor/src/snapshots/extractor__tests__apply_var_typography-3.snap index b71a0e7b..2edef42f 100644 --- a/libs/extractor/src/snapshots/extractor__tests__apply_var_typography-3.snap +++ b/libs/extractor/src/snapshots/extractor__tests__apply_var_typography-3.snap @@ -1,8 +1,8 @@ --- source: libs/extractor/src/lib.rs -expression: "extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap()" +expression: "ToBTreeSet::from(extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap())" --- -ExtractOutput { - styles: [], +ToBTreeSet { + styles: {}, code: ";\n", } diff --git a/libs/extractor/src/snapshots/extractor__tests__apply_var_typography.snap b/libs/extractor/src/snapshots/extractor__tests__apply_var_typography.snap index 9a7e9ae5..4040f940 100644 --- a/libs/extractor/src/snapshots/extractor__tests__apply_var_typography.snap +++ b/libs/extractor/src/snapshots/extractor__tests__apply_var_typography.snap @@ -1,8 +1,8 @@ --- source: libs/extractor/src/lib.rs -expression: "extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap()" +expression: "ToBTreeSet::from(extract(\"test.tsx\",\nr#\"import {Text} from '@devup-ui/core'\n \n \"#,\nExtractOption\n{ package: \"@devup-ui/core\".to_string(), css_file: None }).unwrap())" --- -ExtractOutput { - styles: [], +ToBTreeSet { + styles: {}, code: ";\n", } diff --git a/libs/extractor/src/snapshots/extractor__tests__avoid_same_name_component.snap b/libs/extractor/src/snapshots/extractor__tests__avoid_same_name_component.snap index f86815af..772c8d8d 100644 --- a/libs/extractor/src/snapshots/extractor__tests__avoid_same_name_component.snap +++ b/libs/extractor/src/snapshots/extractor__tests__avoid_same_name_component.snap @@ -1,9 +1,9 @@ --- source: libs/extractor/src/lib.rs -expression: "extract(\"test.js\",\nr#\"import {Box} from '@devup-ui/core'\nimport {Button} from '@devup/ui'\n ;\n ;