Home / Function/ parse_excludes_file() — tailwindcss Function Reference

parse_excludes_file() — tailwindcss Function Reference

Architecture documentation for the parse_excludes_file() function in gitignore.rs from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  5f89b71b_214a_6d50_c5a8_016810afc389["parse_excludes_file()"]
  ea89f6ab_7071_247b_d90f_40bcb846cbc3["gitconfig_excludes_path()"]
  ea89f6ab_7071_247b_d90f_40bcb846cbc3 -->|calls| 5f89b71b_214a_6d50_c5a8_016810afc389
  c75d21a0_3970_6662_9b3e_166e9ee79756["parse_excludes_file1()"]
  c75d21a0_3970_6662_9b3e_166e9ee79756 -->|calls| 5f89b71b_214a_6d50_c5a8_016810afc389
  aa111346_8758_31bb_dbaa_70e07f78c91a["parse_excludes_file2()"]
  aa111346_8758_31bb_dbaa_70e07f78c91a -->|calls| 5f89b71b_214a_6d50_c5a8_016810afc389
  54d753fd_649a_46db_b75b_374c3b0d33e3["parse_excludes_file3()"]
  54d753fd_649a_46db_b75b_374c3b0d33e3 -->|calls| 5f89b71b_214a_6d50_c5a8_016810afc389
  4b723be5_8ec6_0a8d_33ab_b8434a33c822["parse_excludes_file4()"]
  4b723be5_8ec6_0a8d_33ab_b8434a33c822 -->|calls| 5f89b71b_214a_6d50_c5a8_016810afc389
  16b1a4b1_0b2b_088f_bcf1_b3fbca7b0670["parse_excludes_file5()"]
  16b1a4b1_0b2b_088f_bcf1_b3fbca7b0670 -->|calls| 5f89b71b_214a_6d50_c5a8_016810afc389
  68e416a6_57fe_bc5e_90c3_04138c3922d0["build()"]
  5f89b71b_214a_6d50_c5a8_016810afc389 -->|calls| 68e416a6_57fe_bc5e_90c3_04138c3922d0
  2aba6383_fb10_9759_134b_ef68e0030b7e["expand_tilde()"]
  5f89b71b_214a_6d50_c5a8_016810afc389 -->|calls| 2aba6383_fb10_9759_134b_ef68e0030b7e
  style 5f89b71b_214a_6d50_c5a8_016810afc389 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/ignore/src/gitignore.rs lines 648–673

fn parse_excludes_file(data: &[u8]) -> Option<PathBuf> {
    use std::sync::OnceLock;

    use regex_automata::{meta::Regex, util::syntax};

    // N.B. This is the lazy approach, and isn't technically correct, but
    // probably works in more circumstances. I guess we would ideally have
    // a full INI parser. Yuck.
    static RE: OnceLock<Regex> = OnceLock::new();
    let re = RE.get_or_init(|| {
        Regex::builder()
            .configure(Regex::config().utf8_empty(false))
            .syntax(syntax::Config::new().utf8(false))
            .build(r#"(?im-u)^\s*excludesfile\s*=\s*"?\s*(\S+?)\s*"?\s*$"#)
            .unwrap()
    });
    // We don't care about amortizing allocs here I think. This should only
    // be called ~once per traversal or so? (Although it's not guaranteed...)
    let mut caps = re.create_captures();
    re.captures(data, &mut caps);
    let span = caps.get_group(1)?;
    let candidate = &data[span];
    std::str::from_utf8(candidate)
        .ok()
        .map(|s| PathBuf::from(expand_tilde(s)))
}

Subdomains

Frequently Asked Questions

What does parse_excludes_file() do?
parse_excludes_file() is a function in the tailwindcss codebase.
What does parse_excludes_file() call?
parse_excludes_file() calls 2 function(s): build, expand_tilde.
What calls parse_excludes_file()?
parse_excludes_file() is called by 6 function(s): gitconfig_excludes_path, parse_excludes_file1, parse_excludes_file2, parse_excludes_file3, parse_excludes_file4, parse_excludes_file5.

Analyze Your Own Codebase

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

Try Supermodel Free