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 Oxide PreProcessors 6 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  d582d036_1e4d_2e3c_fe36_57bcae0edff3["vue.rs"]
  4145446b_22d1_6636_6c03_27acc869c17b["super::Vue"]
  d582d036_1e4d_2e3c_fe36_57bcae0edff3 --> 4145446b_22d1_6636_6c03_27acc869c17b
  ed5b6564_5e78_f7bf_cdc6_b0150d9116c1["crate::extractor::pre_processors::pre_processor::PreProcessor"]
  d582d036_1e4d_2e3c_fe36_57bcae0edff3 --> ed5b6564_5e78_f7bf_cdc6_b0150d9116c1
  31c3994f_a10b_9230_4730_a596a4e7c40d["crate::scanner::pre_process_input"]
  d582d036_1e4d_2e3c_fe36_57bcae0edff3 --> 31c3994f_a10b_9230_4730_a596a4e7c40d
  092d26da_8f74_08d1_48f1_765b79ca447c["bstr::ByteSlice"]
  d582d036_1e4d_2e3c_fe36_57bcae0edff3 --> 092d26da_8f74_08d1_48f1_765b79ca447c
  ec1e34be_05ab_251b_2f3c_178a0f3d1078["regex::Regex"]
  d582d036_1e4d_2e3c_fe36_57bcae0edff3 --> ec1e34be_05ab_251b_2f3c_178a0f3d1078
  6d15903a_0cf5_e00c_800c_2bb2605c4081["std::sync"]
  d582d036_1e4d_2e3c_fe36_57bcae0edff3 --> 6d15903a_0cf5_e00c_800c_2bb2605c4081
  style d582d036_1e4d_2e3c_fe36_57bcae0edff3 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 Oxide 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: Oxide, 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