detect_sources.rs — tailwindcss Source File
Architecture documentation for detect_sources.rs, a rust file in the tailwindcss codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 7d2319d3_25b0_c592_4c61_1dd3bd91bb9a["detect_sources.rs"] 0d2957fe_bcab_7c0e_464f_0f96cbd717e6["crate::scanner::auto_source_detection::IGNORED_CONTENT_DIRS"] 7d2319d3_25b0_c592_4c61_1dd3bd91bb9a --> 0d2957fe_bcab_7c0e_464f_0f96cbd717e6 c745f568_cba4_79a2_f483_6b15a85dac8f["crate::GlobEntry"] 7d2319d3_25b0_c592_4c61_1dd3bd91bb9a --> c745f568_cba4_79a2_f483_6b15a85dac8f b843b7ca_d3c1_8161_5c37_0ab8b5701e56["fxhash::FxHashSet"] 7d2319d3_25b0_c592_4c61_1dd3bd91bb9a --> b843b7ca_d3c1_8161_5c37_0ab8b5701e56 318ee34f_9791_32a7_b684_7c5979ea5d64["globwalk::DirEntry"] 7d2319d3_25b0_c592_4c61_1dd3bd91bb9a --> 318ee34f_9791_32a7_b684_7c5979ea5d64 5aff63be_20cc_2279_4acf_1042616e649a["std::cmp::Ordering"] 7d2319d3_25b0_c592_4c61_1dd3bd91bb9a --> 5aff63be_20cc_2279_4acf_1042616e649a e3823f68_828a_494b_6398_2fca0b2dd428["std::path::PathBuf"] 7d2319d3_25b0_c592_4c61_1dd3bd91bb9a --> e3823f68_828a_494b_6398_2fca0b2dd428 29632a2a_88f2_f99f_6979_ae26cc6fa806["std::sync"] 7d2319d3_25b0_c592_4c61_1dd3bd91bb9a --> 29632a2a_88f2_f99f_6979_ae26cc6fa806 046812d0_8acc_56d1_5575_59927a033dc4["walkdir::WalkDir"] 7d2319d3_25b0_c592_4c61_1dd3bd91bb9a --> 046812d0_8acc_56d1_5575_59927a033dc4 style 7d2319d3_25b0_c592_4c61_1dd3bd91bb9a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
use crate::scanner::auto_source_detection::IGNORED_CONTENT_DIRS;
use crate::GlobEntry;
use fxhash::FxHashSet;
use globwalk::DirEntry;
use std::cmp::Ordering;
use std::path::PathBuf;
use std::sync;
use walkdir::WalkDir;
static KNOWN_EXTENSIONS: sync::LazyLock<Vec<&'static str>> = sync::LazyLock::new(|| {
include_str!("fixtures/template-extensions.txt")
.trim()
.lines()
// Drop commented lines
.filter(|x| !x.starts_with('#'))
// Drop empty lines
.filter(|x| !x.is_empty())
.collect()
});
// Sorting to make sure that we always see the directories before the files. Also sorting
// alphabetically by default.
fn sort_by_dir_and_name(a: &DirEntry, z: &DirEntry) -> Ordering {
match (a.file_type().is_dir(), z.file_type().is_dir()) {
(true, false) => Ordering::Less,
(false, true) => Ordering::Greater,
_ => a.file_name().cmp(z.file_name()),
}
}
pub fn resolve_globs(
base: PathBuf,
dirs: &[PathBuf],
extensions: &FxHashSet<String>,
) -> Vec<GlobEntry> {
let allowed_paths: FxHashSet<PathBuf> = FxHashSet::from_iter(dirs.iter().cloned());
// A list of known extensions + a list of extensions we found in the project.
let mut found_extensions: FxHashSet<String> =
FxHashSet::from_iter(KNOWN_EXTENSIONS.iter().map(|x| x.to_string()));
found_extensions.extend(extensions.iter().cloned());
// A list of directory names where we can't use globs, but we should track each file
// individually instead. This is because these directories are often used for both source and
// destination files.
let forced_static_directories: FxHashSet<PathBuf> =
FxHashSet::from_iter(vec![base.join("public")]);
// All directories where we can safely use deeply nested globs to watch all files.
// In other comments we refer to these as "deep glob directories" or similar.
//
// E.g.: `./src/**/*.{html,js}`
let mut deep_globable_directories: FxHashSet<PathBuf> = Default::default();
// All directories where we can only use shallow globs to watch all direct files but not
// folders.
// In other comments we refer to these as "shallow glob directories" or similar.
//
// E.g.: `./src/*/*.{html,js}`
let mut shallow_globable_directories: FxHashSet<PathBuf> = Default::default();
// ... (102 more lines)
Domain
Subdomains
Dependencies
- crate::GlobEntry
- crate::scanner::auto_source_detection::IGNORED_CONTENT_DIRS
- fxhash::FxHashSet
- globwalk::DirEntry
- std::cmp::Ordering
- std::path::PathBuf
- std::sync
- walkdir::WalkDir
Source
Frequently Asked Questions
What does detect_sources.rs do?
detect_sources.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 detect_sources.rs?
detect_sources.rs defines 3 function(s): include_str, resolve_globs, sort_by_dir_and_name.
What does detect_sources.rs depend on?
detect_sources.rs imports 8 module(s): crate::GlobEntry, crate::scanner::auto_source_detection::IGNORED_CONTENT_DIRS, fxhash::FxHashSet, globwalk::DirEntry, std::cmp::Ordering, std::path::PathBuf, std::sync, walkdir::WalkDir.
Where is detect_sources.rs in the architecture?
detect_sources.rs is located at crates/oxide/src/scanner/detect_sources.rs (domain: OxideEngine, subdomain: Scanner, directory: crates/oxide/src/scanner).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free