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.

Function rust OxideEngine Extractors calls 2 called by 6

Entity Profile

Dependency Diagram

graph TD
  a5195bbd_b9d1_1538_5d71_c8166a9e749b["parse_excludes_file()"]
  f01cb367_8778_ff95_3046_740ba8005174["gitignore.rs"]
  a5195bbd_b9d1_1538_5d71_c8166a9e749b -->|defined in| f01cb367_8778_ff95_3046_740ba8005174
  3f3be1fd_7944_6314_c2cc_836750d67496["gitconfig_excludes_path()"]
  3f3be1fd_7944_6314_c2cc_836750d67496 -->|calls| a5195bbd_b9d1_1538_5d71_c8166a9e749b
  c0c8f594_56bb_1201_b095_83700264df0f["parse_excludes_file1()"]
  c0c8f594_56bb_1201_b095_83700264df0f -->|calls| a5195bbd_b9d1_1538_5d71_c8166a9e749b
  addcd65c_cdd9_20d9_ab7e_912087c4a0ea["parse_excludes_file2()"]
  addcd65c_cdd9_20d9_ab7e_912087c4a0ea -->|calls| a5195bbd_b9d1_1538_5d71_c8166a9e749b
  e174dfcc_89b1_79b8_c294_74a2eae4fb96["parse_excludes_file3()"]
  e174dfcc_89b1_79b8_c294_74a2eae4fb96 -->|calls| a5195bbd_b9d1_1538_5d71_c8166a9e749b
  53ffab60_2c9f_9b5b_54f1_508d972f5bdf["parse_excludes_file4()"]
  53ffab60_2c9f_9b5b_54f1_508d972f5bdf -->|calls| a5195bbd_b9d1_1538_5d71_c8166a9e749b
  347eb658_35fe_2a49_3ca1_4aa1dd4df4c5["parse_excludes_file5()"]
  347eb658_35fe_2a49_3ca1_4aa1dd4df4c5 -->|calls| a5195bbd_b9d1_1538_5d71_c8166a9e749b
  990b9a1b_9baf_67bf_a387_d7f34481f9c1["build()"]
  a5195bbd_b9d1_1538_5d71_c8166a9e749b -->|calls| 990b9a1b_9baf_67bf_a387_d7f34481f9c1
  de8f1379_1afa_a792_ee42_8475cb4b9400["expand_tilde()"]
  a5195bbd_b9d1_1538_5d71_c8166a9e749b -->|calls| de8f1379_1afa_a792_ee42_8475cb4b9400
  style a5195bbd_b9d1_1538_5d71_c8166a9e749b 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)))
}

Domain

Subdomains

Frequently Asked Questions

What does parse_excludes_file() do?
parse_excludes_file() is a function in the tailwindcss codebase, defined in crates/ignore/src/gitignore.rs.
Where is parse_excludes_file() defined?
parse_excludes_file() is defined in crates/ignore/src/gitignore.rs at line 648.
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