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 06f0538c_a174_ca7e_0254_932670828484["glob.rs"] 9472abba_1c91_8c45_fc9b_8e4873007cc6["super::optimize_patterns"] 06f0538c_a174_ca7e_0254_932670828484 --> 9472abba_1c91_8c45_fc9b_8e4873007cc6 cd8ad636_0546_92c3_8277_112b4ac61619["fxhash::"] 06f0538c_a174_ca7e_0254_932670828484 --> cd8ad636_0546_92c3_8277_112b4ac61619 c6eac707_86ad_10ab_6a43_c1f9e507b976["std::path::PathBuf"] 06f0538c_a174_ca7e_0254_932670828484 --> c6eac707_86ad_10ab_6a43_c1f9e507b976 72491f6e_acc6_6a04_dbc6_dfe6c5d1bc3d["tracing::event"] 06f0538c_a174_ca7e_0254_932670828484 --> 72491f6e_acc6_6a04_dbc6_dfe6c5d1bc3d b921cd27_b8e3_5c45_8149_e1c73da861da["crate::GlobEntry"] 06f0538c_a174_ca7e_0254_932670828484 --> b921cd27_b8e3_5c45_8149_e1c73da861da a58c1f8f_1153_a4f2_373d_04079a33cfff["bexpand::Expression"] 06f0538c_a174_ca7e_0254_932670828484 --> a58c1f8f_1153_a4f2_373d_04079a33cfff 433675ca_8d0e_feff_42a5_b3f666878cca["pretty_assertions::assert_eq"] 06f0538c_a174_ca7e_0254_932670828484 --> 433675ca_8d0e_feff_42a5_b3f666878cca 34254263_a5e0_5a5d_8ccc_817bc3537318["std::process::Command"] 06f0538c_a174_ca7e_0254_932670828484 --> 34254263_a5e0_5a5d_8ccc_817bc3537318 cf006a3e_51d2_5361_1dd4_6d904d0bfa75["std::"] 06f0538c_a174_ca7e_0254_932670828484 --> cf006a3e_51d2_5361_1dd4_6d904d0bfa75 c8fb0798_4aec_2943_d60e_89601383787e["tempfile::tempdir"] 06f0538c_a174_ca7e_0254_932670828484 --> c8fb0798_4aec_2943_d60e_89601383787e style 06f0538c_a174_ca7e_0254_932670828484 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 Oxide domain, PreProcessors 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: Oxide, subdomain: PreProcessors, directory: crates/oxide/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free