ensure generated hash is safe

This commit is contained in:
Yiffy Dev 2024-10-30 16:41:45 +05:00
commit 097ef122e7
No known key found for this signature in database
GPG key ID: FB83DFEAFB3F4709
3 changed files with 5 additions and 5 deletions

View file

@ -5,7 +5,7 @@ styly!(pub const bundlemod {
.someth { .someth {
@include tokens.clickable; @include tokens.clickable;
background-color: black; background-color: black;
&-dark { &__dark {
background-color: white; background-color: white;
} }
} }
@ -16,6 +16,6 @@ styly!(pub const filemod:sass "src/main.sass");
fn main(){ fn main(){
println!("someth class codemod styles: {}", bundlemod::someth); println!("someth class codemod styles: {}", bundlemod::someth);
println!("someth class filemod styles: {}", filemod::someth); println!("someth class filemod styles: {}", filemod::someth);
println!("someth-dark selector will be: {}", bundlemod::_dark(bundlemod::someth)); //println!("someth-dark selector will be: {}", bundlemod::_dark(bundlemod::someth));
println!("Thats how we used the styles! Good luck!!"); println!("Thats how we used the styles! Good luck!!");
} }

View file

@ -2,7 +2,7 @@ use base64::Engine;
use crate::config::SabryHashConfig; use crate::config::SabryHashConfig;
use super::ArbitraryScope; use super::{apply_basic_rusty_member_gen_rules, ArbitraryScope};
/// Convenience wrapper for String-being-a-hash /// Convenience wrapper for String-being-a-hash
#[derive(Debug, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
@ -50,6 +50,7 @@ impl ScopeHash {
//? This isn't right. "size" is size of hash in symbols. //? This isn't right. "size" is size of hash in symbols.
// naaah, its fine :D (Dan) // naaah, its fine :D (Dan)
let hash = base64::prelude::BASE64_URL_SAFE_NO_PAD.encode(&hash[..size]); let hash = base64::prelude::BASE64_URL_SAFE_NO_PAD.encode(&hash[..size]);
let hash = apply_basic_rusty_member_gen_rules(&hash);
Self(hash) Self(hash)
} }

View file

@ -85,8 +85,7 @@ pub fn styly_macro_impl(input: TokenStream) -> TokenStream {
let interp = s let interp = s
.as_sass_interpolated() .as_sass_interpolated()
.and_then(|i| i.elements.first()) .and_then(|i| i.elements.first())
.and_then(|e| e.as_static()) .and_then(|e| e.as_static().map(|s| s.raw.to_string()));
.and_then(|s| Some(s.raw.to_string()));
interp interp
}) })