candidates.ts — tailwindcss Source File
Architecture documentation for candidates.ts, a typescript file in the tailwindcss codebase. 5 imports, 3 dependents.
Entity Profile
Dependency Diagram
graph LR 530db924_e458_e8b2_fde4_45f3e78b4424["candidates.ts"] ba6fca27_7720_5839_0f92_bc2abb8db636["candidate.ts"] 530db924_e458_e8b2_fde4_45f3e78b4424 --> ba6fca27_7720_5839_0f92_bc2abb8db636 23c6e5a0_eac4_e9dd_7fcf_1e5c71d28310["cloneCandidate"] 530db924_e458_e8b2_fde4_45f3e78b4424 --> 23c6e5a0_eac4_e9dd_7fcf_1e5c71d28310 bdedd2f6_da4b_69dc_e990_0814b59fbe6e["design-system.ts"] 530db924_e458_e8b2_fde4_45f3e78b4424 --> bdedd2f6_da4b_69dc_e990_0814b59fbe6e 665aa4ed_d86e_30e5_80d5_cd56b8ca8b62["DesignSystem"] 530db924_e458_e8b2_fde4_45f3e78b4424 --> 665aa4ed_d86e_30e5_80d5_cd56b8ca8b62 5a22a82e_ea42_a956_7900_a189873ab04d["oxide"] 530db924_e458_e8b2_fde4_45f3e78b4424 --> 5a22a82e_ea42_a956_7900_a189873ab04d bcb20eda_2bd7_ff25_6134_e91d834a79e1["candidates.test.ts"] bcb20eda_2bd7_ff25_6134_e91d834a79e1 --> 530db924_e458_e8b2_fde4_45f3e78b4424 b221facd_4d62_d2ce_4a2c_e77999b7a5ae["migrate-legacy-classes.ts"] b221facd_4d62_d2ce_4a2c_e77999b7a5ae --> 530db924_e458_e8b2_fde4_45f3e78b4424 e39bed3f_bfbf_a8c6_90a0_aa2ce3be1ef4["migrate.ts"] e39bed3f_bfbf_a8c6_90a0_aa2ce3be1ef4 --> 530db924_e458_e8b2_fde4_45f3e78b4424 style 530db924_e458_e8b2_fde4_45f3e78b4424 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { Scanner } from '@tailwindcss/oxide'
import { cloneCandidate, type Candidate } from '../../../../tailwindcss/src/candidate'
import type { DesignSystem } from '../../../../tailwindcss/src/design-system'
export async function extractRawCandidates(
content: string,
extension: string = 'html',
): Promise<{ rawCandidate: string; start: number; end: number }[]> {
let scanner = new Scanner({})
let result = scanner.getCandidatesWithPositions({ content, extension })
let candidates: { rawCandidate: string; start: number; end: number }[] = []
for (let { candidate: rawCandidate, position: start } of result) {
candidates.push({ rawCandidate, start, end: start + rawCandidate.length })
}
return candidates
}
// Create a basic stripped candidate without variants or important flag
export function baseCandidate<T extends Candidate>(candidate: T) {
let base = cloneCandidate(candidate)
base.important = false
base.variants = []
return base
}
export function parseCandidate(designSystem: DesignSystem, input: string) {
return designSystem.parseCandidate(
designSystem.theme.prefix && !input.startsWith(`${designSystem.theme.prefix}:`)
? `${designSystem.theme.prefix}:${input}`
: input,
)
}
export function printUnprefixedCandidate(designSystem: DesignSystem, candidate: Candidate) {
let candidateString = designSystem.printCandidate(candidate)
return designSystem.theme.prefix && candidateString.startsWith(`${designSystem.theme.prefix}:`)
? candidateString.slice(designSystem.theme.prefix.length + 1)
: candidateString
}
Domain
Subdomains
Dependencies
Imported By
Source
Frequently Asked Questions
What does candidates.ts do?
candidates.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the CommandLineInterface domain, Codemods subdomain.
What functions are defined in candidates.ts?
candidates.ts defines 4 function(s): baseCandidate, extractRawCandidates, parseCandidate, printUnprefixedCandidate.
What does candidates.ts depend on?
candidates.ts imports 5 module(s): DesignSystem, candidate.ts, cloneCandidate, design-system.ts, oxide.
What files import candidates.ts?
candidates.ts is imported by 3 file(s): candidates.test.ts, migrate-legacy-classes.ts, migrate.ts.
Where is candidates.ts in the architecture?
candidates.ts is located at packages/@tailwindcss-upgrade/src/codemods/template/candidates.ts (domain: CommandLineInterface, subdomain: Codemods, directory: packages/@tailwindcss-upgrade/src/codemods/template).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free