Home / Function/ hoist_static_glob_parts() — tailwindcss Function Reference

hoist_static_glob_parts() — tailwindcss Function Reference

Architecture documentation for the hoist_static_glob_parts() function in glob.rs from the tailwindcss codebase.

Function rust OxideEngine Scanner calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  5cbcc657_1c9c_94fa_f9bc_7a654ab63a89["hoist_static_glob_parts()"]
  d6210432_49e5_7bfc_e9c4_6cebc740bb16["glob.rs"]
  5cbcc657_1c9c_94fa_f9bc_7a654ab63a89 -->|defined in| d6210432_49e5_7bfc_e9c4_6cebc740bb16
  77e32ec4_3bad_9b11_3527_863215f783cf["optimize_patterns()"]
  77e32ec4_3bad_9b11_3527_863215f783cf -->|calls| 5cbcc657_1c9c_94fa_f9bc_7a654ab63a89
  24c188fc_16f0_5618_de58_f7c31037d124["split_pattern()"]
  5cbcc657_1c9c_94fa_f9bc_7a654ab63a89 -->|calls| 24c188fc_16f0_5618_de58_f7c31037d124
  style 5cbcc657_1c9c_94fa_f9bc_7a654ab63a89 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/oxide/src/glob.rs lines 14–66

pub fn hoist_static_glob_parts(entries: &Vec<GlobEntry>, emit_parent_glob: bool) -> Vec<GlobEntry> {
    let mut result = vec![];

    for entry in entries {
        let (static_part, dynamic_part) = split_pattern(&entry.pattern);

        let base: PathBuf = entry.base.clone().into();
        let base = match static_part {
            Some(static_part) => base.join(static_part),
            None => base,
        };

        let base = match dunce::canonicalize(&base) {
            Ok(base) => base,
            Err(err) => {
                event!(tracing::Level::ERROR, "Failed to resolve glob: {:?}", err);
                // If we can't resolve the new base on disk, let's just skip this entry.
                continue;
            }
        };

        let pattern = match dynamic_part {
            Some(dynamic_part) => dynamic_part,
            None => {
                if base.is_dir() {
                    "**/*".to_owned()
                } else {
                    "".to_owned()
                }
            }
        };

        // If the base path is a file, then we want to move the file to the pattern, and point the
        // directory to the base. This is necessary for file watchers that can only listen to
        // folders.
        if emit_parent_glob && pattern.is_empty() && base.is_file() {
            result.push(GlobEntry {
                // SAFETY: `parent()` will be available because we verify `base` is a file, thus a
                // parent folder exists.
                base: base.parent().unwrap().to_string_lossy().to_string(),
                // SAFETY: `file_name()` will be available because we verify `base` is a file.
                pattern: base.file_name().unwrap().to_string_lossy().to_string(),
            });
        }

        result.push(GlobEntry {
            base: base.to_string_lossy().to_string(),
            pattern,
        });
    }

    result
}

Domain

Subdomains

Frequently Asked Questions

What does hoist_static_glob_parts() do?
hoist_static_glob_parts() is a function in the tailwindcss codebase, defined in crates/oxide/src/glob.rs.
Where is hoist_static_glob_parts() defined?
hoist_static_glob_parts() is defined in crates/oxide/src/glob.rs at line 14.
What does hoist_static_glob_parts() call?
hoist_static_glob_parts() calls 1 function(s): split_pattern.
What calls hoist_static_glob_parts()?
hoist_static_glob_parts() is called by 1 function(s): optimize_patterns.

Analyze Your Own Codebase

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

Try Supermodel Free