glob.rs — tailwindcss Source File
Architecture documentation for glob.rs, a rust file in the tailwindcss codebase. 10 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR d6210432_49e5_7bfc_e9c4_6cebc740bb16["glob.rs"] fbc549af_3f0f_2fac_e6b5_7b8ad62072f7["super::optimize_patterns"] d6210432_49e5_7bfc_e9c4_6cebc740bb16 --> fbc549af_3f0f_2fac_e6b5_7b8ad62072f7 4d8e7a76_c287_2c3b_016b_c36be3fc5770["fxhash::"] d6210432_49e5_7bfc_e9c4_6cebc740bb16 --> 4d8e7a76_c287_2c3b_016b_c36be3fc5770 e3823f68_828a_494b_6398_2fca0b2dd428["std::path::PathBuf"] d6210432_49e5_7bfc_e9c4_6cebc740bb16 --> e3823f68_828a_494b_6398_2fca0b2dd428 7ec2d1f2_b773_89ef_a7f8_3f0632393388["tracing::event"] d6210432_49e5_7bfc_e9c4_6cebc740bb16 --> 7ec2d1f2_b773_89ef_a7f8_3f0632393388 c745f568_cba4_79a2_f483_6b15a85dac8f["crate::GlobEntry"] d6210432_49e5_7bfc_e9c4_6cebc740bb16 --> c745f568_cba4_79a2_f483_6b15a85dac8f 3f085be8_cbeb_5707_72ff_04814fbc8d18["bexpand::Expression"] d6210432_49e5_7bfc_e9c4_6cebc740bb16 --> 3f085be8_cbeb_5707_72ff_04814fbc8d18 e4088d34_b5b4_ec51_b975_557a1536ec76["pretty_assertions::assert_eq"] d6210432_49e5_7bfc_e9c4_6cebc740bb16 --> e4088d34_b5b4_ec51_b975_557a1536ec76 76dc7686_9dd0_00d4_6906_94568c3839d6["std::process::Command"] d6210432_49e5_7bfc_e9c4_6cebc740bb16 --> 76dc7686_9dd0_00d4_6906_94568c3839d6 148a0379_62c6_86e3_d9b3_de1fdebd7cfb["std::"] d6210432_49e5_7bfc_e9c4_6cebc740bb16 --> 148a0379_62c6_86e3_d9b3_de1fdebd7cfb f1bca424_c5f6_2d09_b590_d1407e7cbc6f["tempfile::tempdir"] d6210432_49e5_7bfc_e9c4_6cebc740bb16 --> f1bca424_c5f6_2d09_b590_d1407e7cbc6f style d6210432_49e5_7bfc_e9c4_6cebc740bb16 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
use fxhash::{FxHashMap, FxHashSet};
use std::path::PathBuf;
use tracing::event;
#[derive(Debug, Clone, PartialEq)]
pub struct GlobEntry {
/// Base path of the glob
pub base: String,
/// Glob pattern
pub pattern: String,
}
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(),
// ... (542 more lines)
Domain
Subdomains
Functions
- create_folders()
- hoist_static_glob_parts()
- it_should_branch_expandable_folders()
- it_should_expand_a_complex_example()
- it_should_expand_multiple_expansions_in_the_same_folder()
- it_should_keep_globs_that_start_with_file_wildcards_as_is()
- it_should_keep_globs_that_start_with_folder_wildcards_as_is()
- it_should_keep_the_negation_symbol_for_all_new_patterns()
- it_should_move_the_starting_folder_to_the_path()
- it_should_move_the_starting_folders_to_the_path()
- it_should_stop_expanding_once_we_hit_a_wildcard()
- multiple_expansions_per_folder_starting_at_the_root()
- optimize_patterns()
- split_pattern()
- test()
Dependencies
- bexpand::Expression
- crate::GlobEntry
- fxhash::
- pretty_assertions::assert_eq
- std::
- std::path::PathBuf
- std::process::Command
- super::optimize_patterns
- tempfile::tempdir
- tracing::event
Source
Frequently Asked Questions
What does glob.rs do?
glob.rs is a source file in the tailwindcss codebase, written in rust. It belongs to the OxideEngine domain, Scanner subdomain.
What functions are defined in glob.rs?
glob.rs defines 15 function(s): create_folders, hoist_static_glob_parts, it_should_branch_expandable_folders, it_should_expand_a_complex_example, it_should_expand_multiple_expansions_in_the_same_folder, it_should_keep_globs_that_start_with_file_wildcards_as_is, it_should_keep_globs_that_start_with_folder_wildcards_as_is, it_should_keep_the_negation_symbol_for_all_new_patterns, it_should_move_the_starting_folder_to_the_path, it_should_move_the_starting_folders_to_the_path, and 5 more.
What does glob.rs depend on?
glob.rs imports 10 module(s): bexpand::Expression, crate::GlobEntry, fxhash::, pretty_assertions::assert_eq, std::, std::path::PathBuf, std::process::Command, super::optimize_patterns, and 2 more.
Where is glob.rs in the architecture?
glob.rs is located at crates/oxide/src/glob.rs (domain: OxideEngine, subdomain: Scanner, directory: crates/oxide/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free