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

Entity Profile

Dependency Diagram

graph TD
  4e97b231_bdcb_50f8_8ad3_53d02c45a8bb["scan_with_globs()"]
  66c99d71_b17e_d5a4_2a47_c675fac3c9cc["scan()"]
  66c99d71_b17e_d5a4_2a47_c675fac3c9cc -->|calls| 4e97b231_bdcb_50f8_8ad3_53d02c45a8bb
  883a53ea_39a2_63d8_73e0_40d8026f9ff9["it_should_be_possible_to_scan_in_the_parent_directory()"]
  883a53ea_39a2_63d8_73e0_40d8026f9ff9 -->|calls| 4e97b231_bdcb_50f8_8ad3_53d02c45a8bb
  226e8bfa_1f1d_2b5d_be43_7985d4aa7b63["it_should_scan_files_without_extensions()"]
  226e8bfa_1f1d_2b5d_be43_7985d4aa7b63 -->|calls| 4e97b231_bdcb_50f8_8ad3_53d02c45a8bb
  7cca7862_4d1e_6cdf_5b58_2ea8c72aefeb["it_should_scan_folders_with_extensions()"]
  7cca7862_4d1e_6cdf_5b58_2ea8c72aefeb -->|calls| 4e97b231_bdcb_50f8_8ad3_53d02c45a8bb
  cb6b72df_d25b_a780_60d1_271c7e10004d["it_should_scan_content_paths()"]
  cb6b72df_d25b_a780_60d1_271c7e10004d -->|calls| 4e97b231_bdcb_50f8_8ad3_53d02c45a8bb
  9557424c_7f99_912e_0d4c_36dbf9690e42["it_should_scan_next_dynamic_folders()"]
  9557424c_7f99_912e_0d4c_36dbf9690e42 -->|calls| 4e97b231_bdcb_50f8_8ad3_53d02c45a8bb
  ea7012af_5bb9_f357_640a_022801a7e5b0["it_should_scan_content_paths_even_when_they_are_git_ignored()"]
  ea7012af_5bb9_f357_640a_022801a7e5b0 -->|calls| 4e97b231_bdcb_50f8_8ad3_53d02c45a8bb
  1332131b_60d5_ffd8_2c85_ee0a6d5bad35["it_should_ignore_negated_custom_sources()"]
  1332131b_60d5_ffd8_2c85_ee0a6d5bad35 -->|calls| 4e97b231_bdcb_50f8_8ad3_53d02c45a8bb
  72f5dba3_6cf7_d92c_b0eb_3871aa635da4["it_should_include_defined_extensions_that_are_ignored_by_default()"]
  72f5dba3_6cf7_d92c_b0eb_3871aa635da4 -->|calls| 4e97b231_bdcb_50f8_8ad3_53d02c45a8bb
  4cbe8344_c7ca_8a91_542b_b9f8437faddc["it_should_work_with_manual_glob_only()"]
  4cbe8344_c7ca_8a91_542b_b9f8437faddc -->|calls| 4e97b231_bdcb_50f8_8ad3_53d02c45a8bb
  79707b39_a9a5_8a6c_5307_c2f9bd2877ee["it_respects_gitignore_in_workspace_root()"]
  79707b39_a9a5_8a6c_5307_c2f9bd2877ee -->|calls| 4e97b231_bdcb_50f8_8ad3_53d02c45a8bb
  f31e8e2e_e59b_591e_063f_de04cf38af21["it_includes_skipped_by_default_extensions_with_a_specific_source()"]
  f31e8e2e_e59b_591e_063f_de04cf38af21 -->|calls| 4e97b231_bdcb_50f8_8ad3_53d02c45a8bb
  a50e1d16_bb6a_20c7_2e59_ddd647d8e705["it_respects_gitignore_in_workspace_root_for_manual_globs()"]
  a50e1d16_bb6a_20c7_2e59_ddd647d8e705 -->|calls| 4e97b231_bdcb_50f8_8ad3_53d02c45a8bb
  69f1c6fd_4e6e_7b32_fadc_f5e70b9385bc["test_ignore_node_modules_without_gitignore()"]
  69f1c6fd_4e6e_7b32_fadc_f5e70b9385bc -->|calls| 4e97b231_bdcb_50f8_8ad3_53d02c45a8bb
  style 4e97b231_bdcb_50f8_8ad3_53d02c45a8bb 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.
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