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 Oxide Scanner calls 3 called by 16

Entity Profile

Dependency Diagram

graph TD
  15062065_cf6b_d794_5db7_667a2b756e64["scan_with_globs()"]
  6b48c515_a72f_7a7d_7ea7_b80f71a82b19["scanner.rs"]
  15062065_cf6b_d794_5db7_667a2b756e64 -->|defined in| 6b48c515_a72f_7a7d_7ea7_b80f71a82b19
  89cd8369_536c_74e5_91d1_719df04e4597["scan()"]
  89cd8369_536c_74e5_91d1_719df04e4597 -->|calls| 15062065_cf6b_d794_5db7_667a2b756e64
  c23c94de_a85c_e5d7_3b4a_ff694ead4bf7["it_should_be_possible_to_scan_in_the_parent_directory()"]
  c23c94de_a85c_e5d7_3b4a_ff694ead4bf7 -->|calls| 15062065_cf6b_d794_5db7_667a2b756e64
  c1d8543a_6000_e714_3554_10f60a0bcf08["it_should_scan_files_without_extensions()"]
  c1d8543a_6000_e714_3554_10f60a0bcf08 -->|calls| 15062065_cf6b_d794_5db7_667a2b756e64
  0c9f0878_4448_bfd6_204c_dd323f57bfc8["it_should_scan_folders_with_extensions()"]
  0c9f0878_4448_bfd6_204c_dd323f57bfc8 -->|calls| 15062065_cf6b_d794_5db7_667a2b756e64
  1d7b3f68_7596_71b0_b1e9_66627384c5f5["it_should_scan_content_paths()"]
  1d7b3f68_7596_71b0_b1e9_66627384c5f5 -->|calls| 15062065_cf6b_d794_5db7_667a2b756e64
  23160fc1_15c5_2b97_5ea6_b972e8f894d0["it_should_scan_next_dynamic_folders()"]
  23160fc1_15c5_2b97_5ea6_b972e8f894d0 -->|calls| 15062065_cf6b_d794_5db7_667a2b756e64
  25706028_d671_508e_fb0f_82c4f06a77a6["it_should_scan_content_paths_even_when_they_are_git_ignored()"]
  25706028_d671_508e_fb0f_82c4f06a77a6 -->|calls| 15062065_cf6b_d794_5db7_667a2b756e64
  db9917f7_0559_4f7f_2e36_b91e4ac5b2fe["it_should_ignore_negated_custom_sources()"]
  db9917f7_0559_4f7f_2e36_b91e4ac5b2fe -->|calls| 15062065_cf6b_d794_5db7_667a2b756e64
  e869efee_c5d6_85e8_b0b2_8f85d53e1435["it_should_include_defined_extensions_that_are_ignored_by_default()"]
  e869efee_c5d6_85e8_b0b2_8f85d53e1435 -->|calls| 15062065_cf6b_d794_5db7_667a2b756e64
  803e6134_40ce_c6cc_1633_e03fb809f318["it_should_work_with_manual_glob_only()"]
  803e6134_40ce_c6cc_1633_e03fb809f318 -->|calls| 15062065_cf6b_d794_5db7_667a2b756e64
  904850ec_4e68_1fcb_6fea_f31aa189693d["it_respects_gitignore_in_workspace_root()"]
  904850ec_4e68_1fcb_6fea_f31aa189693d -->|calls| 15062065_cf6b_d794_5db7_667a2b756e64
  86e47c5a_3186_207a_81bf_3908659cefd3["it_includes_skipped_by_default_extensions_with_a_specific_source()"]
  86e47c5a_3186_207a_81bf_3908659cefd3 -->|calls| 15062065_cf6b_d794_5db7_667a2b756e64
  6dc5bc76_d760_3df5_a5bb_b3676086dbb8["it_respects_gitignore_in_workspace_root_for_manual_globs()"]
  6dc5bc76_d760_3df5_a5bb_b3676086dbb8 -->|calls| 15062065_cf6b_d794_5db7_667a2b756e64
  style 15062065_cf6b_d794_5db7_667a2b756e64 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