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 990ff273_1c94_4f96_c7f9_ccba0f65db9c["detect_sources.rs"] 4256b054_3bb1_2602_769c_17f7926f1c68["crate::scanner::auto_source_detection::IGNORED_CONTENT_DIRS"] 990ff273_1c94_4f96_c7f9_ccba0f65db9c --> 4256b054_3bb1_2602_769c_17f7926f1c68 b921cd27_b8e3_5c45_8149_e1c73da861da["crate::GlobEntry"] 990ff273_1c94_4f96_c7f9_ccba0f65db9c --> b921cd27_b8e3_5c45_8149_e1c73da861da 4bccd8d9_be22_807a_aae7_ed7e7df0ac9a["fxhash::FxHashSet"] 990ff273_1c94_4f96_c7f9_ccba0f65db9c --> 4bccd8d9_be22_807a_aae7_ed7e7df0ac9a 11d30cc0_510c_3e08_dfcf_ca0ff1203451["globwalk::DirEntry"] 990ff273_1c94_4f96_c7f9_ccba0f65db9c --> 11d30cc0_510c_3e08_dfcf_ca0ff1203451 0e2fbdef_6299_db0d_6cb3_082d258c9b95["std::cmp::Ordering"] 990ff273_1c94_4f96_c7f9_ccba0f65db9c --> 0e2fbdef_6299_db0d_6cb3_082d258c9b95 c6eac707_86ad_10ab_6a43_c1f9e507b976["std::path::PathBuf"] 990ff273_1c94_4f96_c7f9_ccba0f65db9c --> c6eac707_86ad_10ab_6a43_c1f9e507b976 6d15903a_0cf5_e00c_800c_2bb2605c4081["std::sync"] 990ff273_1c94_4f96_c7f9_ccba0f65db9c --> 6d15903a_0cf5_e00c_800c_2bb2605c4081 eefc32b8_ac8f_2148_48be_55ed542d6a83["walkdir::WalkDir"] 990ff273_1c94_4f96_c7f9_ccba0f65db9c --> eefc32b8_ac8f_2148_48be_55ed542d6a83 style 990ff273_1c94_4f96_c7f9_ccba0f65db9c 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 Oxide 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: Oxide, 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