scan_with_globs() — tailwindcss Function Reference
Architecture documentation for the scan_with_globs() function in scanner.rs from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 2c5d72c1_5cbe_ebbe_4eca_30cd90f4d096["scan_with_globs()"] 1581ed51_04e1_62c1_6e26_ea43cf82d5f9["scan()"] 1581ed51_04e1_62c1_6e26_ea43cf82d5f9 -->|calls| 2c5d72c1_5cbe_ebbe_4eca_30cd90f4d096 2a667fe0_aecc_8845_3c11_3d28117bb8bf["it_should_be_possible_to_scan_in_the_parent_directory()"] 2a667fe0_aecc_8845_3c11_3d28117bb8bf -->|calls| 2c5d72c1_5cbe_ebbe_4eca_30cd90f4d096 8608ca58_b851_c047_4da0_9f9a61f04750["it_should_scan_files_without_extensions()"] 8608ca58_b851_c047_4da0_9f9a61f04750 -->|calls| 2c5d72c1_5cbe_ebbe_4eca_30cd90f4d096 9ef93ebb_d7a3_7b4b_b3bd_c648c3131d74["it_should_scan_folders_with_extensions()"] 9ef93ebb_d7a3_7b4b_b3bd_c648c3131d74 -->|calls| 2c5d72c1_5cbe_ebbe_4eca_30cd90f4d096 afd14ffa_122e_a607_35db_58b2de7909c7["it_should_scan_content_paths()"] afd14ffa_122e_a607_35db_58b2de7909c7 -->|calls| 2c5d72c1_5cbe_ebbe_4eca_30cd90f4d096 bed75d32_cbee_15a0_0769_375377187cc4["it_should_scan_next_dynamic_folders()"] bed75d32_cbee_15a0_0769_375377187cc4 -->|calls| 2c5d72c1_5cbe_ebbe_4eca_30cd90f4d096 c8e2acb5_23e9_4691_fa13_00a0c340f1d0["it_should_scan_content_paths_even_when_they_are_git_ignored()"] c8e2acb5_23e9_4691_fa13_00a0c340f1d0 -->|calls| 2c5d72c1_5cbe_ebbe_4eca_30cd90f4d096 4e13afce_c80c_b799_a36f_5d3764e4894e["it_should_ignore_negated_custom_sources()"] 4e13afce_c80c_b799_a36f_5d3764e4894e -->|calls| 2c5d72c1_5cbe_ebbe_4eca_30cd90f4d096 2641acbe_6397_f29e_fb4d_33ad36d8d268["it_should_include_defined_extensions_that_are_ignored_by_default()"] 2641acbe_6397_f29e_fb4d_33ad36d8d268 -->|calls| 2c5d72c1_5cbe_ebbe_4eca_30cd90f4d096 b1e8c3aa_d2d6_e95d_f26f_b9e4cd5e1daf["it_should_work_with_manual_glob_only()"] b1e8c3aa_d2d6_e95d_f26f_b9e4cd5e1daf -->|calls| 2c5d72c1_5cbe_ebbe_4eca_30cd90f4d096 66d019eb_1061_aa45_5845_35021a5a383c["it_respects_gitignore_in_workspace_root()"] 66d019eb_1061_aa45_5845_35021a5a383c -->|calls| 2c5d72c1_5cbe_ebbe_4eca_30cd90f4d096 340f5875_20ae_8efc_16a9_8a446b1ff6ab["it_includes_skipped_by_default_extensions_with_a_specific_source()"] 340f5875_20ae_8efc_16a9_8a446b1ff6ab -->|calls| 2c5d72c1_5cbe_ebbe_4eca_30cd90f4d096 fc32467c_b723_ddfe_8af5_436f343793bc["it_respects_gitignore_in_workspace_root_for_manual_globs()"] fc32467c_b723_ddfe_8af5_436f343793bc -->|calls| 2c5d72c1_5cbe_ebbe_4eca_30cd90f4d096 2b76f542_3858_df91_3c5d_e1d8ab7f3c81["test_ignore_node_modules_without_gitignore()"] 2b76f542_3858_df91_3c5d_e1d8ab7f3c81 -->|calls| 2c5d72c1_5cbe_ebbe_4eca_30cd90f4d096 style 2c5d72c1_5cbe_ebbe_4eca_30cd90f4d096 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
crates/oxide/tests/scanner.rs lines 64–139
fn scan_with_globs(
paths_with_content: &[(&str, &str)],
source_directives: Vec<&str>,
) -> ScanResult {
// Create a temporary working directory
let dir = tempdir().unwrap().into_path();
// Initialize this directory as a git repository
let _ = Command::new("git").arg("init").current_dir(&dir).output();
// Create the necessary files
self::create_files_in(&dir, paths_with_content);
let base = format!("{}", dir.display()).replace('\\', "/");
// Resolve all content paths for the (temporary) current working directory
let sources: Vec<PublicSourceEntry> = source_directives
.iter()
.map(|str| public_source_entry_from_pattern(base.clone().into(), str))
.collect();
let mut scanner = Scanner::new(sources);
let candidates = scanner.scan();
let base_dir =
format!("{}{}", dunce::canonicalize(&base).unwrap().display(), "/").replace('\\', "/");
// Get all scanned files as strings relative to the base directory
let mut files = scanner
.get_files()
.iter()
// Normalize paths to use unix style separators
.map(|file| file.replace('\\', "/").replace(&base_dir, ""))
.collect::<Vec<_>>();
files.sort();
// Get all scanned globs as strings relative to the base directory
let mut globs = scanner
.get_globs()
.iter()
.map(|glob| {
if glob.pattern.starts_with('/') {
format!("{}{}", glob.base, glob.pattern)
} else {
format!("{}/{}", glob.base, glob.pattern)
}
})
// Normalize paths to use unix style separators
.map(|file| file.replace('\\', "/").replace(&base_dir, ""))
.collect::<Vec<_>>();
globs.sort();
// Get all normalized sources as strings relative to the base directory
let mut normalized_sources = scanner
.get_normalized_sources()
.iter()
.map(|glob| {
if glob.pattern.starts_with('/') {
format!("{}{}", glob.base, glob.pattern)
} else {
format!("{}/{}", glob.base, glob.pattern)
}
})
// Normalize paths to use unix style separators
.map(|file| file.replace('\\', "/").replace(&base_dir, ""))
.collect::<Vec<_>>();
normalized_sources.sort();
ScanResult {
files,
globs,
normalized_sources,
candidates,
}
}
Domain
Subdomains
Called By
- it_includes_skipped_by_default_extensions_with_a_specific_source()
- it_respects_gitignore_in_workspace_root()
- it_respects_gitignore_in_workspace_root_for_manual_globs()
- it_should_be_possible_to_scan_in_the_parent_directory()
- it_should_ignore_negated_custom_sources()
- it_should_include_defined_extensions_that_are_ignored_by_default()
- it_should_scan_content_paths()
- it_should_scan_content_paths_even_when_they_are_git_ignored()
- it_should_scan_files_without_extensions()
- it_should_scan_folders_with_extensions()
- it_should_scan_next_dynamic_folders()
- it_should_work_with_manual_glob_only()
- scan()
- test_ignore_gitignore_in_node_modules_source()
- test_ignore_node_modules_without_gitignore()
- test_works_with_utf8_special_character_paths()
Source
Frequently Asked Questions
What does scan_with_globs() do?
scan_with_globs() is a function in the tailwindcss codebase.
What does scan_with_globs() call?
scan_with_globs() calls 3 function(s): create_files_in, public_source_entry_from_pattern, scan.
What calls scan_with_globs()?
scan_with_globs() is called by 16 function(s): it_includes_skipped_by_default_extensions_with_a_specific_source, it_respects_gitignore_in_workspace_root, it_respects_gitignore_in_workspace_root_for_manual_globs, it_should_be_possible_to_scan_in_the_parent_directory, it_should_ignore_negated_custom_sources, it_should_include_defined_extensions_that_are_ignored_by_default, it_should_scan_content_paths, it_should_scan_content_paths_even_when_they_are_git_ignored, and 8 more.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free