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 41ad7065_a22a_6fa4_2918_dd0363176574["candidate.bench.ts"] 669e6a28_c71f_3c5e_9c53_915cede7da78["candidate.ts"] 41ad7065_a22a_6fa4_2918_dd0363176574 --> 669e6a28_c71f_3c5e_9c53_915cede7da78 f29ee016_da0a_a564_1658_fedaaac680b6["cloneCandidate"] 41ad7065_a22a_6fa4_2918_dd0363176574 --> f29ee016_da0a_a564_1658_fedaaac680b6 d4b90da0_01b5_b21d_ff05_b37798744576["parseCandidate"] 41ad7065_a22a_6fa4_2918_dd0363176574 --> d4b90da0_01b5_b21d_ff05_b37798744576 7fd72d4c_e95c_d849_1002_1e1c9d8aca1a["design-system.ts"] 41ad7065_a22a_6fa4_2918_dd0363176574 --> 7fd72d4c_e95c_d849_1002_1e1c9d8aca1a 9b965fd7_d8e9_0b43_cd5d_c9294ab598ed["buildDesignSystem"] 41ad7065_a22a_6fa4_2918_dd0363176574 --> 9b965fd7_d8e9_0b43_cd5d_c9294ab598ed 80295787_127f_69e6_91b3_4bea3a484544["theme.ts"] 41ad7065_a22a_6fa4_2918_dd0363176574 --> 80295787_127f_69e6_91b3_4bea3a484544 734cf7ec_fb2a_2532_7b20_b3a815c7e3e6["Theme"] 41ad7065_a22a_6fa4_2918_dd0363176574 --> 734cf7ec_fb2a_2532_7b20_b3a815c7e3e6 8f3a837a_4918_fced_fe0d_2cfdb0bd2b31["oxide"] 41ad7065_a22a_6fa4_2918_dd0363176574 --> 8f3a837a_4918_fced_fe0d_2cfdb0bd2b31 696bd648_5f24_1b59_8e8b_7a97a692869e["vitest"] 41ad7065_a22a_6fa4_2918_dd0363176574 --> 696bd648_5f24_1b59_8e8b_7a97a692869e style 41ad7065_a22a_6fa4_2918_dd0363176574 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 OxideEngine domain, PreProcessors 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: OxideEngine, subdomain: PreProcessors, directory: packages/tailwindcss/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free