Home / File/ vue.rs — tailwindcss Source File

vue.rs — tailwindcss Source File

Architecture documentation for vue.rs, a rust file in the tailwindcss codebase. 6 imports, 0 dependents.

File rust OxideEngine PreProcessors 6 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  152046dd_6f96_e534_3585_b734e23a47ff["vue.rs"]
  a557de83_71c3_f8d7_bfbe_4a8af42264f0["super::Vue"]
  152046dd_6f96_e534_3585_b734e23a47ff --> a557de83_71c3_f8d7_bfbe_4a8af42264f0
  a55fec3d_3fee_4b46_48f2_43f3844c61e4["crate::extractor::pre_processors::pre_processor::PreProcessor"]
  152046dd_6f96_e534_3585_b734e23a47ff --> a55fec3d_3fee_4b46_48f2_43f3844c61e4
  77ca3446_b0bf_af88_0e9b_c56988f2aef5["crate::scanner::pre_process_input"]
  152046dd_6f96_e534_3585_b734e23a47ff --> 77ca3446_b0bf_af88_0e9b_c56988f2aef5
  e8f7ef42_4edb_c180_b1a1_7f3dcfa8e322["bstr::ByteSlice"]
  152046dd_6f96_e534_3585_b734e23a47ff --> e8f7ef42_4edb_c180_b1a1_7f3dcfa8e322
  610f804d_9b85_2215_f352_144806822d98["regex::Regex"]
  152046dd_6f96_e534_3585_b734e23a47ff --> 610f804d_9b85_2215_f352_144806822d98
  29632a2a_88f2_f99f_6979_ae26cc6fa806["std::sync"]
  152046dd_6f96_e534_3585_b734e23a47ff --> 29632a2a_88f2_f99f_6979_ae26cc6fa806
  style 152046dd_6f96_e534_3585_b734e23a47ff fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

use crate::extractor::pre_processors::pre_processor::PreProcessor;
use crate::scanner::pre_process_input;
use bstr::ByteSlice;
use regex::Regex;
use std::sync;

static TEMPLATE_REGEX: sync::LazyLock<Regex> = sync::LazyLock::new(|| {
    Regex::new(r#"<template lang=['"]([^"']*)['"]>([\s\S]*)<\/template>"#).unwrap()
});

#[derive(Debug, Default)]
pub struct Vue;

impl PreProcessor for Vue {
    fn process(&self, content: &[u8]) -> Vec<u8> {
        let mut result = content.to_vec();

        let content_as_str = std::str::from_utf8(content).unwrap();
        for (_, [lang, body]) in TEMPLATE_REGEX
            .captures_iter(content_as_str)
            .map(|c| c.extract())
        {
            let replaced = pre_process_input(body.as_bytes(), lang);
            result = result.replace(body, replaced);
        }

        result
    }
}

#[cfg(test)]
mod tests {
    use super::Vue;
    use crate::extractor::pre_processors::pre_processor::PreProcessor;

    #[test]
    fn test_vue_template_pug() {
        let input = r#"
            <template lang="pug">
            .bg-neutral-900.text-red-500 This is a test.
            </template>
        "#;

        Vue::test_extract_contains(input, vec!["bg-neutral-900", "text-red-500"]);
    }
}

Domain

Subdomains

Dependencies

  • bstr::ByteSlice
  • crate::extractor::pre_processors::pre_processor::PreProcessor
  • crate::scanner::pre_process_input
  • regex::Regex
  • std::sync
  • super::Vue

Frequently Asked Questions

What does vue.rs do?
vue.rs is a source file in the tailwindcss codebase, written in rust. It belongs to the OxideEngine domain, PreProcessors subdomain.
What functions are defined in vue.rs?
vue.rs defines 3 function(s): Regex, process, test_vue_template_pug.
What does vue.rs depend on?
vue.rs imports 6 module(s): bstr::ByteSlice, crate::extractor::pre_processors::pre_processor::PreProcessor, crate::scanner::pre_process_input, regex::Regex, std::sync, super::Vue.
Where is vue.rs in the architecture?
vue.rs is located at crates/oxide/src/extractor/pre_processors/vue.rs (domain: OxideEngine, subdomain: PreProcessors, directory: crates/oxide/src/extractor/pre_processors).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free