findFontVariableDeclaration() — ui Function Reference
Architecture documentation for the findFontVariableDeclaration() function in update-fonts.ts from the ui codebase.
Entity Profile
Dependency Diagram
graph TD 9ba1007e_24de_419b_d022_c5f5ead52043["findFontVariableDeclaration()"] b169f1bf_76c5_e7c9_f493_15fe0f296591["update-fonts.ts"] 9ba1007e_24de_419b_d022_c5f5ead52043 -->|defined in| b169f1bf_76c5_e7c9_f493_15fe0f296591 fb488c27_d35b_ddbe_26c7_6bfb5c38105a["transformLayoutFonts()"] fb488c27_d35b_ddbe_26c7_6bfb5c38105a -->|calls| 9ba1007e_24de_419b_d022_c5f5ead52043 style 9ba1007e_24de_419b_d022_c5f5ead52043 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/shadcn/src/utils/updaters/update-fonts.ts lines 293–323
function findFontVariableDeclaration(
sourceFile: ReturnType<Project["createSourceFile"]>,
variable: string
) {
// Find variable declarations that call a font function with matching variable.
const variableStatements = sourceFile.getVariableStatements()
for (const statement of variableStatements) {
for (const declaration of statement.getDeclarations()) {
const initializer = declaration.getInitializer()
if (!initializer) continue
// Check if it's a call expression.
if (initializer.getKind() !== SyntaxKind.CallExpression) continue
const callExpr = initializer as CallExpression
// Get the arguments.
const args = callExpr.getArguments()
if (args.length === 0) continue
// Check if any argument contains our variable.
const argText = args[0].getText()
if (argText.includes(`variable:`) && argText.includes(variable)) {
return declaration
}
}
}
return null
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does findFontVariableDeclaration() do?
findFontVariableDeclaration() is a function in the ui codebase, defined in packages/shadcn/src/utils/updaters/update-fonts.ts.
Where is findFontVariableDeclaration() defined?
findFontVariableDeclaration() is defined in packages/shadcn/src/utils/updaters/update-fonts.ts at line 293.
What calls findFontVariableDeclaration()?
findFontVariableDeclaration() is called by 1 function(s): transformLayoutFonts.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free