klenod-plugin-css 0.0.32 → 0.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/native/Cargo.lock +7 -6
- data/ext/native/Cargo.toml +2 -1
- data/ext/native/src/lib.rs +65 -33
- data/lib/klenod/plugin/css/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7b13de3963f22c51b7e0120f155bc389ef1cf1e8082458a91abeb2b7e2c82e9d
|
|
4
|
+
data.tar.gz: 9676ca08656ab9dc39a9f5d141a81dea3f56d14d970575c81ab00144e343606e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0a5b302cf09d805adb6ab2b4ad00a57807d910c1c12b51ecdc928dfbb86881d673514d940d8e33437ccb7549d1728adec007002064c44425d0558eab86a55bab
|
|
7
|
+
data.tar.gz: c7a69fe8402e101ca5ef3ac2fd0477cf2e1dc49b38629ddf4e3864d31af4c854e09d4fea31a0260ec8079d1a4cfab0118055ca19d8ed5acc336be140488d4a21
|
data/ext/native/Cargo.lock
CHANGED
|
@@ -556,9 +556,9 @@ checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
|
|
|
556
556
|
|
|
557
557
|
[[package]]
|
|
558
558
|
name = "magnus"
|
|
559
|
-
version = "0.9.
|
|
559
|
+
version = "0.9.3"
|
|
560
560
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
561
|
-
checksum = "
|
|
561
|
+
checksum = "40ef424404d166cbb71c8b8d19c9c589c748c4547c1afa1928c5504299f6c713"
|
|
562
562
|
dependencies = [
|
|
563
563
|
"magnus-macros",
|
|
564
564
|
"rb-sys",
|
|
@@ -603,6 +603,7 @@ dependencies = [
|
|
|
603
603
|
"cssparser 0.38.0",
|
|
604
604
|
"lightningcss",
|
|
605
605
|
"magnus",
|
|
606
|
+
"parcel_selectors",
|
|
606
607
|
"parcel_sourcemap",
|
|
607
608
|
"serde_json",
|
|
608
609
|
"sha2",
|
|
@@ -1085,9 +1086,9 @@ dependencies = [
|
|
|
1085
1086
|
|
|
1086
1087
|
[[package]]
|
|
1087
1088
|
name = "serde_json"
|
|
1088
|
-
version = "1.0.
|
|
1089
|
+
version = "1.0.154"
|
|
1089
1090
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1090
|
-
checksum = "
|
|
1091
|
+
checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
|
|
1091
1092
|
dependencies = [
|
|
1092
1093
|
"itoa",
|
|
1093
1094
|
"memchr",
|
|
@@ -1098,9 +1099,9 @@ dependencies = [
|
|
|
1098
1099
|
|
|
1099
1100
|
[[package]]
|
|
1100
1101
|
name = "sha2"
|
|
1101
|
-
version = "0.11.
|
|
1102
|
+
version = "0.11.1"
|
|
1102
1103
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1103
|
-
checksum = "
|
|
1104
|
+
checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19"
|
|
1104
1105
|
dependencies = [
|
|
1105
1106
|
"cfg-if",
|
|
1106
1107
|
"cpufeatures",
|
data/ext/native/Cargo.toml
CHANGED
|
@@ -10,8 +10,9 @@ crate-type = ["cdylib"]
|
|
|
10
10
|
[dependencies]
|
|
11
11
|
base64 = "0.23.1"
|
|
12
12
|
cssparser = "0.38.0"
|
|
13
|
-
lightningcss = { version = "1.0.0-alpha.
|
|
13
|
+
lightningcss = { version = "1.0.0-alpha.72", features = ["serde", "visitor", "sourcemap"] }
|
|
14
14
|
magnus = "0.9.1"
|
|
15
|
+
parcel_selectors = "0.28.3"
|
|
15
16
|
parcel_sourcemap = { version = "2.1.1", features = ["json"] }
|
|
16
17
|
serde_json = "1.0.149"
|
|
17
18
|
sha2 = "0.11.0"
|
data/ext/native/src/lib.rs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
use lightningcss::dependencies::DependencyOptions;
|
|
2
2
|
use lightningcss::{
|
|
3
3
|
properties::{css_modules::Specifier, custom::Variable},
|
|
4
|
-
selector::{Component, Selector},
|
|
4
|
+
selector::{Component, PseudoClass, Selector},
|
|
5
5
|
stylesheet::{MinifyOptions, ParserOptions, PrinterOptions, StyleSheet},
|
|
6
6
|
values::ident::DashedIdent,
|
|
7
7
|
visitor::{Visit, VisitTypes, Visitor},
|
|
@@ -10,6 +10,7 @@ use magnus::{
|
|
|
10
10
|
exception::ExceptionClass, function, gc::register_mark_object, prelude::*, value::Lazy, Error,
|
|
11
11
|
RHash, RModule, Ruby, TryConvert,
|
|
12
12
|
};
|
|
13
|
+
use parcel_selectors::parser::NthOfSelectorData;
|
|
13
14
|
use parcel_sourcemap::SourceMap;
|
|
14
15
|
use std::{collections::HashMap, convert::Infallible};
|
|
15
16
|
|
|
@@ -56,38 +57,7 @@ impl<'a, 'i> Visitor<'i> for TransformNamesVisitor<'a> {
|
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
fn visit_selector(&mut self, selector: &mut Selector<'i>) -> Result<(), Self::Error> {
|
|
59
|
-
|
|
60
|
-
match component {
|
|
61
|
-
Component::Class(class_name) => {
|
|
62
|
-
let original = class_name.to_string();
|
|
63
|
-
let formatted = format_selector(
|
|
64
|
-
&self.options.class_pattern,
|
|
65
|
-
&self.options.component,
|
|
66
|
-
&original,
|
|
67
|
-
&self.options.hash,
|
|
68
|
-
);
|
|
69
|
-
self.classes.insert(original, formatted.clone());
|
|
70
|
-
if self.options.transform_names {
|
|
71
|
-
*component = Component::Class(formatted.into());
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
Component::LocalName(local_name) => {
|
|
75
|
-
let original = local_name.name.to_string();
|
|
76
|
-
let formatted = format_selector(
|
|
77
|
-
&self.options.tag_pattern,
|
|
78
|
-
&self.options.component,
|
|
79
|
-
&original,
|
|
80
|
-
&self.options.hash,
|
|
81
|
-
);
|
|
82
|
-
self.elements.insert(original, formatted.clone());
|
|
83
|
-
if self.options.transform_names {
|
|
84
|
-
*component = Component::Class(formatted.into());
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
_ => {}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
60
|
+
self.transform_selector(selector);
|
|
91
61
|
Ok(())
|
|
92
62
|
}
|
|
93
63
|
|
|
@@ -125,6 +95,68 @@ impl<'a, 'i> Visitor<'i> for TransformNamesVisitor<'a> {
|
|
|
125
95
|
}
|
|
126
96
|
}
|
|
127
97
|
|
|
98
|
+
impl<'a> TransformNamesVisitor<'a> {
|
|
99
|
+
// Nested selector lists such as `:is(h1, .title)` and `:not(.kicker)` are
|
|
100
|
+
// scoped like the outer selector. `:global(...)` stays unscoped, and
|
|
101
|
+
// `::cue(...)` is left alone because it matches WebVTT cue classes rather
|
|
102
|
+
// than document classes.
|
|
103
|
+
fn transform_selector<'i>(&mut self, selector: &mut Selector<'i>) {
|
|
104
|
+
for component in selector.iter_mut_raw_match_order() {
|
|
105
|
+
match component {
|
|
106
|
+
Component::Negation(selectors)
|
|
107
|
+
| Component::Is(selectors)
|
|
108
|
+
| Component::Where(selectors)
|
|
109
|
+
| Component::Has(selectors)
|
|
110
|
+
| Component::Any(_, selectors) => {
|
|
111
|
+
for nested in selectors.iter_mut() {
|
|
112
|
+
self.transform_selector(nested);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
Component::Slotted(nested) | Component::Host(Some(nested)) => {
|
|
116
|
+
self.transform_selector(nested);
|
|
117
|
+
}
|
|
118
|
+
Component::NthOf(data) => {
|
|
119
|
+
let mut selectors = data.clone_selectors();
|
|
120
|
+
for nested in selectors.iter_mut() {
|
|
121
|
+
self.transform_selector(nested);
|
|
122
|
+
}
|
|
123
|
+
*data = NthOfSelectorData::new(*data.nth_data(), selectors);
|
|
124
|
+
}
|
|
125
|
+
Component::NonTSPseudoClass(PseudoClass::Local { selector: nested }) => {
|
|
126
|
+
self.transform_selector(nested);
|
|
127
|
+
}
|
|
128
|
+
Component::Class(class_name) => {
|
|
129
|
+
let original = class_name.to_string();
|
|
130
|
+
let formatted = format_selector(
|
|
131
|
+
&self.options.class_pattern,
|
|
132
|
+
&self.options.component,
|
|
133
|
+
&original,
|
|
134
|
+
&self.options.hash,
|
|
135
|
+
);
|
|
136
|
+
self.classes.insert(original, formatted.clone());
|
|
137
|
+
if self.options.transform_names {
|
|
138
|
+
*component = Component::Class(formatted.into());
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
Component::LocalName(local_name) => {
|
|
142
|
+
let original = local_name.name.to_string();
|
|
143
|
+
let formatted = format_selector(
|
|
144
|
+
&self.options.tag_pattern,
|
|
145
|
+
&self.options.component,
|
|
146
|
+
&original,
|
|
147
|
+
&self.options.hash,
|
|
148
|
+
);
|
|
149
|
+
self.elements.insert(original, formatted.clone());
|
|
150
|
+
if self.options.transform_names {
|
|
151
|
+
*component = Component::Class(formatted.into());
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
_ => {}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
128
160
|
fn transform_native(
|
|
129
161
|
ruby: &Ruby,
|
|
130
162
|
source: String,
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: klenod-plugin-css
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.33
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrés Alin
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.0.
|
|
18
|
+
version: 0.0.33
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.0.
|
|
25
|
+
version: 0.0.33
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: rb_sys
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|