Home / Function/ create_walker() — tailwindcss Function Reference

create_walker() — tailwindcss Function Reference

Architecture documentation for the create_walker() function in mod.rs from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  661ecb16_7e26_4565_42ab_15fa6ee9af64["create_walker()"]
  d865d4fd_bb15_6d9a_a900_10e82a6856fb["mod.rs"]
  661ecb16_7e26_4565_42ab_15fa6ee9af64 -->|defined in| d865d4fd_bb15_6d9a_a900_10e82a6856fb
  911969ab_7e19_53fd_8262_b2a85d4506d3["new()"]
  911969ab_7e19_53fd_8262_b2a85d4506d3 -->|calls| 661ecb16_7e26_4565_42ab_15fa6ee9af64
  style 661ecb16_7e26_4565_42ab_15fa6ee9af64 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/oxide/src/scanner/mod.rs lines 571–792

fn create_walker(sources: Sources) -> Option<WalkBuilder> {
    let mtimes: Arc<Mutex<FxHashMap<PathBuf, SystemTime>>> = Default::default();
    let mut other_roots: FxHashSet<&PathBuf> = FxHashSet::default();
    let mut first_root: Option<&PathBuf> = None;
    let mut ignores: BTreeMap<&PathBuf, BTreeSet<String>> = Default::default();

    for source in sources.iter() {
        match source {
            SourceEntry::Auto { base } => {
                if first_root.is_none() {
                    first_root = Some(base);
                } else {
                    other_roots.insert(base);
                }
            }
            SourceEntry::Pattern { base, pattern } => {
                let mut pattern = pattern.to_string();

                if first_root.is_none() {
                    first_root = Some(base);
                } else {
                    other_roots.insert(base);
                }

                if !pattern.contains("**") {
                    // Ensure that the pattern is pinned to the base path.
                    if !pattern.starts_with("/") {
                        pattern = format!("/{pattern}");
                    }

                    // Specific patterns should take precedence even over git-ignored files:
                    ignores
                        .entry(base)
                        .or_default()
                        .insert(format!("!{}", pattern));
                } else {
                    // Assumption: the pattern we receive will already be brace expanded. So
                    // `*.{html,jsx}` will result in two separate patterns: `*.html` and `*.jsx`.
                    if let Some(extension) = Path::new(&pattern).extension() {
                        // Extend auto source detection to include the extension
                        ignores
                            .entry(base)
                            .or_default()
                            .insert(format!("!*.{}", extension.to_string_lossy()));
                    }
                }
            }
            SourceEntry::Ignored { base, pattern } => {
                let mut pattern = pattern.to_string();
                // Ensure that the pattern is pinned to the base path.
                if !pattern.starts_with("/") {
                    pattern = format!("/{pattern}");
                }
                ignores.entry(base).or_default().insert(pattern);
            }
            SourceEntry::External { base } => {
                if first_root.is_none() {
                    first_root = Some(base);
                } else {
                    other_roots.insert(base);
                }

                // External sources should take precedence even over git-ignored files:
                ignores
                    .entry(base)
                    .or_default()
                    .insert(format!("!{}", "/**/*"));

                // External sources should still disallow binary extensions:
                ignores
                    .entry(base)
                    .or_default()
                    .insert(BINARY_EXTENSIONS_GLOB.clone());
            }
        }
    }

    let mut builder = WalkBuilder::new(first_root?);

    // We have to follow symlinks
    builder.follow_links(true);

Domain

Subdomains

Called By

Frequently Asked Questions

What does create_walker() do?
create_walker() is a function in the tailwindcss codebase, defined in crates/oxide/src/scanner/mod.rs.
Where is create_walker() defined?
create_walker() is defined in crates/oxide/src/scanner/mod.rs at line 571.
What calls create_walker()?
create_walker() is called by 1 function(s): new.

Analyze Your Own Codebase

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

Try Supermodel Free