Home / Function/ scan_with_globs() — tailwindcss Function Reference

scan_with_globs() — tailwindcss Function Reference

Architecture documentation for the scan_with_globs() function in scanner.rs from the tailwindcss codebase.

Function rust OxideEngine Scanner calls 3 called by 16

Entity Profile

Dependency Diagram

graph TD
  a53d0655_c789_b0d9_0c48_cfd60da7194b["scan_with_globs()"]
  340ddba0_15e4_a309_9dea_cf6d6e73381d["scanner.rs"]
  a53d0655_c789_b0d9_0c48_cfd60da7194b -->|defined in| 340ddba0_15e4_a309_9dea_cf6d6e73381d
  2f3305c3_ad36_6002_daa9_52b16e0424fd["scan()"]
  2f3305c3_ad36_6002_daa9_52b16e0424fd -->|calls| a53d0655_c789_b0d9_0c48_cfd60da7194b
  9dca837d_45d4_da47_72ca_549b466ef11b["it_should_be_possible_to_scan_in_the_parent_directory()"]
  9dca837d_45d4_da47_72ca_549b466ef11b -->|calls| a53d0655_c789_b0d9_0c48_cfd60da7194b
  d54aeda0_8736_0600_c761_1aa1b219502c["it_should_scan_files_without_extensions()"]
  d54aeda0_8736_0600_c761_1aa1b219502c -->|calls| a53d0655_c789_b0d9_0c48_cfd60da7194b
  d795f640_00c7_5524_af32_cbe4d801e343["it_should_scan_folders_with_extensions()"]
  d795f640_00c7_5524_af32_cbe4d801e343 -->|calls| a53d0655_c789_b0d9_0c48_cfd60da7194b
  830965ac_b880_5f2d_0aa1_ababe9386f78["it_should_scan_content_paths()"]
  830965ac_b880_5f2d_0aa1_ababe9386f78 -->|calls| a53d0655_c789_b0d9_0c48_cfd60da7194b
  5597b577_5042_1c2f_5862_b8cfce071e79["it_should_scan_next_dynamic_folders()"]
  5597b577_5042_1c2f_5862_b8cfce071e79 -->|calls| a53d0655_c789_b0d9_0c48_cfd60da7194b
  ac5a3710_2d5f_1044_35da_7a2412a12240["it_should_scan_content_paths_even_when_they_are_git_ignored()"]
  ac5a3710_2d5f_1044_35da_7a2412a12240 -->|calls| a53d0655_c789_b0d9_0c48_cfd60da7194b
  e27be45d_1ef1_e9a5_2117_03069f45d301["it_should_ignore_negated_custom_sources()"]
  e27be45d_1ef1_e9a5_2117_03069f45d301 -->|calls| a53d0655_c789_b0d9_0c48_cfd60da7194b
  b20dcd2f_797a_dc75_e7aa_523b9850232d["it_should_include_defined_extensions_that_are_ignored_by_default()"]
  b20dcd2f_797a_dc75_e7aa_523b9850232d -->|calls| a53d0655_c789_b0d9_0c48_cfd60da7194b
  d77be684_b03c_1aea_1c4a_1328ac733969["it_should_work_with_manual_glob_only()"]
  d77be684_b03c_1aea_1c4a_1328ac733969 -->|calls| a53d0655_c789_b0d9_0c48_cfd60da7194b
  8dbae8ca_9fe9_e62a_5cef_2d252b3c9ca2["it_respects_gitignore_in_workspace_root()"]
  8dbae8ca_9fe9_e62a_5cef_2d252b3c9ca2 -->|calls| a53d0655_c789_b0d9_0c48_cfd60da7194b
  d1ae13f8_595d_4594_d2a0_7d85f79ba3fc["it_includes_skipped_by_default_extensions_with_a_specific_source()"]
  d1ae13f8_595d_4594_d2a0_7d85f79ba3fc -->|calls| a53d0655_c789_b0d9_0c48_cfd60da7194b
  1c14c13c_74a3_190c_e9ef_a0f3fcf22ae9["it_respects_gitignore_in_workspace_root_for_manual_globs()"]
  1c14c13c_74a3_190c_e9ef_a0f3fcf22ae9 -->|calls| a53d0655_c789_b0d9_0c48_cfd60da7194b
  style a53d0655_c789_b0d9_0c48_cfd60da7194b 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

Frequently Asked Questions

What does scan_with_globs() do?
scan_with_globs() is a function in the tailwindcss codebase, defined in crates/oxide/tests/scanner.rs.
Where is scan_with_globs() defined?
scan_with_globs() is defined in crates/oxide/tests/scanner.rs at line 64.
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