candidate.bench.ts — tailwindcss Source File
Architecture documentation for candidate.bench.ts, a typescript file in the tailwindcss codebase. 9 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 16bff9c7_34eb_6bfb_9f80_b116fde86d22["candidate.bench.ts"] ba6fca27_7720_5839_0f92_bc2abb8db636["candidate.ts"] 16bff9c7_34eb_6bfb_9f80_b116fde86d22 --> ba6fca27_7720_5839_0f92_bc2abb8db636 23c6e5a0_eac4_e9dd_7fcf_1e5c71d28310["cloneCandidate"] 16bff9c7_34eb_6bfb_9f80_b116fde86d22 --> 23c6e5a0_eac4_e9dd_7fcf_1e5c71d28310 7d328a86_10c6_b5c1_6390_36f4fffe9c14["parseCandidate"] 16bff9c7_34eb_6bfb_9f80_b116fde86d22 --> 7d328a86_10c6_b5c1_6390_36f4fffe9c14 bdedd2f6_da4b_69dc_e990_0814b59fbe6e["design-system.ts"] 16bff9c7_34eb_6bfb_9f80_b116fde86d22 --> bdedd2f6_da4b_69dc_e990_0814b59fbe6e e557c8a4_bb27_ee44_c462_9e238157ad04["buildDesignSystem"] 16bff9c7_34eb_6bfb_9f80_b116fde86d22 --> e557c8a4_bb27_ee44_c462_9e238157ad04 e28cd4a7_4e1a_e79b_76f1_86c479c6640d["theme.ts"] 16bff9c7_34eb_6bfb_9f80_b116fde86d22 --> e28cd4a7_4e1a_e79b_76f1_86c479c6640d e7a2e966_188e_28f5_d9d6_e54e27e0d0f2["Theme"] 16bff9c7_34eb_6bfb_9f80_b116fde86d22 --> e7a2e966_188e_28f5_d9d6_e54e27e0d0f2 5a22a82e_ea42_a956_7900_a189873ab04d["oxide"] 16bff9c7_34eb_6bfb_9f80_b116fde86d22 --> 5a22a82e_ea42_a956_7900_a189873ab04d f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3["vitest"] 16bff9c7_34eb_6bfb_9f80_b116fde86d22 --> f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3 style 16bff9c7_34eb_6bfb_9f80_b116fde86d22 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { Scanner } from '@tailwindcss/oxide'
import { bench, describe } from 'vitest'
import { cloneCandidate, parseCandidate, type Candidate, type Variant } from './candidate'
import { buildDesignSystem } from './design-system'
import { Theme } from './theme'
// FOLDER=path/to/folder vitest bench
const root = process.env.FOLDER || process.cwd()
// Auto content detection
const scanner = new Scanner({ sources: [{ base: root, pattern: '**/*', negated: false }] })
const candidates = scanner.scan()
const designSystem = buildDesignSystem(new Theme())
describe('parsing', () => {
bench('parseCandidate', () => {
for (let candidate of candidates) {
Array.from(parseCandidate(candidate, designSystem))
}
})
})
describe('Candidate cloning', async () => {
let parsedCanddiates = candidates.flatMap((candidate) =>
Array.from(parseCandidate(candidate, designSystem)),
)
bench('structuredClone', () => {
for (let candidate of parsedCanddiates) {
structuredClone(candidate)
}
})
bench('cloneCandidate', () => {
for (let candidate of parsedCanddiates) {
cloneCandidate(candidate)
}
})
bench('cloneCandidate (spread)', () => {
for (let candidate of parsedCanddiates) {
cloneCandidateSpread(candidate)
}
})
})
function cloneCandidateSpread(candidate: Candidate): Candidate {
switch (candidate.kind) {
case 'arbitrary':
return {
...candidate,
modifier: candidate.modifier ? { ...candidate.modifier } : null,
variants: candidate.variants.map(cloneVariantSpread),
}
case 'static':
return { ...candidate, variants: candidate.variants.map(cloneVariantSpread) }
case 'functional':
return {
...candidate,
value: candidate.value ? { ...candidate.value } : null,
modifier: candidate.modifier ? { ...candidate.modifier } : null,
variants: candidate.variants.map(cloneVariantSpread),
}
default:
candidate satisfies never
throw new Error('Unknown candidate kind')
}
}
function cloneVariantSpread(variant: Variant): Variant {
switch (variant.kind) {
case 'arbitrary':
case 'static':
return { ...variant }
case 'functional':
return { ...variant, modifier: variant.modifier ? { ...variant.modifier } : null }
case 'compound':
return {
...variant,
variant: cloneVariantSpread(variant.variant),
modifier: variant.modifier ? { ...variant.modifier } : null,
}
default:
variant satisfies never
throw new Error('Unknown variant kind')
}
}
Domain
Subdomains
Dependencies
Source
Frequently Asked Questions
What does candidate.bench.ts do?
candidate.bench.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the Oxide domain, Scanner subdomain.
What functions are defined in candidate.bench.ts?
candidate.bench.ts defines 2 function(s): cloneCandidateSpread, cloneVariantSpread.
What does candidate.bench.ts depend on?
candidate.bench.ts imports 9 module(s): Theme, buildDesignSystem, candidate.ts, cloneCandidate, design-system.ts, oxide, parseCandidate, theme.ts, and 1 more.
Where is candidate.bench.ts in the architecture?
candidate.bench.ts is located at packages/tailwindcss/src/candidate.bench.ts (domain: Oxide, subdomain: Scanner, directory: packages/tailwindcss/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free