@@ -16,16 +16,14 @@ import * as themeContent from './theme/content'
1616/**
1717 * Build a dependency graph of components by scanning their source files
1818 */
19-async function buildComponentDependencyGraph(componentDir: string, prefix: string): Promise<Map<string, Set<string>>> {
19+async function buildComponentDependencyGraph(componentDir: string, componentPattern: RegExp): Promise<Map<string, Set<string>>> {
2020const dependencyGraph = new Map<string, Set<string>>()
21212222const componentFiles = globSync(['**/*.vue'], {
2323cwd: componentDir,
2424absolute: true
2525})
262627-const componentPattern = new RegExp(`<${prefix}([A-Z][a-zA-Z]+)|\\b${prefix}([A-Z][a-zA-Z]+)\\b`, 'g')
28-2927for (const componentFile of componentFiles) {
3028try {
3129const content = await readFile(componentFile, 'utf-8')
@@ -100,7 +98,9 @@ async function detectUsedComponents(
10098// Pattern to match:
10199// - <UButton in templates
102100// - UButton in script (imports, usage)
103-const componentPattern = new RegExp(`<${prefix}([A-Z][a-zA-Z]+)|\\b${prefix}([A-Z][a-zA-Z]+)\\b`, 'g')
101+// - <LazyUButton (lazy components)
102+// - LazyUButton in script
103+const componentPattern = new RegExp(`<(?:Lazy)?${prefix}([A-Z][a-zA-Z]+)|\\b(?:Lazy)?${prefix}([A-Z][a-zA-Z]+)\\b`, 'g')
104104105105for (const file of appFiles) {
106106try {
@@ -124,7 +124,7 @@ async function detectUsedComponents(
124124}
125125126126// Build dependency graph of components
127-const dependencyGraph = await buildComponentDependencyGraph(componentDir, prefix)
127+const dependencyGraph = await buildComponentDependencyGraph(componentDir, componentPattern)
128128129129// Resolve all dependencies for detected components
130130const allComponents = new Set<string>()