@idealyst/tooling 1.2.25 → 1.2.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/vite-plugin.ts","../src/analyzer/component-analyzer.ts","../src/analyzer/theme-analyzer.ts"],"sourcesContent":["/**\n * Idealyst Docs Vite Plugin\n *\n * Generates a component registry at build time by analyzing TypeScript source.\n * Replaces placeholder exports from @idealyst/tooling with actual generated values.\n *\n * Usage:\n * ```ts\n * // vite.config.ts\n * import { idealystDocsPlugin } from '@idealyst/tooling';\n *\n * export default defineConfig({\n * plugins: [\n * idealystDocsPlugin({\n * componentPaths: ['../../packages/components/src'],\n * themePath: '../../packages/theme/src/lightTheme.ts',\n * }),\n * ],\n * });\n * ```\n *\n * Then in your app:\n * ```ts\n * import { componentRegistry, componentNames, getComponentsByCategory } from '@idealyst/tooling';\n * ```\n */\n\nimport type { Plugin } from 'vite';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { analyzeComponents } from './analyzer';\nimport type { IdealystDocsPluginOptions, ComponentRegistry } from './analyzer/types';\n\n/**\n * Create the Idealyst Docs Vite plugin.\n */\nexport function idealystDocsPlugin(options: IdealystDocsPluginOptions): Plugin {\n let registry: ComponentRegistry | null = null;\n\n const { debug = false, output, outputPath } = options;\n\n const log = (...args: any[]) => {\n if (debug) console.log('[idealyst-docs]', ...args);\n };\n\n /**\n * Generate the registry by analyzing components.\n */\n function generateRegistry(): ComponentRegistry {\n log('Generating component registry...');\n log('Component paths:', options.componentPaths);\n log('Theme path:', options.themePath);\n\n try {\n registry = analyzeComponents(options);\n log(`Generated registry with ${Object.keys(registry).length} components`);\n if (debug) {\n log('Components found:', Object.keys(registry));\n }\n\n // Optionally write to file\n if (output === 'file' && outputPath) {\n const outputDir = path.dirname(outputPath);\n if (!fs.existsSync(outputDir)) {\n fs.mkdirSync(outputDir, { recursive: true });\n }\n fs.writeFileSync(\n outputPath,\n `// Auto-generated by @idealyst/tooling - DO NOT EDIT\\n` +\n `export const componentRegistry = ${JSON.stringify(registry, null, 2)} as const;\\n`\n );\n log(`Wrote registry to ${outputPath}`);\n }\n\n return registry;\n } catch (error) {\n console.error('[idealyst-docs] Error generating registry:', error);\n return {};\n }\n }\n\n return {\n name: 'idealyst-docs',\n\n // Transform @idealyst/tooling to inject the actual registry\n transform(code, id) {\n // Check if this is the tooling package's index file\n const isToolingIndex = id.includes('@idealyst/tooling') && id.endsWith('index.ts');\n const isToolingSrc = id.includes('/packages/tooling/src/index.ts');\n\n if (isToolingIndex || isToolingSrc) {\n console.log(`[idealyst-docs] Transforming tooling index: ${id}`);\n\n if (!registry) {\n registry = generateRegistry();\n }\n\n // Replace the placeholder exports with actual values\n let transformed = code;\n\n // Replace: export const componentRegistry = {};\n // Note: TypeScript types are stripped before transform, so we match JS not TS\n transformed = transformed.replace(\n /export const componentRegistry\\s*=\\s*\\{\\s*\\};?/,\n `export const componentRegistry = ${JSON.stringify(registry, null, 2)};`\n );\n\n log(`Code transformed: ${code !== transformed}`);\n\n // Replace: export const componentNames = [];\n // Note: TypeScript types are stripped before transform\n transformed = transformed.replace(\n /export const componentNames\\s*=\\s*\\[\\s*\\];?/,\n `export const componentNames = ${JSON.stringify(Object.keys(registry))};`\n );\n\n // Replace getComponentsByCategory with actual implementation that uses the real registry\n // Match JS version (no type annotations)\n transformed = transformed.replace(\n /export function getComponentsByCategory\\(category\\)\\s*\\{[\\s\\S]*?^\\}/m,\n `export function getComponentsByCategory(category) {\n return Object.entries(componentRegistry)\n .filter(([_, def]) => def.category === category)\n .map(([name]) => name);\n}`\n );\n\n // Replace getPropConfig with actual implementation\n // Match JS version (no type annotations)\n transformed = transformed.replace(\n /export function getPropConfig\\(componentName\\)\\s*\\{[\\s\\S]*?^\\}/m,\n `export function getPropConfig(componentName) {\n const def = componentRegistry[componentName];\n if (!def) return {};\n return Object.entries(def.props).reduce((acc, [key, prop]) => {\n if (prop.values && prop.values.length > 0) {\n acc[key] = { type: 'select', options: prop.values, default: prop.default };\n } else if (prop.type === 'boolean') {\n acc[key] = { type: 'boolean', default: prop.default ?? false };\n } else if (prop.type === 'string') {\n acc[key] = { type: 'text', default: prop.default ?? '' };\n } else if (prop.type === 'number') {\n acc[key] = { type: 'number', default: prop.default ?? 0 };\n }\n return acc;\n }, {});\n}`\n );\n\n return {\n code: transformed,\n map: null,\n };\n }\n\n return null;\n },\n\n // Regenerate on component file changes\n handleHotUpdate({ file, server }) {\n // Check if the changed file is a component file\n const isComponentFile =\n options.componentPaths.some(p => file.includes(path.resolve(p))) &&\n (file.endsWith('.ts') || file.endsWith('.tsx'));\n\n // Check if the changed file is the theme file\n const isThemeFile = file.includes(path.resolve(options.themePath));\n\n if (isComponentFile || isThemeFile) {\n log(`File changed: ${file}, regenerating registry...`);\n\n // Clear cached registry\n registry = null;\n\n // Invalidate the tooling module to trigger re-transform\n const toolingMods = Array.from(server.moduleGraph.idToModuleMap.values())\n .filter(m => m.id && (m.id.includes('@idealyst/tooling') || m.id.includes('/packages/tooling/src/index')));\n\n toolingMods.forEach(m => server.moduleGraph.invalidateModule(m));\n\n if (toolingMods.length > 0) {\n return toolingMods;\n }\n }\n },\n\n // Generate on build\n buildStart() {\n registry = generateRegistry();\n },\n };\n}\n\n/**\n * Standalone function to generate registry (for MCP server or CLI).\n */\nexport function generateComponentRegistry(options: IdealystDocsPluginOptions): ComponentRegistry {\n return analyzeComponents(options);\n}\n","/**\n * Component Analyzer - Extracts component prop definitions using TypeScript Compiler API.\n *\n * Analyzes:\n * - types.ts files for prop interfaces\n * - JSDoc comments for descriptions\n * - Static .description properties on components\n * - Theme-derived types (Intent, Size) resolved to actual values\n */\n\nimport * as ts from 'typescript';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type {\n ComponentRegistry,\n ComponentDefinition,\n PropDefinition,\n ComponentAnalyzerOptions,\n ThemeValues,\n ComponentCategory,\n SampleProps,\n} from './types';\nimport { analyzeTheme } from './theme-analyzer';\n\n/**\n * Analyze components and generate a registry.\n */\nexport function analyzeComponents(options: ComponentAnalyzerOptions): ComponentRegistry {\n const { componentPaths, themePath, include, exclude, includeInternal = false } = options;\n\n const registry: ComponentRegistry = {};\n\n // First, analyze the theme to get valid values\n const themeValues = analyzeTheme(themePath, false);\n\n // Scan each component path\n for (const componentPath of componentPaths) {\n const resolvedPath = path.resolve(componentPath);\n\n if (!fs.existsSync(resolvedPath)) {\n console.warn(`[component-analyzer] Path not found: ${resolvedPath}`);\n continue;\n }\n\n // Find all component directories (those with index.ts or types.ts)\n const componentDirs = findComponentDirs(resolvedPath);\n\n for (const dir of componentDirs) {\n const componentName = path.basename(dir);\n\n // Apply include/exclude filters\n if (include && !include.includes(componentName)) continue;\n if (exclude && exclude.includes(componentName)) continue;\n if (!includeInternal && componentName.startsWith('_')) continue;\n\n const definition = analyzeComponentDir(dir, componentName, themeValues);\n if (definition) {\n registry[componentName] = definition;\n }\n }\n }\n\n return registry;\n}\n\n/**\n * Find all component directories in a path.\n */\nfunction findComponentDirs(basePath: string): string[] {\n const dirs: string[] = [];\n\n const entries = fs.readdirSync(basePath, { withFileTypes: true });\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n\n const dirPath = path.join(basePath, entry.name);\n\n // Check if it's a component directory (has index.ts or types.ts)\n const hasIndex = fs.existsSync(path.join(dirPath, 'index.ts'));\n const hasTypes = fs.existsSync(path.join(dirPath, 'types.ts'));\n\n if (hasIndex || hasTypes) {\n dirs.push(dirPath);\n }\n }\n\n return dirs;\n}\n\n/**\n * Analyze a single component directory.\n */\nfunction analyzeComponentDir(\n dir: string,\n componentName: string,\n themeValues: ThemeValues\n): ComponentDefinition | null {\n // Find all TypeScript files in the component directory\n const tsFiles = fs.readdirSync(dir)\n .filter(f => f.endsWith('.ts') || f.endsWith('.tsx'))\n .map(f => path.join(dir, f));\n\n if (tsFiles.length === 0) {\n return null;\n }\n\n // Create TypeScript program with all files\n const program = ts.createProgram(tsFiles, {\n target: ts.ScriptTarget.ES2020,\n module: ts.ModuleKind.ESNext,\n jsx: ts.JsxEmit.React,\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n });\n\n const typeChecker = program.getTypeChecker();\n\n // Search all files for the props interface\n const propsInterfaceName = `${componentName}Props`;\n const altNames = [`${componentName}ComponentProps`, 'Props'];\n let propsInterface: ts.InterfaceDeclaration | ts.TypeAliasDeclaration | null = null;\n let interfaceDescription: string | undefined;\n\n // Search each file for the props interface\n for (const filePath of tsFiles) {\n const sourceFile = program.getSourceFile(filePath);\n if (!sourceFile) continue;\n\n // First try the main props interface name\n ts.forEachChild(sourceFile, (node) => {\n if (ts.isInterfaceDeclaration(node) && node.name.text === propsInterfaceName) {\n propsInterface = node;\n interfaceDescription = getJSDocDescription(node);\n }\n if (ts.isTypeAliasDeclaration(node) && node.name.text === propsInterfaceName) {\n propsInterface = node;\n interfaceDescription = getJSDocDescription(node);\n }\n });\n\n if (propsInterface) break;\n }\n\n // If not found, try alternate naming conventions\n if (!propsInterface) {\n for (const altName of altNames) {\n for (const filePath of tsFiles) {\n const sourceFile = program.getSourceFile(filePath);\n if (!sourceFile) continue;\n\n ts.forEachChild(sourceFile, (node) => {\n if ((ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node)) && node.name.text === altName) {\n propsInterface = node;\n interfaceDescription = getJSDocDescription(node);\n }\n });\n\n if (propsInterface) break;\n }\n if (propsInterface) break;\n }\n }\n\n // If we couldn't find a props interface, skip this component\n if (!propsInterface) {\n return null;\n }\n\n // Extract props\n const props: Record<string, PropDefinition> = {};\n\n if (propsInterface) {\n const type = typeChecker.getTypeAtLocation(propsInterface);\n const properties = type.getProperties();\n\n for (const prop of properties) {\n const propDef = analyzeProperty(prop, typeChecker, themeValues);\n if (propDef && !isInternalProp(propDef.name)) {\n props[propDef.name] = propDef;\n }\n }\n }\n\n // Get description from the props interface JSDoc (single source of truth in types.ts)\n const description = interfaceDescription;\n\n // Determine category\n const category = inferCategory(componentName);\n\n // Look for docs.ts to extract sample props\n const sampleProps = extractSampleProps(dir);\n\n return {\n name: componentName,\n description,\n props,\n category,\n filePath: path.relative(process.cwd(), dir),\n sampleProps,\n };\n}\n\n/**\n * Extract sample props from docs.ts file if it exists.\n * The docs.ts file should export a `sampleProps` object.\n */\nfunction extractSampleProps(dir: string): SampleProps | undefined {\n const docsPath = path.join(dir, 'docs.ts');\n\n if (!fs.existsSync(docsPath)) {\n return undefined;\n }\n\n try {\n const content = fs.readFileSync(docsPath, 'utf-8');\n\n // Create a simple TypeScript program to extract the sampleProps export\n const sourceFile = ts.createSourceFile(\n 'docs.ts',\n content,\n ts.ScriptTarget.ES2020,\n true,\n ts.ScriptKind.TS\n );\n\n let samplePropsNode: ts.ObjectLiteralExpression | null = null;\n\n // Find the sampleProps export\n ts.forEachChild(sourceFile, (node) => {\n // Handle: export const sampleProps = { ... }\n if (ts.isVariableStatement(node)) {\n const isExported = node.modifiers?.some(m => m.kind === ts.SyntaxKind.ExportKeyword);\n if (isExported) {\n for (const decl of node.declarationList.declarations) {\n if (ts.isIdentifier(decl.name) && decl.name.text === 'sampleProps' && decl.initializer) {\n if (ts.isObjectLiteralExpression(decl.initializer)) {\n samplePropsNode = decl.initializer;\n }\n }\n }\n }\n }\n });\n\n if (!samplePropsNode) {\n return undefined;\n }\n\n // Extract the object literal as JSON-compatible structure\n // This is a simplified extraction - it handles basic literals\n const result: SampleProps = {};\n const propsNode = samplePropsNode as ts.ObjectLiteralExpression;\n\n for (const prop of propsNode.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {\n const propName = prop.name.text;\n\n if (propName === 'props' && ts.isObjectLiteralExpression(prop.initializer)) {\n result.props = extractObjectLiteral(prop.initializer, content);\n } else if (propName === 'children') {\n // For children, we store the raw source text\n result.children = prop.initializer.getText(sourceFile);\n } else if (propName === 'state' && ts.isObjectLiteralExpression(prop.initializer)) {\n // Extract state configuration for controlled components\n result.state = extractObjectLiteral(prop.initializer, content);\n }\n }\n }\n\n return Object.keys(result).length > 0 ? result : undefined;\n } catch (e) {\n console.warn(`[component-analyzer] Error reading docs.ts in ${dir}:`, e);\n return undefined;\n }\n}\n\n/**\n * Extract an object literal to a plain object (for simple literal values).\n */\nfunction extractObjectLiteral(node: ts.ObjectLiteralExpression, sourceContent: string): Record<string, any> {\n const result: Record<string, any> = {};\n\n for (const prop of node.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {\n const key = prop.name.text;\n const init = prop.initializer;\n\n if (ts.isStringLiteral(init)) {\n result[key] = init.text;\n } else if (ts.isNumericLiteral(init)) {\n result[key] = Number(init.text);\n } else if (init.kind === ts.SyntaxKind.TrueKeyword) {\n result[key] = true;\n } else if (init.kind === ts.SyntaxKind.FalseKeyword) {\n result[key] = false;\n } else if (ts.isArrayLiteralExpression(init)) {\n result[key] = extractArrayLiteral(init, sourceContent);\n } else if (ts.isObjectLiteralExpression(init)) {\n result[key] = extractObjectLiteral(init, sourceContent);\n } else {\n // For complex expressions (JSX, functions), store the raw source\n result[key] = init.getText();\n }\n }\n }\n\n return result;\n}\n\n/**\n * Extract an array literal to a plain array.\n */\nfunction extractArrayLiteral(node: ts.ArrayLiteralExpression, sourceContent: string): any[] {\n const result: any[] = [];\n\n for (const element of node.elements) {\n if (ts.isStringLiteral(element)) {\n result.push(element.text);\n } else if (ts.isNumericLiteral(element)) {\n result.push(Number(element.text));\n } else if (element.kind === ts.SyntaxKind.TrueKeyword) {\n result.push(true);\n } else if (element.kind === ts.SyntaxKind.FalseKeyword) {\n result.push(false);\n } else if (ts.isObjectLiteralExpression(element)) {\n result.push(extractObjectLiteral(element, sourceContent));\n } else if (ts.isArrayLiteralExpression(element)) {\n result.push(extractArrayLiteral(element, sourceContent));\n } else {\n // For complex expressions, store raw source\n result.push(element.getText());\n }\n }\n\n return result;\n}\n\n/**\n * Analyze a single property symbol.\n */\nfunction analyzeProperty(\n symbol: ts.Symbol,\n typeChecker: ts.TypeChecker,\n themeValues: ThemeValues\n): PropDefinition | null {\n const name = symbol.getName();\n const declarations = symbol.getDeclarations();\n\n if (!declarations || declarations.length === 0) return null;\n\n const declaration = declarations[0];\n const type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration);\n const typeString = typeChecker.typeToString(type);\n\n // Get JSDoc description\n const description = ts.displayPartsToString(symbol.getDocumentationComment(typeChecker)) || undefined;\n\n // Check if required\n const required = !(symbol.flags & ts.SymbolFlags.Optional);\n\n // Extract values for union types / theme types\n const values = extractPropValues(type, typeString, typeChecker, themeValues);\n\n // Extract default value (from JSDoc @default tag)\n const defaultValue = extractDefaultValue(symbol);\n\n return {\n name,\n type: simplifyTypeName(typeString),\n values: values.length > 0 ? values : undefined,\n default: defaultValue,\n description,\n required,\n };\n}\n\n/**\n * Extract valid values for a prop type.\n */\nfunction extractPropValues(\n type: ts.Type,\n typeString: string,\n _typeChecker: ts.TypeChecker,\n themeValues: ThemeValues\n): string[] {\n // Handle theme-derived types\n if (typeString === 'Intent' || typeString.includes('Intent')) {\n return themeValues.intents;\n }\n if (typeString === 'Size' || typeString.includes('Size')) {\n // Return generic sizes - most components use the same keys\n return ['xs', 'sm', 'md', 'lg', 'xl'];\n }\n\n // Handle union types\n if (type.isUnion()) {\n const values: string[] = [];\n for (const unionType of type.types) {\n if (unionType.isStringLiteral()) {\n values.push(unionType.value);\n } else if ((unionType as any).intrinsicName === 'true') {\n values.push('true');\n } else if ((unionType as any).intrinsicName === 'false') {\n values.push('false');\n }\n }\n if (values.length > 0) return values;\n }\n\n // Handle boolean\n if (typeString === 'boolean') {\n return ['true', 'false'];\n }\n\n return [];\n}\n\n/**\n * Extract default value from JSDoc @default tag.\n */\nfunction extractDefaultValue(symbol: ts.Symbol): string | number | boolean | undefined {\n const tags = symbol.getJsDocTags();\n for (const tag of tags) {\n if (tag.name === 'default' && tag.text) {\n const value = ts.displayPartsToString(tag.text);\n // Try to parse as JSON\n try {\n return JSON.parse(value);\n } catch {\n return value;\n }\n }\n }\n return undefined;\n}\n\n/**\n * Get JSDoc description from a node.\n */\nfunction getJSDocDescription(node: ts.Node): string | undefined {\n const jsDocs = (node as any).jsDoc as ts.JSDoc[] | undefined;\n if (!jsDocs || jsDocs.length === 0) return undefined;\n\n const firstDoc = jsDocs[0];\n if (firstDoc.comment) {\n if (typeof firstDoc.comment === 'string') {\n return firstDoc.comment;\n }\n // Handle NodeArray of JSDocComment\n return (firstDoc.comment as ts.NodeArray<ts.JSDocComment>)\n .map(c => (c as any).text || '')\n .join('');\n }\n return undefined;\n}\n\n/**\n * Simplify type names for display.\n */\nfunction simplifyTypeName(typeString: string): string {\n // Remove import paths\n typeString = typeString.replace(/import\\([^)]+\\)\\./g, '');\n\n // Simplify common complex types\n if (typeString.includes('ReactNode')) return 'ReactNode';\n if (typeString.includes('StyleProp')) return 'Style';\n\n return typeString;\n}\n\n/**\n * Check if a prop should be excluded (internal/inherited).\n */\nfunction isInternalProp(name: string): boolean {\n const internalProps = [\n 'ref',\n 'key',\n 'children',\n 'style',\n 'testID',\n 'nativeID',\n 'accessible',\n 'accessibilityActions',\n 'accessibilityComponentType',\n 'accessibilityElementsHidden',\n 'accessibilityHint',\n 'accessibilityIgnoresInvertColors',\n 'accessibilityLabel',\n 'accessibilityLabelledBy',\n 'accessibilityLanguage',\n 'accessibilityLiveRegion',\n 'accessibilityRole',\n 'accessibilityState',\n 'accessibilityTraits',\n 'accessibilityValue',\n 'accessibilityViewIsModal',\n 'collapsable',\n 'focusable',\n 'hasTVPreferredFocus',\n 'hitSlop',\n 'importantForAccessibility',\n 'needsOffscreenAlphaCompositing',\n 'onAccessibilityAction',\n 'onAccessibilityEscape',\n 'onAccessibilityTap',\n 'onLayout',\n 'onMagicTap',\n 'onMoveShouldSetResponder',\n 'onMoveShouldSetResponderCapture',\n 'onResponderEnd',\n 'onResponderGrant',\n 'onResponderMove',\n 'onResponderReject',\n 'onResponderRelease',\n 'onResponderStart',\n 'onResponderTerminate',\n 'onResponderTerminationRequest',\n 'onStartShouldSetResponder',\n 'onStartShouldSetResponderCapture',\n 'pointerEvents',\n 'removeClippedSubviews',\n 'renderToHardwareTextureAndroid',\n 'shouldRasterizeIOS',\n 'tvParallaxMagnification',\n 'tvParallaxProperties',\n 'tvParallaxShiftDistanceX',\n 'tvParallaxShiftDistanceY',\n 'tvParallaxTiltAngle',\n ];\n\n return internalProps.includes(name) || name.startsWith('accessibility');\n}\n\n/**\n * Infer component category from name.\n */\nfunction inferCategory(componentName: string): ComponentCategory {\n const formComponents = ['Button', 'Input', 'Checkbox', 'Select', 'Switch', 'RadioButton', 'Slider', 'TextArea'];\n const displayComponents = ['Text', 'Card', 'Badge', 'Chip', 'Avatar', 'Icon', 'Skeleton', 'Alert', 'Tooltip'];\n const layoutComponents = ['View', 'Screen', 'Divider'];\n const navigationComponents = ['TabBar', 'Breadcrumb', 'Menu', 'List', 'Link'];\n const overlayComponents = ['Dialog', 'Popover', 'Modal'];\n const dataComponents = ['Table', 'Progress', 'Accordion'];\n\n if (formComponents.includes(componentName)) return 'form';\n if (displayComponents.includes(componentName)) return 'display';\n if (layoutComponents.includes(componentName)) return 'layout';\n if (navigationComponents.includes(componentName)) return 'navigation';\n if (overlayComponents.includes(componentName)) return 'overlay';\n if (dataComponents.includes(componentName)) return 'data';\n\n return 'display'; // Default\n}\n","/**\n * Theme Analyzer - Extracts theme keys by statically analyzing theme files.\n *\n * Uses TypeScript Compiler API to trace the declarative builder API:\n * - createTheme() / fromTheme(base)\n * - .addIntent('name', {...})\n * - .addRadius('name', value)\n * - .addShadow('name', {...})\n * - .setSizes({ button: { xs: {}, sm: {}, ... }, ... })\n * - .build()\n */\n\nimport * as ts from 'typescript';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { ThemeValues } from './types';\n\ninterface AnalyzerContext {\n program: ts.Program;\n typeChecker: ts.TypeChecker;\n verbose: boolean;\n}\n\n/**\n * Extract theme values from a theme file.\n */\nexport function analyzeTheme(themePath: string, verbose = false): ThemeValues {\n const resolvedPath = path.resolve(themePath);\n\n if (!fs.existsSync(resolvedPath)) {\n throw new Error(`Theme file not found: ${resolvedPath}`);\n }\n\n const log = (...args: any[]) => {\n if (verbose) console.log('[theme-analyzer]', ...args);\n };\n\n log('Analyzing theme file:', resolvedPath);\n\n // Create a TypeScript program\n const program = ts.createProgram([resolvedPath], {\n target: ts.ScriptTarget.ES2020,\n module: ts.ModuleKind.ESNext,\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n allowSyntheticDefaultImports: true,\n });\n\n const sourceFile = program.getSourceFile(resolvedPath);\n if (!sourceFile) {\n throw new Error(`Failed to parse theme file: ${resolvedPath}`);\n }\n\n const ctx: AnalyzerContext = {\n program,\n typeChecker: program.getTypeChecker(),\n verbose,\n };\n\n const values: ThemeValues = {\n intents: [],\n sizes: {},\n radii: [],\n shadows: [],\n breakpoints: [],\n typography: [],\n surfaceColors: [],\n textColors: [],\n borderColors: [],\n };\n\n // Track imports for base theme resolution\n const imports = new Map<string, { source: string; imported: string }>();\n\n // First pass: collect imports\n ts.forEachChild(sourceFile, (node) => {\n if (ts.isImportDeclaration(node)) {\n const source = (node.moduleSpecifier as ts.StringLiteral).text;\n const clause = node.importClause;\n if (clause?.namedBindings && ts.isNamedImports(clause.namedBindings)) {\n for (const element of clause.namedBindings.elements) {\n const localName = element.name.text;\n const importedName = element.propertyName?.text ?? localName;\n imports.set(localName, { source, imported: importedName });\n }\n }\n }\n });\n\n /**\n * Process a builder method call chain.\n */\n function processBuilderChain(node: ts.Node): void {\n if (!ts.isCallExpression(node)) return;\n\n // Check if this is a .build() call\n if (ts.isPropertyAccessExpression(node.expression)) {\n const methodName = node.expression.name.text;\n\n if (methodName === 'build') {\n // Trace the full chain\n const calls = traceBuilderCalls(node);\n processCalls(calls);\n return;\n }\n }\n\n // Recurse into children\n ts.forEachChild(node, processBuilderChain);\n }\n\n interface BuilderCall {\n method: string;\n args: ts.NodeArray<ts.Expression>;\n }\n\n /**\n * Trace a builder chain backwards to collect all method calls.\n */\n function traceBuilderCalls(node: ts.CallExpression, calls: BuilderCall[] = []): BuilderCall[] {\n if (!ts.isPropertyAccessExpression(node.expression)) {\n // Check for createTheme() or fromTheme()\n if (ts.isCallExpression(node) && ts.isIdentifier(node.expression)) {\n const fnName = node.expression.text;\n if (fnName === 'fromTheme' && node.arguments.length > 0) {\n const arg = node.arguments[0];\n if (ts.isIdentifier(arg)) {\n // Analyze base theme\n analyzeBaseTheme(arg.text, imports, values, ctx);\n }\n }\n }\n return calls;\n }\n\n const methodName = node.expression.name.text;\n calls.unshift({ method: methodName, args: node.arguments });\n\n // Recurse into the object being called\n const obj = node.expression.expression;\n if (ts.isCallExpression(obj)) {\n return traceBuilderCalls(obj, calls);\n }\n\n return calls;\n }\n\n /**\n * Process the collected builder method calls.\n */\n function processCalls(calls: BuilderCall[]): void {\n log('Processing', calls.length, 'builder method calls');\n\n for (const { method, args } of calls) {\n switch (method) {\n case 'addIntent': {\n const name = getStringValue(args[0]);\n if (name && !values.intents.includes(name)) {\n values.intents.push(name);\n log(' Found intent:', name);\n }\n break;\n }\n case 'addRadius': {\n const name = getStringValue(args[0]);\n if (name && !values.radii.includes(name)) {\n values.radii.push(name);\n log(' Found radius:', name);\n }\n break;\n }\n case 'addShadow': {\n const name = getStringValue(args[0]);\n if (name && !values.shadows.includes(name)) {\n values.shadows.push(name);\n log(' Found shadow:', name);\n }\n break;\n }\n case 'setSizes': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n for (const prop of args[0].properties) {\n if (ts.isPropertyAssignment(prop)) {\n const componentName = getPropertyName(prop.name);\n if (componentName && ts.isObjectLiteralExpression(prop.initializer)) {\n values.sizes[componentName] = getObjectKeys(prop.initializer);\n log(' Found sizes for', componentName + ':', values.sizes[componentName]);\n }\n }\n }\n }\n break;\n }\n case 'setBreakpoints': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n values.breakpoints = getObjectKeys(args[0]);\n log(' Found breakpoints:', values.breakpoints);\n }\n break;\n }\n case 'setColors': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n for (const prop of args[0].properties) {\n if (ts.isPropertyAssignment(prop)) {\n const colorType = getPropertyName(prop.name);\n if (ts.isObjectLiteralExpression(prop.initializer)) {\n const keys = getObjectKeys(prop.initializer);\n switch (colorType) {\n case 'surface':\n values.surfaceColors = keys;\n log(' Found surface colors:', keys);\n break;\n case 'text':\n values.textColors = keys;\n log(' Found text colors:', keys);\n break;\n case 'border':\n values.borderColors = keys;\n log(' Found border colors:', keys);\n break;\n }\n }\n }\n }\n }\n break;\n }\n case 'build':\n // End of chain\n break;\n default:\n log(' Skipping unknown method:', method);\n }\n }\n }\n\n // Second pass: find and process builder chains\n ts.forEachChild(sourceFile, (node) => {\n // Handle variable declarations\n if (ts.isVariableStatement(node)) {\n for (const decl of node.declarationList.declarations) {\n if (decl.initializer) {\n processBuilderChain(decl.initializer);\n }\n }\n }\n // Handle export statements\n if (ts.isExportAssignment(node)) {\n processBuilderChain(node.expression);\n }\n });\n\n // Extract typography keys from sizes if present\n if (values.sizes['typography']) {\n values.typography = values.sizes['typography'];\n }\n\n log('Extracted theme values:', values);\n\n return values;\n}\n\n/**\n * Analyze a base theme file referenced by an import.\n */\nfunction analyzeBaseTheme(\n varName: string,\n imports: Map<string, { source: string; imported: string }>,\n values: ThemeValues,\n ctx: AnalyzerContext\n): void {\n const log = (...args: any[]) => {\n if (ctx.verbose) console.log('[theme-analyzer]', ...args);\n };\n\n const importInfo = imports.get(varName);\n if (!importInfo) {\n log('Could not find import for base theme:', varName);\n return;\n }\n\n log('Base theme', varName, 'imported from', importInfo.source);\n\n // For @idealyst/theme imports, we know the structure\n if (importInfo.source === '@idealyst/theme' || importInfo.source.includes('@idealyst/theme')) {\n // Use default light theme values\n const defaultValues = getDefaultThemeValues();\n mergeThemeValues(values, defaultValues);\n log('Using default @idealyst/theme values');\n return;\n }\n\n // For relative imports, try to resolve and analyze\n // (This is simplified - full implementation would recursively analyze)\n log('Skipping base theme analysis for:', importInfo.source);\n}\n\n/**\n * Get default theme values from @idealyst/theme.\n */\nfunction getDefaultThemeValues(): ThemeValues {\n return {\n intents: ['primary', 'success', 'error', 'warning', 'neutral', 'info'],\n sizes: {\n button: ['xs', 'sm', 'md', 'lg', 'xl'],\n chip: ['xs', 'sm', 'md', 'lg', 'xl'],\n badge: ['xs', 'sm', 'md', 'lg', 'xl'],\n icon: ['xs', 'sm', 'md', 'lg', 'xl'],\n input: ['xs', 'sm', 'md', 'lg', 'xl'],\n radioButton: ['xs', 'sm', 'md', 'lg', 'xl'],\n select: ['xs', 'sm', 'md', 'lg', 'xl'],\n slider: ['xs', 'sm', 'md', 'lg', 'xl'],\n switch: ['xs', 'sm', 'md', 'lg', 'xl'],\n textarea: ['xs', 'sm', 'md', 'lg', 'xl'],\n avatar: ['xs', 'sm', 'md', 'lg', 'xl'],\n progress: ['xs', 'sm', 'md', 'lg', 'xl'],\n accordion: ['xs', 'sm', 'md', 'lg', 'xl'],\n activityIndicator: ['xs', 'sm', 'md', 'lg', 'xl'],\n breadcrumb: ['xs', 'sm', 'md', 'lg', 'xl'],\n list: ['xs', 'sm', 'md', 'lg', 'xl'],\n menu: ['xs', 'sm', 'md', 'lg', 'xl'],\n text: ['xs', 'sm', 'md', 'lg', 'xl'],\n tabBar: ['xs', 'sm', 'md', 'lg', 'xl'],\n table: ['xs', 'sm', 'md', 'lg', 'xl'],\n tooltip: ['xs', 'sm', 'md', 'lg', 'xl'],\n view: ['xs', 'sm', 'md', 'lg', 'xl'],\n // Typography sizes for Text component's $typography iterator\n typography: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'subtitle1', 'subtitle2', 'body1', 'body2', 'caption'],\n },\n radii: ['none', 'xs', 'sm', 'md', 'lg', 'xl'],\n shadows: ['none', 'sm', 'md', 'lg', 'xl'],\n breakpoints: ['xs', 'sm', 'md', 'lg', 'xl'],\n typography: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'subtitle1', 'subtitle2', 'body1', 'body2', 'caption'],\n surfaceColors: ['screen', 'primary', 'secondary', 'tertiary', 'inverse', 'inverse-secondary', 'inverse-tertiary'],\n textColors: ['primary', 'secondary', 'tertiary', 'inverse', 'inverse-secondary', 'inverse-tertiary'],\n borderColors: ['primary', 'secondary', 'tertiary', 'disabled'],\n };\n}\n\n/**\n * Merge theme values, avoiding duplicates.\n */\nfunction mergeThemeValues(target: ThemeValues, source: ThemeValues): void {\n target.intents.push(...source.intents.filter(k => !target.intents.includes(k)));\n target.radii.push(...source.radii.filter(k => !target.radii.includes(k)));\n target.shadows.push(...source.shadows.filter(k => !target.shadows.includes(k)));\n target.breakpoints.push(...source.breakpoints.filter(k => !target.breakpoints.includes(k)));\n target.typography.push(...source.typography.filter(k => !target.typography.includes(k)));\n target.surfaceColors.push(...source.surfaceColors.filter(k => !target.surfaceColors.includes(k)));\n target.textColors.push(...source.textColors.filter(k => !target.textColors.includes(k)));\n target.borderColors.push(...source.borderColors.filter(k => !target.borderColors.includes(k)));\n\n for (const [comp, sizes] of Object.entries(source.sizes)) {\n if (!target.sizes[comp]) {\n target.sizes[comp] = sizes;\n }\n }\n}\n\n// Helper functions\n\nfunction getStringValue(node?: ts.Expression): string | null {\n if (!node) return null;\n if (ts.isStringLiteral(node)) return node.text;\n if (ts.isIdentifier(node)) return node.text;\n return null;\n}\n\nfunction getPropertyName(node: ts.PropertyName): string | null {\n if (ts.isIdentifier(node)) return node.text;\n if (ts.isStringLiteral(node)) return node.text;\n return null;\n}\n\nfunction getObjectKeys(node: ts.ObjectLiteralExpression): string[] {\n return node.properties\n .filter(ts.isPropertyAssignment)\n .map(prop => getPropertyName(prop.name))\n .filter((k): k is string => k !== null);\n}\n\n// ============================================================================\n// Babel Plugin Compatibility Layer\n// ============================================================================\n\n/**\n * Theme keys format expected by the Babel plugin.\n * This is a subset of ThemeValues for backwards compatibility.\n */\nexport interface BabelThemeKeys {\n intents: string[];\n sizes: Record<string, string[]>;\n radii: string[];\n shadows: string[];\n typography: string[];\n}\n\n// Cache for loadThemeKeys to avoid re-parsing\nlet themeKeysCache: BabelThemeKeys | null = null;\nlet themeLoadAttempted = false;\n\n/**\n * Load theme keys for the Babel plugin.\n * This is a compatibility wrapper around analyzeTheme() that:\n * - Provides caching (only parses once per build)\n * - Returns the subset of keys needed by the Babel plugin\n * - Handles path resolution based on babel opts\n *\n * @param opts - Babel plugin options (requires themePath)\n * @param rootDir - Root directory for path resolution\n * @param _babelTypes - Unused (kept for backwards compatibility)\n * @param verboseMode - Enable verbose logging\n */\nexport function loadThemeKeys(\n opts: { themePath?: string },\n rootDir: string,\n _babelTypes?: unknown,\n verboseMode = false\n): BabelThemeKeys {\n if (themeLoadAttempted && themeKeysCache) {\n return themeKeysCache;\n }\n themeLoadAttempted = true;\n\n const themePath = opts.themePath;\n\n if (!themePath) {\n throw new Error(\n '[idealyst-plugin] themePath is required!\\n' +\n 'Add it to your babel config:\\n' +\n ' [\"@idealyst/theme/plugin\", { themePath: \"./src/theme/styles.ts\" }]'\n );\n }\n\n // Resolve the path\n const resolvedPath = themePath.startsWith('.')\n ? path.resolve(rootDir, themePath)\n : themePath;\n\n if (verboseMode) {\n console.log('[idealyst-plugin] Analyzing theme file via @idealyst/tooling:', resolvedPath);\n }\n\n // Use the TypeScript-based analyzer\n const themeValues = analyzeTheme(resolvedPath, verboseMode);\n\n // Convert to Babel-compatible format (subset of ThemeValues)\n themeKeysCache = {\n intents: themeValues.intents,\n sizes: themeValues.sizes,\n radii: themeValues.radii,\n shadows: themeValues.shadows,\n typography: themeValues.typography,\n };\n\n if (verboseMode) {\n console.log('[idealyst-plugin] Extracted theme keys:');\n console.log(' intents:', themeKeysCache.intents);\n console.log(' radii:', themeKeysCache.radii);\n console.log(' shadows:', themeKeysCache.shadows);\n console.log(' sizes:');\n for (const [component, sizes] of Object.entries(themeKeysCache.sizes)) {\n console.log(` ${component}:`, sizes);\n }\n }\n\n return themeKeysCache;\n}\n\n/**\n * Reset the theme cache. Useful for testing or hot reload.\n */\nexport function resetThemeCache(): void {\n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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAgBF;AAEA,eAAO;AAAA,UACL,MAAM;AAAA,UACN,KAAK;AAAA,QACP;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AAAA;AAAA,IAGA,gBAAgB,EAAE,MAAM,OAAO,GAAG;AAEhC,YAAM,kBACJ,QAAQ,eAAe,KAAK,OAAK,KAAK,SAAc,cAAQ,CAAC,CAAC,CAAC,MAC9D,KAAK,SAAS,KAAK,KAAK,KAAK,SAAS,MAAM;AAG/C,YAAM,cAAc,KAAK,SAAc,cAAQ,QAAQ,SAAS,CAAC;AAEjE,UAAI,mBAAmB,aAAa;AAClC,YAAI,iBAAiB,IAAI,4BAA4B;AAGrD,mBAAW;AAGX,cAAM,cAAc,MAAM,KAAK,OAAO,YAAY,cAAc,OAAO,CAAC,EACrE,OAAO,OAAK,EAAE,OAAO,EAAE,GAAG,SAAS,mBAAmB,KAAK,EAAE,GAAG,SAAS,6BAA6B,EAAE;AAE3G,oBAAY,QAAQ,OAAK,OAAO,YAAY,iBAAiB,CAAC,CAAC;AAE/D,YAAI,YAAY,SAAS,GAAG;AAC1B,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA;AAAA,IAGA,aAAa;AACX,iBAAW,iBAAiB;AAAA,IAC9B;AAAA,EACF;AACF;AAKO,SAAS,0BAA0B,SAAuD;AAC/F,SAAO,kBAAkB,OAAO;AAClC;","names":["fs","path","ts","fs","path"]}
@@ -0,0 +1,40 @@
1
+ import { Plugin } from 'vite';
2
+ import { I as IdealystDocsPluginOptions, C as ComponentRegistry } from './types-CrlxbLFJ.cjs';
3
+
4
+ /**
5
+ * Idealyst Docs Vite Plugin
6
+ *
7
+ * Generates a component registry at build time by analyzing TypeScript source.
8
+ * Replaces placeholder exports from @idealyst/tooling with actual generated values.
9
+ *
10
+ * Usage:
11
+ * ```ts
12
+ * // vite.config.ts
13
+ * import { idealystDocsPlugin } from '@idealyst/tooling';
14
+ *
15
+ * export default defineConfig({
16
+ * plugins: [
17
+ * idealystDocsPlugin({
18
+ * componentPaths: ['../../packages/components/src'],
19
+ * themePath: '../../packages/theme/src/lightTheme.ts',
20
+ * }),
21
+ * ],
22
+ * });
23
+ * ```
24
+ *
25
+ * Then in your app:
26
+ * ```ts
27
+ * import { componentRegistry, componentNames, getComponentsByCategory } from '@idealyst/tooling';
28
+ * ```
29
+ */
30
+
31
+ /**
32
+ * Create the Idealyst Docs Vite plugin.
33
+ */
34
+ declare function idealystDocsPlugin(options: IdealystDocsPluginOptions): Plugin;
35
+ /**
36
+ * Standalone function to generate registry (for MCP server or CLI).
37
+ */
38
+ declare function generateComponentRegistry(options: IdealystDocsPluginOptions): ComponentRegistry;
39
+
40
+ export { generateComponentRegistry, idealystDocsPlugin };
@@ -239,7 +239,9 @@ function getDefaultThemeValues() {
239
239
  tabBar: ["xs", "sm", "md", "lg", "xl"],
240
240
  table: ["xs", "sm", "md", "lg", "xl"],
241
241
  tooltip: ["xs", "sm", "md", "lg", "xl"],
242
- view: ["xs", "sm", "md", "lg", "xl"]
242
+ view: ["xs", "sm", "md", "lg", "xl"],
243
+ // Typography sizes for Text component's $typography iterator
244
+ typography: ["h1", "h2", "h3", "h4", "h5", "h6", "subtitle1", "subtitle2", "body1", "body2", "caption"]
243
245
  },
244
246
  radii: ["none", "xs", "sm", "md", "lg", "xl"],
245
247
  shadows: ["none", "sm", "md", "lg", "xl"],
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/vite-plugin.ts","../src/analyzer/component-analyzer.ts","../src/analyzer/theme-analyzer.ts"],"sourcesContent":["/**\n * Idealyst Docs Vite Plugin\n *\n * Generates a component registry at build time by analyzing TypeScript source.\n * Replaces placeholder exports from @idealyst/tooling with actual generated values.\n *\n * Usage:\n * ```ts\n * // vite.config.ts\n * import { idealystDocsPlugin } from '@idealyst/tooling';\n *\n * export default defineConfig({\n * plugins: [\n * idealystDocsPlugin({\n * componentPaths: ['../../packages/components/src'],\n * themePath: '../../packages/theme/src/lightTheme.ts',\n * }),\n * ],\n * });\n * ```\n *\n * Then in your app:\n * ```ts\n * import { componentRegistry, componentNames, getComponentsByCategory } from '@idealyst/tooling';\n * ```\n */\n\nimport type { Plugin } from 'vite';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { analyzeComponents } from './analyzer';\nimport type { IdealystDocsPluginOptions, ComponentRegistry } from './analyzer/types';\n\n/**\n * Create the Idealyst Docs Vite plugin.\n */\nexport function idealystDocsPlugin(options: IdealystDocsPluginOptions): Plugin {\n let registry: ComponentRegistry | null = null;\n\n const { debug = false, output, outputPath } = options;\n\n const log = (...args: any[]) => {\n if (debug) console.log('[idealyst-docs]', ...args);\n };\n\n /**\n * Generate the registry by analyzing components.\n */\n function generateRegistry(): ComponentRegistry {\n log('Generating component registry...');\n log('Component paths:', options.componentPaths);\n log('Theme path:', options.themePath);\n\n try {\n registry = analyzeComponents(options);\n log(`Generated registry with ${Object.keys(registry).length} components`);\n if (debug) {\n log('Components found:', Object.keys(registry));\n }\n\n // Optionally write to file\n if (output === 'file' && outputPath) {\n const outputDir = path.dirname(outputPath);\n if (!fs.existsSync(outputDir)) {\n fs.mkdirSync(outputDir, { recursive: true });\n }\n fs.writeFileSync(\n outputPath,\n `// Auto-generated by @idealyst/tooling - DO NOT EDIT\\n` +\n `export const componentRegistry = ${JSON.stringify(registry, null, 2)} as const;\\n`\n );\n log(`Wrote registry to ${outputPath}`);\n }\n\n return registry;\n } catch (error) {\n console.error('[idealyst-docs] Error generating registry:', error);\n return {};\n }\n }\n\n return {\n name: 'idealyst-docs',\n\n // Transform @idealyst/tooling to inject the actual registry\n transform(code, id) {\n // Check if this is the tooling package's index file\n const isToolingIndex = id.includes('@idealyst/tooling') && id.endsWith('index.ts');\n const isToolingSrc = id.includes('/packages/tooling/src/index.ts');\n\n if (isToolingIndex || isToolingSrc) {\n console.log(`[idealyst-docs] Transforming tooling index: ${id}`);\n\n if (!registry) {\n registry = generateRegistry();\n }\n\n // Replace the placeholder exports with actual values\n let transformed = code;\n\n // Replace: export const componentRegistry = {};\n // Note: TypeScript types are stripped before transform, so we match JS not TS\n transformed = transformed.replace(\n /export const componentRegistry\\s*=\\s*\\{\\s*\\};?/,\n `export const componentRegistry = ${JSON.stringify(registry, null, 2)};`\n );\n\n log(`Code transformed: ${code !== transformed}`);\n\n // Replace: export const componentNames = [];\n // Note: TypeScript types are stripped before transform\n transformed = transformed.replace(\n /export const componentNames\\s*=\\s*\\[\\s*\\];?/,\n `export const componentNames = ${JSON.stringify(Object.keys(registry))};`\n );\n\n // Replace getComponentsByCategory with actual implementation that uses the real registry\n // Match JS version (no type annotations)\n transformed = transformed.replace(\n /export function getComponentsByCategory\\(category\\)\\s*\\{[\\s\\S]*?^\\}/m,\n `export function getComponentsByCategory(category) {\n return Object.entries(componentRegistry)\n .filter(([_, def]) => def.category === category)\n .map(([name]) => name);\n}`\n );\n\n // Replace getPropConfig with actual implementation\n // Match JS version (no type annotations)\n transformed = transformed.replace(\n /export function getPropConfig\\(componentName\\)\\s*\\{[\\s\\S]*?^\\}/m,\n `export function getPropConfig(componentName) {\n const def = componentRegistry[componentName];\n if (!def) return {};\n return Object.entries(def.props).reduce((acc, [key, prop]) => {\n if (prop.values && prop.values.length > 0) {\n acc[key] = { type: 'select', options: prop.values, default: prop.default };\n } else if (prop.type === 'boolean') {\n acc[key] = { type: 'boolean', default: prop.default ?? false };\n } else if (prop.type === 'string') {\n acc[key] = { type: 'text', default: prop.default ?? '' };\n } else if (prop.type === 'number') {\n acc[key] = { type: 'number', default: prop.default ?? 0 };\n }\n return acc;\n }, {});\n}`\n );\n\n return {\n code: transformed,\n map: null,\n };\n }\n\n return null;\n },\n\n // Regenerate on component file changes\n handleHotUpdate({ file, server }) {\n // Check if the changed file is a component file\n const isComponentFile =\n options.componentPaths.some(p => file.includes(path.resolve(p))) &&\n (file.endsWith('.ts') || file.endsWith('.tsx'));\n\n // Check if the changed file is the theme file\n const isThemeFile = file.includes(path.resolve(options.themePath));\n\n if (isComponentFile || isThemeFile) {\n log(`File changed: ${file}, regenerating registry...`);\n\n // Clear cached registry\n registry = null;\n\n // Invalidate the tooling module to trigger re-transform\n const toolingMods = Array.from(server.moduleGraph.idToModuleMap.values())\n .filter(m => m.id && (m.id.includes('@idealyst/tooling') || m.id.includes('/packages/tooling/src/index')));\n\n toolingMods.forEach(m => server.moduleGraph.invalidateModule(m));\n\n if (toolingMods.length > 0) {\n return toolingMods;\n }\n }\n },\n\n // Generate on build\n buildStart() {\n registry = generateRegistry();\n },\n };\n}\n\n/**\n * Standalone function to generate registry (for MCP server or CLI).\n */\nexport function generateComponentRegistry(options: IdealystDocsPluginOptions): ComponentRegistry {\n return analyzeComponents(options);\n}\n","/**\n * Component Analyzer - Extracts component prop definitions using TypeScript Compiler API.\n *\n * Analyzes:\n * - types.ts files for prop interfaces\n * - JSDoc comments for descriptions\n * - Static .description properties on components\n * - Theme-derived types (Intent, Size) resolved to actual values\n */\n\nimport * as ts from 'typescript';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type {\n ComponentRegistry,\n ComponentDefinition,\n PropDefinition,\n ComponentAnalyzerOptions,\n ThemeValues,\n ComponentCategory,\n SampleProps,\n} from './types';\nimport { analyzeTheme } from './theme-analyzer';\n\n/**\n * Analyze components and generate a registry.\n */\nexport function analyzeComponents(options: ComponentAnalyzerOptions): ComponentRegistry {\n const { componentPaths, themePath, include, exclude, includeInternal = false } = options;\n\n const registry: ComponentRegistry = {};\n\n // First, analyze the theme to get valid values\n const themeValues = analyzeTheme(themePath, false);\n\n // Scan each component path\n for (const componentPath of componentPaths) {\n const resolvedPath = path.resolve(componentPath);\n\n if (!fs.existsSync(resolvedPath)) {\n console.warn(`[component-analyzer] Path not found: ${resolvedPath}`);\n continue;\n }\n\n // Find all component directories (those with index.ts or types.ts)\n const componentDirs = findComponentDirs(resolvedPath);\n\n for (const dir of componentDirs) {\n const componentName = path.basename(dir);\n\n // Apply include/exclude filters\n if (include && !include.includes(componentName)) continue;\n if (exclude && exclude.includes(componentName)) continue;\n if (!includeInternal && componentName.startsWith('_')) continue;\n\n const definition = analyzeComponentDir(dir, componentName, themeValues);\n if (definition) {\n registry[componentName] = definition;\n }\n }\n }\n\n return registry;\n}\n\n/**\n * Find all component directories in a path.\n */\nfunction findComponentDirs(basePath: string): string[] {\n const dirs: string[] = [];\n\n const entries = fs.readdirSync(basePath, { withFileTypes: true });\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n\n const dirPath = path.join(basePath, entry.name);\n\n // Check if it's a component directory (has index.ts or types.ts)\n const hasIndex = fs.existsSync(path.join(dirPath, 'index.ts'));\n const hasTypes = fs.existsSync(path.join(dirPath, 'types.ts'));\n\n if (hasIndex || hasTypes) {\n dirs.push(dirPath);\n }\n }\n\n return dirs;\n}\n\n/**\n * Analyze a single component directory.\n */\nfunction analyzeComponentDir(\n dir: string,\n componentName: string,\n themeValues: ThemeValues\n): ComponentDefinition | null {\n // Find all TypeScript files in the component directory\n const tsFiles = fs.readdirSync(dir)\n .filter(f => f.endsWith('.ts') || f.endsWith('.tsx'))\n .map(f => path.join(dir, f));\n\n if (tsFiles.length === 0) {\n return null;\n }\n\n // Create TypeScript program with all files\n const program = ts.createProgram(tsFiles, {\n target: ts.ScriptTarget.ES2020,\n module: ts.ModuleKind.ESNext,\n jsx: ts.JsxEmit.React,\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n });\n\n const typeChecker = program.getTypeChecker();\n\n // Search all files for the props interface\n const propsInterfaceName = `${componentName}Props`;\n const altNames = [`${componentName}ComponentProps`, 'Props'];\n let propsInterface: ts.InterfaceDeclaration | ts.TypeAliasDeclaration | null = null;\n let interfaceDescription: string | undefined;\n\n // Search each file for the props interface\n for (const filePath of tsFiles) {\n const sourceFile = program.getSourceFile(filePath);\n if (!sourceFile) continue;\n\n // First try the main props interface name\n ts.forEachChild(sourceFile, (node) => {\n if (ts.isInterfaceDeclaration(node) && node.name.text === propsInterfaceName) {\n propsInterface = node;\n interfaceDescription = getJSDocDescription(node);\n }\n if (ts.isTypeAliasDeclaration(node) && node.name.text === propsInterfaceName) {\n propsInterface = node;\n interfaceDescription = getJSDocDescription(node);\n }\n });\n\n if (propsInterface) break;\n }\n\n // If not found, try alternate naming conventions\n if (!propsInterface) {\n for (const altName of altNames) {\n for (const filePath of tsFiles) {\n const sourceFile = program.getSourceFile(filePath);\n if (!sourceFile) continue;\n\n ts.forEachChild(sourceFile, (node) => {\n if ((ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node)) && node.name.text === altName) {\n propsInterface = node;\n interfaceDescription = getJSDocDescription(node);\n }\n });\n\n if (propsInterface) break;\n }\n if (propsInterface) break;\n }\n }\n\n // If we couldn't find a props interface, skip this component\n if (!propsInterface) {\n return null;\n }\n\n // Extract props\n const props: Record<string, PropDefinition> = {};\n\n if (propsInterface) {\n const type = typeChecker.getTypeAtLocation(propsInterface);\n const properties = type.getProperties();\n\n for (const prop of properties) {\n const propDef = analyzeProperty(prop, typeChecker, themeValues);\n if (propDef && !isInternalProp(propDef.name)) {\n props[propDef.name] = propDef;\n }\n }\n }\n\n // Get description from the props interface JSDoc (single source of truth in types.ts)\n const description = interfaceDescription;\n\n // Determine category\n const category = inferCategory(componentName);\n\n // Look for docs.ts to extract sample props\n const sampleProps = extractSampleProps(dir);\n\n return {\n name: componentName,\n description,\n props,\n category,\n filePath: path.relative(process.cwd(), dir),\n sampleProps,\n };\n}\n\n/**\n * Extract sample props from docs.ts file if it exists.\n * The docs.ts file should export a `sampleProps` object.\n */\nfunction extractSampleProps(dir: string): SampleProps | undefined {\n const docsPath = path.join(dir, 'docs.ts');\n\n if (!fs.existsSync(docsPath)) {\n return undefined;\n }\n\n try {\n const content = fs.readFileSync(docsPath, 'utf-8');\n\n // Create a simple TypeScript program to extract the sampleProps export\n const sourceFile = ts.createSourceFile(\n 'docs.ts',\n content,\n ts.ScriptTarget.ES2020,\n true,\n ts.ScriptKind.TS\n );\n\n let samplePropsNode: ts.ObjectLiteralExpression | null = null;\n\n // Find the sampleProps export\n ts.forEachChild(sourceFile, (node) => {\n // Handle: export const sampleProps = { ... }\n if (ts.isVariableStatement(node)) {\n const isExported = node.modifiers?.some(m => m.kind === ts.SyntaxKind.ExportKeyword);\n if (isExported) {\n for (const decl of node.declarationList.declarations) {\n if (ts.isIdentifier(decl.name) && decl.name.text === 'sampleProps' && decl.initializer) {\n if (ts.isObjectLiteralExpression(decl.initializer)) {\n samplePropsNode = decl.initializer;\n }\n }\n }\n }\n }\n });\n\n if (!samplePropsNode) {\n return undefined;\n }\n\n // Extract the object literal as JSON-compatible structure\n // This is a simplified extraction - it handles basic literals\n const result: SampleProps = {};\n const propsNode = samplePropsNode as ts.ObjectLiteralExpression;\n\n for (const prop of propsNode.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {\n const propName = prop.name.text;\n\n if (propName === 'props' && ts.isObjectLiteralExpression(prop.initializer)) {\n result.props = extractObjectLiteral(prop.initializer, content);\n } else if (propName === 'children') {\n // For children, we store the raw source text\n result.children = prop.initializer.getText(sourceFile);\n } else if (propName === 'state' && ts.isObjectLiteralExpression(prop.initializer)) {\n // Extract state configuration for controlled components\n result.state = extractObjectLiteral(prop.initializer, content);\n }\n }\n }\n\n return Object.keys(result).length > 0 ? result : undefined;\n } catch (e) {\n console.warn(`[component-analyzer] Error reading docs.ts in ${dir}:`, e);\n return undefined;\n }\n}\n\n/**\n * Extract an object literal to a plain object (for simple literal values).\n */\nfunction extractObjectLiteral(node: ts.ObjectLiteralExpression, sourceContent: string): Record<string, any> {\n const result: Record<string, any> = {};\n\n for (const prop of node.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {\n const key = prop.name.text;\n const init = prop.initializer;\n\n if (ts.isStringLiteral(init)) {\n result[key] = init.text;\n } else if (ts.isNumericLiteral(init)) {\n result[key] = Number(init.text);\n } else if (init.kind === ts.SyntaxKind.TrueKeyword) {\n result[key] = true;\n } else if (init.kind === ts.SyntaxKind.FalseKeyword) {\n result[key] = false;\n } else if (ts.isArrayLiteralExpression(init)) {\n result[key] = extractArrayLiteral(init, sourceContent);\n } else if (ts.isObjectLiteralExpression(init)) {\n result[key] = extractObjectLiteral(init, sourceContent);\n } else {\n // For complex expressions (JSX, functions), store the raw source\n result[key] = init.getText();\n }\n }\n }\n\n return result;\n}\n\n/**\n * Extract an array literal to a plain array.\n */\nfunction extractArrayLiteral(node: ts.ArrayLiteralExpression, sourceContent: string): any[] {\n const result: any[] = [];\n\n for (const element of node.elements) {\n if (ts.isStringLiteral(element)) {\n result.push(element.text);\n } else if (ts.isNumericLiteral(element)) {\n result.push(Number(element.text));\n } else if (element.kind === ts.SyntaxKind.TrueKeyword) {\n result.push(true);\n } else if (element.kind === ts.SyntaxKind.FalseKeyword) {\n result.push(false);\n } else if (ts.isObjectLiteralExpression(element)) {\n result.push(extractObjectLiteral(element, sourceContent));\n } else if (ts.isArrayLiteralExpression(element)) {\n result.push(extractArrayLiteral(element, sourceContent));\n } else {\n // For complex expressions, store raw source\n result.push(element.getText());\n }\n }\n\n return result;\n}\n\n/**\n * Analyze a single property symbol.\n */\nfunction analyzeProperty(\n symbol: ts.Symbol,\n typeChecker: ts.TypeChecker,\n themeValues: ThemeValues\n): PropDefinition | null {\n const name = symbol.getName();\n const declarations = symbol.getDeclarations();\n\n if (!declarations || declarations.length === 0) return null;\n\n const declaration = declarations[0];\n const type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration);\n const typeString = typeChecker.typeToString(type);\n\n // Get JSDoc description\n const description = ts.displayPartsToString(symbol.getDocumentationComment(typeChecker)) || undefined;\n\n // Check if required\n const required = !(symbol.flags & ts.SymbolFlags.Optional);\n\n // Extract values for union types / theme types\n const values = extractPropValues(type, typeString, typeChecker, themeValues);\n\n // Extract default value (from JSDoc @default tag)\n const defaultValue = extractDefaultValue(symbol);\n\n return {\n name,\n type: simplifyTypeName(typeString),\n values: values.length > 0 ? values : undefined,\n default: defaultValue,\n description,\n required,\n };\n}\n\n/**\n * Extract valid values for a prop type.\n */\nfunction extractPropValues(\n type: ts.Type,\n typeString: string,\n _typeChecker: ts.TypeChecker,\n themeValues: ThemeValues\n): string[] {\n // Handle theme-derived types\n if (typeString === 'Intent' || typeString.includes('Intent')) {\n return themeValues.intents;\n }\n if (typeString === 'Size' || typeString.includes('Size')) {\n // Return generic sizes - most components use the same keys\n return ['xs', 'sm', 'md', 'lg', 'xl'];\n }\n\n // Handle union types\n if (type.isUnion()) {\n const values: string[] = [];\n for (const unionType of type.types) {\n if (unionType.isStringLiteral()) {\n values.push(unionType.value);\n } else if ((unionType as any).intrinsicName === 'true') {\n values.push('true');\n } else if ((unionType as any).intrinsicName === 'false') {\n values.push('false');\n }\n }\n if (values.length > 0) return values;\n }\n\n // Handle boolean\n if (typeString === 'boolean') {\n return ['true', 'false'];\n }\n\n return [];\n}\n\n/**\n * Extract default value from JSDoc @default tag.\n */\nfunction extractDefaultValue(symbol: ts.Symbol): string | number | boolean | undefined {\n const tags = symbol.getJsDocTags();\n for (const tag of tags) {\n if (tag.name === 'default' && tag.text) {\n const value = ts.displayPartsToString(tag.text);\n // Try to parse as JSON\n try {\n return JSON.parse(value);\n } catch {\n return value;\n }\n }\n }\n return undefined;\n}\n\n/**\n * Get JSDoc description from a node.\n */\nfunction getJSDocDescription(node: ts.Node): string | undefined {\n const jsDocs = (node as any).jsDoc as ts.JSDoc[] | undefined;\n if (!jsDocs || jsDocs.length === 0) return undefined;\n\n const firstDoc = jsDocs[0];\n if (firstDoc.comment) {\n if (typeof firstDoc.comment === 'string') {\n return firstDoc.comment;\n }\n // Handle NodeArray of JSDocComment\n return (firstDoc.comment as ts.NodeArray<ts.JSDocComment>)\n .map(c => (c as any).text || '')\n .join('');\n }\n return undefined;\n}\n\n/**\n * Simplify type names for display.\n */\nfunction simplifyTypeName(typeString: string): string {\n // Remove import paths\n typeString = typeString.replace(/import\\([^)]+\\)\\./g, '');\n\n // Simplify common complex types\n if (typeString.includes('ReactNode')) return 'ReactNode';\n if (typeString.includes('StyleProp')) return 'Style';\n\n return typeString;\n}\n\n/**\n * Check if a prop should be excluded (internal/inherited).\n */\nfunction isInternalProp(name: string): boolean {\n const internalProps = [\n 'ref',\n 'key',\n 'children',\n 'style',\n 'testID',\n 'nativeID',\n 'accessible',\n 'accessibilityActions',\n 'accessibilityComponentType',\n 'accessibilityElementsHidden',\n 'accessibilityHint',\n 'accessibilityIgnoresInvertColors',\n 'accessibilityLabel',\n 'accessibilityLabelledBy',\n 'accessibilityLanguage',\n 'accessibilityLiveRegion',\n 'accessibilityRole',\n 'accessibilityState',\n 'accessibilityTraits',\n 'accessibilityValue',\n 'accessibilityViewIsModal',\n 'collapsable',\n 'focusable',\n 'hasTVPreferredFocus',\n 'hitSlop',\n 'importantForAccessibility',\n 'needsOffscreenAlphaCompositing',\n 'onAccessibilityAction',\n 'onAccessibilityEscape',\n 'onAccessibilityTap',\n 'onLayout',\n 'onMagicTap',\n 'onMoveShouldSetResponder',\n 'onMoveShouldSetResponderCapture',\n 'onResponderEnd',\n 'onResponderGrant',\n 'onResponderMove',\n 'onResponderReject',\n 'onResponderRelease',\n 'onResponderStart',\n 'onResponderTerminate',\n 'onResponderTerminationRequest',\n 'onStartShouldSetResponder',\n 'onStartShouldSetResponderCapture',\n 'pointerEvents',\n 'removeClippedSubviews',\n 'renderToHardwareTextureAndroid',\n 'shouldRasterizeIOS',\n 'tvParallaxMagnification',\n 'tvParallaxProperties',\n 'tvParallaxShiftDistanceX',\n 'tvParallaxShiftDistanceY',\n 'tvParallaxTiltAngle',\n ];\n\n return internalProps.includes(name) || name.startsWith('accessibility');\n}\n\n/**\n * Infer component category from name.\n */\nfunction inferCategory(componentName: string): ComponentCategory {\n const formComponents = ['Button', 'Input', 'Checkbox', 'Select', 'Switch', 'RadioButton', 'Slider', 'TextArea'];\n const displayComponents = ['Text', 'Card', 'Badge', 'Chip', 'Avatar', 'Icon', 'Skeleton', 'Alert', 'Tooltip'];\n const layoutComponents = ['View', 'Screen', 'Divider'];\n const navigationComponents = ['TabBar', 'Breadcrumb', 'Menu', 'List', 'Link'];\n const overlayComponents = ['Dialog', 'Popover', 'Modal'];\n const dataComponents = ['Table', 'Progress', 'Accordion'];\n\n if (formComponents.includes(componentName)) return 'form';\n if (displayComponents.includes(componentName)) return 'display';\n if (layoutComponents.includes(componentName)) return 'layout';\n if (navigationComponents.includes(componentName)) return 'navigation';\n if (overlayComponents.includes(componentName)) return 'overlay';\n if (dataComponents.includes(componentName)) return 'data';\n\n return 'display'; // Default\n}\n","/**\n * Theme Analyzer - Extracts theme keys by statically analyzing theme files.\n *\n * Uses TypeScript Compiler API to trace the declarative builder API:\n * - createTheme() / fromTheme(base)\n * - .addIntent('name', {...})\n * - .addRadius('name', value)\n * - .addShadow('name', {...})\n * - .setSizes({ button: { xs: {}, sm: {}, ... }, ... })\n * - .build()\n */\n\nimport * as ts from 'typescript';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { ThemeValues } from './types';\n\ninterface AnalyzerContext {\n program: ts.Program;\n typeChecker: ts.TypeChecker;\n verbose: boolean;\n}\n\n/**\n * Extract theme values from a theme file.\n */\nexport function analyzeTheme(themePath: string, verbose = false): ThemeValues {\n const resolvedPath = path.resolve(themePath);\n\n if (!fs.existsSync(resolvedPath)) {\n throw new Error(`Theme file not found: ${resolvedPath}`);\n }\n\n const log = (...args: any[]) => {\n if (verbose) console.log('[theme-analyzer]', ...args);\n };\n\n log('Analyzing theme file:', resolvedPath);\n\n // Create a TypeScript program\n const program = ts.createProgram([resolvedPath], {\n target: ts.ScriptTarget.ES2020,\n module: ts.ModuleKind.ESNext,\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n allowSyntheticDefaultImports: true,\n });\n\n const sourceFile = program.getSourceFile(resolvedPath);\n if (!sourceFile) {\n throw new Error(`Failed to parse theme file: ${resolvedPath}`);\n }\n\n const ctx: AnalyzerContext = {\n program,\n typeChecker: program.getTypeChecker(),\n verbose,\n };\n\n const values: ThemeValues = {\n intents: [],\n sizes: {},\n radii: [],\n shadows: [],\n breakpoints: [],\n typography: [],\n surfaceColors: [],\n textColors: [],\n borderColors: [],\n };\n\n // Track imports for base theme resolution\n const imports = new Map<string, { source: string; imported: string }>();\n\n // First pass: collect imports\n ts.forEachChild(sourceFile, (node) => {\n if (ts.isImportDeclaration(node)) {\n const source = (node.moduleSpecifier as ts.StringLiteral).text;\n const clause = node.importClause;\n if (clause?.namedBindings && ts.isNamedImports(clause.namedBindings)) {\n for (const element of clause.namedBindings.elements) {\n const localName = element.name.text;\n const importedName = element.propertyName?.text ?? localName;\n imports.set(localName, { source, imported: importedName });\n }\n }\n }\n });\n\n /**\n * Process a builder method call chain.\n */\n function processBuilderChain(node: ts.Node): void {\n if (!ts.isCallExpression(node)) return;\n\n // Check if this is a .build() call\n if (ts.isPropertyAccessExpression(node.expression)) {\n const methodName = node.expression.name.text;\n\n if (methodName === 'build') {\n // Trace the full chain\n const calls = traceBuilderCalls(node);\n processCalls(calls);\n return;\n }\n }\n\n // Recurse into children\n ts.forEachChild(node, processBuilderChain);\n }\n\n interface BuilderCall {\n method: string;\n args: ts.NodeArray<ts.Expression>;\n }\n\n /**\n * Trace a builder chain backwards to collect all method calls.\n */\n function traceBuilderCalls(node: ts.CallExpression, calls: BuilderCall[] = []): BuilderCall[] {\n if (!ts.isPropertyAccessExpression(node.expression)) {\n // Check for createTheme() or fromTheme()\n if (ts.isCallExpression(node) && ts.isIdentifier(node.expression)) {\n const fnName = node.expression.text;\n if (fnName === 'fromTheme' && node.arguments.length > 0) {\n const arg = node.arguments[0];\n if (ts.isIdentifier(arg)) {\n // Analyze base theme\n analyzeBaseTheme(arg.text, imports, values, ctx);\n }\n }\n }\n return calls;\n }\n\n const methodName = node.expression.name.text;\n calls.unshift({ method: methodName, args: node.arguments });\n\n // Recurse into the object being called\n const obj = node.expression.expression;\n if (ts.isCallExpression(obj)) {\n return traceBuilderCalls(obj, calls);\n }\n\n return calls;\n }\n\n /**\n * Process the collected builder method calls.\n */\n function processCalls(calls: BuilderCall[]): void {\n log('Processing', calls.length, 'builder method calls');\n\n for (const { method, args } of calls) {\n switch (method) {\n case 'addIntent': {\n const name = getStringValue(args[0]);\n if (name && !values.intents.includes(name)) {\n values.intents.push(name);\n log(' Found intent:', name);\n }\n break;\n }\n case 'addRadius': {\n const name = getStringValue(args[0]);\n if (name && !values.radii.includes(name)) {\n values.radii.push(name);\n log(' Found radius:', name);\n }\n break;\n }\n case 'addShadow': {\n const name = getStringValue(args[0]);\n if (name && !values.shadows.includes(name)) {\n values.shadows.push(name);\n log(' Found shadow:', name);\n }\n break;\n }\n case 'setSizes': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n for (const prop of args[0].properties) {\n if (ts.isPropertyAssignment(prop)) {\n const componentName = getPropertyName(prop.name);\n if (componentName && ts.isObjectLiteralExpression(prop.initializer)) {\n values.sizes[componentName] = getObjectKeys(prop.initializer);\n log(' Found sizes for', componentName + ':', values.sizes[componentName]);\n }\n }\n }\n }\n break;\n }\n case 'setBreakpoints': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n values.breakpoints = getObjectKeys(args[0]);\n log(' Found breakpoints:', values.breakpoints);\n }\n break;\n }\n case 'setColors': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n for (const prop of args[0].properties) {\n if (ts.isPropertyAssignment(prop)) {\n const colorType = getPropertyName(prop.name);\n if (ts.isObjectLiteralExpression(prop.initializer)) {\n const keys = getObjectKeys(prop.initializer);\n switch (colorType) {\n case 'surface':\n values.surfaceColors = keys;\n log(' Found surface colors:', keys);\n break;\n case 'text':\n values.textColors = keys;\n log(' Found text colors:', keys);\n break;\n case 'border':\n values.borderColors = keys;\n log(' Found border colors:', keys);\n break;\n }\n }\n }\n }\n }\n break;\n }\n case 'build':\n // End of chain\n break;\n default:\n log(' Skipping unknown method:', method);\n }\n }\n }\n\n // Second pass: find and process builder chains\n ts.forEachChild(sourceFile, (node) => {\n // Handle variable declarations\n if (ts.isVariableStatement(node)) {\n for (const decl of node.declarationList.declarations) {\n if (decl.initializer) {\n processBuilderChain(decl.initializer);\n }\n }\n }\n // Handle export statements\n if (ts.isExportAssignment(node)) {\n processBuilderChain(node.expression);\n }\n });\n\n // Extract typography keys from sizes if present\n if (values.sizes['typography']) {\n values.typography = values.sizes['typography'];\n }\n\n log('Extracted theme values:', values);\n\n return values;\n}\n\n/**\n * Analyze a base theme file referenced by an import.\n */\nfunction analyzeBaseTheme(\n varName: string,\n imports: Map<string, { source: string; imported: string }>,\n values: ThemeValues,\n ctx: AnalyzerContext\n): void {\n const log = (...args: any[]) => {\n if (ctx.verbose) console.log('[theme-analyzer]', ...args);\n };\n\n const importInfo = imports.get(varName);\n if (!importInfo) {\n log('Could not find import for base theme:', varName);\n return;\n }\n\n log('Base theme', varName, 'imported from', importInfo.source);\n\n // For @idealyst/theme imports, we know the structure\n if (importInfo.source === '@idealyst/theme' || importInfo.source.includes('@idealyst/theme')) {\n // Use default light theme values\n const defaultValues = getDefaultThemeValues();\n mergeThemeValues(values, defaultValues);\n log('Using default @idealyst/theme values');\n return;\n }\n\n // For relative imports, try to resolve and analyze\n // (This is simplified - full implementation would recursively analyze)\n log('Skipping base theme analysis for:', importInfo.source);\n}\n\n/**\n * Get default theme values from @idealyst/theme.\n */\nfunction getDefaultThemeValues(): ThemeValues {\n return {\n intents: ['primary', 'success', 'error', 'warning', 'neutral', 'info'],\n sizes: {\n button: ['xs', 'sm', 'md', 'lg', 'xl'],\n chip: ['xs', 'sm', 'md', 'lg', 'xl'],\n badge: ['xs', 'sm', 'md', 'lg', 'xl'],\n icon: ['xs', 'sm', 'md', 'lg', 'xl'],\n input: ['xs', 'sm', 'md', 'lg', 'xl'],\n radioButton: ['xs', 'sm', 'md', 'lg', 'xl'],\n select: ['xs', 'sm', 'md', 'lg', 'xl'],\n slider: ['xs', 'sm', 'md', 'lg', 'xl'],\n switch: ['xs', 'sm', 'md', 'lg', 'xl'],\n textarea: ['xs', 'sm', 'md', 'lg', 'xl'],\n avatar: ['xs', 'sm', 'md', 'lg', 'xl'],\n progress: ['xs', 'sm', 'md', 'lg', 'xl'],\n accordion: ['xs', 'sm', 'md', 'lg', 'xl'],\n activityIndicator: ['xs', 'sm', 'md', 'lg', 'xl'],\n breadcrumb: ['xs', 'sm', 'md', 'lg', 'xl'],\n list: ['xs', 'sm', 'md', 'lg', 'xl'],\n menu: ['xs', 'sm', 'md', 'lg', 'xl'],\n text: ['xs', 'sm', 'md', 'lg', 'xl'],\n tabBar: ['xs', 'sm', 'md', 'lg', 'xl'],\n table: ['xs', 'sm', 'md', 'lg', 'xl'],\n tooltip: ['xs', 'sm', 'md', 'lg', 'xl'],\n view: ['xs', 'sm', 'md', 'lg', 'xl'],\n },\n radii: ['none', 'xs', 'sm', 'md', 'lg', 'xl'],\n shadows: ['none', 'sm', 'md', 'lg', 'xl'],\n breakpoints: ['xs', 'sm', 'md', 'lg', 'xl'],\n typography: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'subtitle1', 'subtitle2', 'body1', 'body2', 'caption'],\n surfaceColors: ['screen', 'primary', 'secondary', 'tertiary', 'inverse', 'inverse-secondary', 'inverse-tertiary'],\n textColors: ['primary', 'secondary', 'tertiary', 'inverse', 'inverse-secondary', 'inverse-tertiary'],\n borderColors: ['primary', 'secondary', 'tertiary', 'disabled'],\n };\n}\n\n/**\n * Merge theme values, avoiding duplicates.\n */\nfunction mergeThemeValues(target: ThemeValues, source: ThemeValues): void {\n target.intents.push(...source.intents.filter(k => !target.intents.includes(k)));\n target.radii.push(...source.radii.filter(k => !target.radii.includes(k)));\n target.shadows.push(...source.shadows.filter(k => !target.shadows.includes(k)));\n target.breakpoints.push(...source.breakpoints.filter(k => !target.breakpoints.includes(k)));\n target.typography.push(...source.typography.filter(k => !target.typography.includes(k)));\n target.surfaceColors.push(...source.surfaceColors.filter(k => !target.surfaceColors.includes(k)));\n target.textColors.push(...source.textColors.filter(k => !target.textColors.includes(k)));\n target.borderColors.push(...source.borderColors.filter(k => !target.borderColors.includes(k)));\n\n for (const [comp, sizes] of Object.entries(source.sizes)) {\n if (!target.sizes[comp]) {\n target.sizes[comp] = sizes;\n }\n }\n}\n\n// Helper functions\n\nfunction getStringValue(node?: ts.Expression): string | null {\n if (!node) return null;\n if (ts.isStringLiteral(node)) return node.text;\n if (ts.isIdentifier(node)) return node.text;\n return null;\n}\n\nfunction getPropertyName(node: ts.PropertyName): string | null {\n if (ts.isIdentifier(node)) return node.text;\n if (ts.isStringLiteral(node)) return node.text;\n return null;\n}\n\nfunction getObjectKeys(node: ts.ObjectLiteralExpression): string[] {\n return node.properties\n .filter(ts.isPropertyAssignment)\n .map(prop => getPropertyName(prop.name))\n .filter((k): k is string => k !== null);\n}\n\n// ============================================================================\n// Babel Plugin Compatibility Layer\n// ============================================================================\n\n/**\n * Theme keys format expected by the Babel plugin.\n * This is a subset of ThemeValues for backwards compatibility.\n */\nexport interface BabelThemeKeys {\n intents: string[];\n sizes: Record<string, string[]>;\n radii: string[];\n shadows: string[];\n}\n\n// Cache for loadThemeKeys to avoid re-parsing\nlet themeKeysCache: BabelThemeKeys | null = null;\nlet themeLoadAttempted = false;\n\n/**\n * Load theme keys for the Babel plugin.\n * This is a compatibility wrapper around analyzeTheme() that:\n * - Provides caching (only parses once per build)\n * - Returns the subset of keys needed by the Babel plugin\n * - Handles path resolution based on babel opts\n *\n * @param opts - Babel plugin options (requires themePath)\n * @param rootDir - Root directory for path resolution\n * @param _babelTypes - Unused (kept for backwards compatibility)\n * @param verboseMode - Enable verbose logging\n */\nexport function loadThemeKeys(\n opts: { themePath?: string },\n rootDir: string,\n _babelTypes?: unknown,\n verboseMode = false\n): BabelThemeKeys {\n if (themeLoadAttempted && themeKeysCache) {\n return themeKeysCache;\n }\n themeLoadAttempted = true;\n\n const themePath = opts.themePath;\n\n if (!themePath) {\n throw new Error(\n '[idealyst-plugin] themePath is required!\\n' +\n 'Add it to your babel config:\\n' +\n ' [\"@idealyst/theme/plugin\", { themePath: \"./src/theme/styles.ts\" }]'\n );\n }\n\n // Resolve the path\n const resolvedPath = themePath.startsWith('.')\n ? path.resolve(rootDir, themePath)\n : themePath;\n\n if (verboseMode) {\n console.log('[idealyst-plugin] Analyzing theme file via @idealyst/tooling:', resolvedPath);\n }\n\n // Use the TypeScript-based analyzer\n const themeValues = analyzeTheme(resolvedPath, verboseMode);\n\n // Convert to Babel-compatible format (subset of ThemeValues)\n themeKeysCache = {\n intents: themeValues.intents,\n sizes: themeValues.sizes,\n radii: themeValues.radii,\n shadows: themeValues.shadows,\n };\n\n if (verboseMode) {\n console.log('[idealyst-plugin] Extracted theme keys:');\n console.log(' intents:', themeKeysCache.intents);\n console.log(' radii:', themeKeysCache.radii);\n console.log(' shadows:', themeKeysCache.shadows);\n console.log(' sizes:');\n for (const [component, sizes] of Object.entries(themeKeysCache.sizes)) {\n console.log(` ${component}:`, sizes);\n }\n }\n\n return themeKeysCache;\n}\n\n/**\n * Reset the theme cache. Useful for testing or hot reload.\n */\nexport function resetThemeCache(): void {\n themeKeysCache = null;\n themeLoadAttempted = false;\n}\n"],"mappings":";AA4BA,YAAYA,SAAQ;AACpB,YAAYC,WAAU;;;ACnBtB,YAAYC,SAAQ;AACpB,YAAYC,SAAQ;AACpB,YAAYC,WAAU;;;ACAtB,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,YAAY,UAAU;AAYf,SAAS,aAAa,WAAmB,UAAU,OAAoB;AAC5E,QAAM,eAAoB,aAAQ,SAAS;AAE3C,MAAI,CAAI,cAAW,YAAY,GAAG;AAChC,UAAM,IAAI,MAAM,yBAAyB,YAAY,EAAE;AAAA,EACzD;AAEA,QAAM,MAAM,IAAI,SAAgB;AAC9B,QAAI,QAAS,SAAQ,IAAI,oBAAoB,GAAG,IAAI;AAAA,EACtD;AAEA,MAAI,yBAAyB,YAAY;AAGzC,QAAM,UAAa,iBAAc,CAAC,YAAY,GAAG;AAAA,IAC/C,QAAW,gBAAa;AAAA,IACxB,Q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QACT;AAAA,MACF;AAAA,IACF;AAAA;AAAA,IAGA,aAAa;AACX,iBAAW,iBAAiB;AAAA,IAC9B;AAAA,EACF;AACF;AAKO,SAAS,0BAA0B,SAAuD;AAC/F,SAAO,kBAAkB,OAAO;AAClC;","names":["fs","path","ts","fs","path"]}
1
+ {"version":3,"sources":["../src/vite-plugin.ts","../src/analyzer/component-analyzer.ts","../src/analyzer/theme-analyzer.ts"],"sourcesContent":["/**\n * Idealyst Docs Vite Plugin\n *\n * Generates a component registry at build time by analyzing TypeScript source.\n * Replaces placeholder exports from @idealyst/tooling with actual generated values.\n *\n * Usage:\n * ```ts\n * // vite.config.ts\n * import { idealystDocsPlugin } from '@idealyst/tooling';\n *\n * export default defineConfig({\n * plugins: [\n * idealystDocsPlugin({\n * componentPaths: ['../../packages/components/src'],\n * themePath: '../../packages/theme/src/lightTheme.ts',\n * }),\n * ],\n * });\n * ```\n *\n * Then in your app:\n * ```ts\n * import { componentRegistry, componentNames, getComponentsByCategory } from '@idealyst/tooling';\n * ```\n */\n\nimport type { Plugin } from 'vite';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { analyzeComponents } from './analyzer';\nimport type { IdealystDocsPluginOptions, ComponentRegistry } from './analyzer/types';\n\n/**\n * Create the Idealyst Docs Vite plugin.\n */\nexport function idealystDocsPlugin(options: IdealystDocsPluginOptions): Plugin {\n let registry: ComponentRegistry | null = null;\n\n const { debug = false, output, outputPath } = options;\n\n const log = (...args: any[]) => {\n if (debug) console.log('[idealyst-docs]', ...args);\n };\n\n /**\n * Generate the registry by analyzing components.\n */\n function generateRegistry(): ComponentRegistry {\n log('Generating component registry...');\n log('Component paths:', options.componentPaths);\n log('Theme path:', options.themePath);\n\n try {\n registry = analyzeComponents(options);\n log(`Generated registry with ${Object.keys(registry).length} components`);\n if (debug) {\n log('Components found:', Object.keys(registry));\n }\n\n // Optionally write to file\n if (output === 'file' && outputPath) {\n const outputDir = path.dirname(outputPath);\n if (!fs.existsSync(outputDir)) {\n fs.mkdirSync(outputDir, { recursive: true });\n }\n fs.writeFileSync(\n outputPath,\n `// Auto-generated by @idealyst/tooling - DO NOT EDIT\\n` +\n `export const componentRegistry = ${JSON.stringify(registry, null, 2)} as const;\\n`\n );\n log(`Wrote registry to ${outputPath}`);\n }\n\n return registry;\n } catch (error) {\n console.error('[idealyst-docs] Error generating registry:', error);\n return {};\n }\n }\n\n return {\n name: 'idealyst-docs',\n\n // Transform @idealyst/tooling to inject the actual registry\n transform(code, id) {\n // Check if this is the tooling package's index file\n const isToolingIndex = id.includes('@idealyst/tooling') && id.endsWith('index.ts');\n const isToolingSrc = id.includes('/packages/tooling/src/index.ts');\n\n if (isToolingIndex || isToolingSrc) {\n console.log(`[idealyst-docs] Transforming tooling index: ${id}`);\n\n if (!registry) {\n registry = generateRegistry();\n }\n\n // Replace the placeholder exports with actual values\n let transformed = code;\n\n // Replace: export const componentRegistry = {};\n // Note: TypeScript types are stripped before transform, so we match JS not TS\n transformed = transformed.replace(\n /export const componentRegistry\\s*=\\s*\\{\\s*\\};?/,\n `export const componentRegistry = ${JSON.stringify(registry, null, 2)};`\n );\n\n log(`Code transformed: ${code !== transformed}`);\n\n // Replace: export const componentNames = [];\n // Note: TypeScript types are stripped before transform\n transformed = transformed.replace(\n /export const componentNames\\s*=\\s*\\[\\s*\\];?/,\n `export const componentNames = ${JSON.stringify(Object.keys(registry))};`\n );\n\n // Replace getComponentsByCategory with actual implementation that uses the real registry\n // Match JS version (no type annotations)\n transformed = transformed.replace(\n /export function getComponentsByCategory\\(category\\)\\s*\\{[\\s\\S]*?^\\}/m,\n `export function getComponentsByCategory(category) {\n return Object.entries(componentRegistry)\n .filter(([_, def]) => def.category === category)\n .map(([name]) => name);\n}`\n );\n\n // Replace getPropConfig with actual implementation\n // Match JS version (no type annotations)\n transformed = transformed.replace(\n /export function getPropConfig\\(componentName\\)\\s*\\{[\\s\\S]*?^\\}/m,\n `export function getPropConfig(componentName) {\n const def = componentRegistry[componentName];\n if (!def) return {};\n return Object.entries(def.props).reduce((acc, [key, prop]) => {\n if (prop.values && prop.values.length > 0) {\n acc[key] = { type: 'select', options: prop.values, default: prop.default };\n } else if (prop.type === 'boolean') {\n acc[key] = { type: 'boolean', default: prop.default ?? false };\n } else if (prop.type === 'string') {\n acc[key] = { type: 'text', default: prop.default ?? '' };\n } else if (prop.type === 'number') {\n acc[key] = { type: 'number', default: prop.default ?? 0 };\n }\n return acc;\n }, {});\n}`\n );\n\n return {\n code: transformed,\n map: null,\n };\n }\n\n return null;\n },\n\n // Regenerate on component file changes\n handleHotUpdate({ file, server }) {\n // Check if the changed file is a component file\n const isComponentFile =\n options.componentPaths.some(p => file.includes(path.resolve(p))) &&\n (file.endsWith('.ts') || file.endsWith('.tsx'));\n\n // Check if the changed file is the theme file\n const isThemeFile = file.includes(path.resolve(options.themePath));\n\n if (isComponentFile || isThemeFile) {\n log(`File changed: ${file}, regenerating registry...`);\n\n // Clear cached registry\n registry = null;\n\n // Invalidate the tooling module to trigger re-transform\n const toolingMods = Array.from(server.moduleGraph.idToModuleMap.values())\n .filter(m => m.id && (m.id.includes('@idealyst/tooling') || m.id.includes('/packages/tooling/src/index')));\n\n toolingMods.forEach(m => server.moduleGraph.invalidateModule(m));\n\n if (toolingMods.length > 0) {\n return toolingMods;\n }\n }\n },\n\n // Generate on build\n buildStart() {\n registry = generateRegistry();\n },\n };\n}\n\n/**\n * Standalone function to generate registry (for MCP server or CLI).\n */\nexport function generateComponentRegistry(options: IdealystDocsPluginOptions): ComponentRegistry {\n return analyzeComponents(options);\n}\n","/**\n * Component Analyzer - Extracts component prop definitions using TypeScript Compiler API.\n *\n * Analyzes:\n * - types.ts files for prop interfaces\n * - JSDoc comments for descriptions\n * - Static .description properties on components\n * - Theme-derived types (Intent, Size) resolved to actual values\n */\n\nimport * as ts from 'typescript';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type {\n ComponentRegistry,\n ComponentDefinition,\n PropDefinition,\n ComponentAnalyzerOptions,\n ThemeValues,\n ComponentCategory,\n SampleProps,\n} from './types';\nimport { analyzeTheme } from './theme-analyzer';\n\n/**\n * Analyze components and generate a registry.\n */\nexport function analyzeComponents(options: ComponentAnalyzerOptions): ComponentRegistry {\n const { componentPaths, themePath, include, exclude, includeInternal = false } = options;\n\n const registry: ComponentRegistry = {};\n\n // First, analyze the theme to get valid values\n const themeValues = analyzeTheme(themePath, false);\n\n // Scan each component path\n for (const componentPath of componentPaths) {\n const resolvedPath = path.resolve(componentPath);\n\n if (!fs.existsSync(resolvedPath)) {\n console.warn(`[component-analyzer] Path not found: ${resolvedPath}`);\n continue;\n }\n\n // Find all component directories (those with index.ts or types.ts)\n const componentDirs = findComponentDirs(resolvedPath);\n\n for (const dir of componentDirs) {\n const componentName = path.basename(dir);\n\n // Apply include/exclude filters\n if (include && !include.includes(componentName)) continue;\n if (exclude && exclude.includes(componentName)) continue;\n if (!includeInternal && componentName.startsWith('_')) continue;\n\n const definition = analyzeComponentDir(dir, componentName, themeValues);\n if (definition) {\n registry[componentName] = definition;\n }\n }\n }\n\n return registry;\n}\n\n/**\n * Find all component directories in a path.\n */\nfunction findComponentDirs(basePath: string): string[] {\n const dirs: string[] = [];\n\n const entries = fs.readdirSync(basePath, { withFileTypes: true });\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n\n const dirPath = path.join(basePath, entry.name);\n\n // Check if it's a component directory (has index.ts or types.ts)\n const hasIndex = fs.existsSync(path.join(dirPath, 'index.ts'));\n const hasTypes = fs.existsSync(path.join(dirPath, 'types.ts'));\n\n if (hasIndex || hasTypes) {\n dirs.push(dirPath);\n }\n }\n\n return dirs;\n}\n\n/**\n * Analyze a single component directory.\n */\nfunction analyzeComponentDir(\n dir: string,\n componentName: string,\n themeValues: ThemeValues\n): ComponentDefinition | null {\n // Find all TypeScript files in the component directory\n const tsFiles = fs.readdirSync(dir)\n .filter(f => f.endsWith('.ts') || f.endsWith('.tsx'))\n .map(f => path.join(dir, f));\n\n if (tsFiles.length === 0) {\n return null;\n }\n\n // Create TypeScript program with all files\n const program = ts.createProgram(tsFiles, {\n target: ts.ScriptTarget.ES2020,\n module: ts.ModuleKind.ESNext,\n jsx: ts.JsxEmit.React,\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n });\n\n const typeChecker = program.getTypeChecker();\n\n // Search all files for the props interface\n const propsInterfaceName = `${componentName}Props`;\n const altNames = [`${componentName}ComponentProps`, 'Props'];\n let propsInterface: ts.InterfaceDeclaration | ts.TypeAliasDeclaration | null = null;\n let interfaceDescription: string | undefined;\n\n // Search each file for the props interface\n for (const filePath of tsFiles) {\n const sourceFile = program.getSourceFile(filePath);\n if (!sourceFile) continue;\n\n // First try the main props interface name\n ts.forEachChild(sourceFile, (node) => {\n if (ts.isInterfaceDeclaration(node) && node.name.text === propsInterfaceName) {\n propsInterface = node;\n interfaceDescription = getJSDocDescription(node);\n }\n if (ts.isTypeAliasDeclaration(node) && node.name.text === propsInterfaceName) {\n propsInterface = node;\n interfaceDescription = getJSDocDescription(node);\n }\n });\n\n if (propsInterface) break;\n }\n\n // If not found, try alternate naming conventions\n if (!propsInterface) {\n for (const altName of altNames) {\n for (const filePath of tsFiles) {\n const sourceFile = program.getSourceFile(filePath);\n if (!sourceFile) continue;\n\n ts.forEachChild(sourceFile, (node) => {\n if ((ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node)) && node.name.text === altName) {\n propsInterface = node;\n interfaceDescription = getJSDocDescription(node);\n }\n });\n\n if (propsInterface) break;\n }\n if (propsInterface) break;\n }\n }\n\n // If we couldn't find a props interface, skip this component\n if (!propsInterface) {\n return null;\n }\n\n // Extract props\n const props: Record<string, PropDefinition> = {};\n\n if (propsInterface) {\n const type = typeChecker.getTypeAtLocation(propsInterface);\n const properties = type.getProperties();\n\n for (const prop of properties) {\n const propDef = analyzeProperty(prop, typeChecker, themeValues);\n if (propDef && !isInternalProp(propDef.name)) {\n props[propDef.name] = propDef;\n }\n }\n }\n\n // Get description from the props interface JSDoc (single source of truth in types.ts)\n const description = interfaceDescription;\n\n // Determine category\n const category = inferCategory(componentName);\n\n // Look for docs.ts to extract sample props\n const sampleProps = extractSampleProps(dir);\n\n return {\n name: componentName,\n description,\n props,\n category,\n filePath: path.relative(process.cwd(), dir),\n sampleProps,\n };\n}\n\n/**\n * Extract sample props from docs.ts file if it exists.\n * The docs.ts file should export a `sampleProps` object.\n */\nfunction extractSampleProps(dir: string): SampleProps | undefined {\n const docsPath = path.join(dir, 'docs.ts');\n\n if (!fs.existsSync(docsPath)) {\n return undefined;\n }\n\n try {\n const content = fs.readFileSync(docsPath, 'utf-8');\n\n // Create a simple TypeScript program to extract the sampleProps export\n const sourceFile = ts.createSourceFile(\n 'docs.ts',\n content,\n ts.ScriptTarget.ES2020,\n true,\n ts.ScriptKind.TS\n );\n\n let samplePropsNode: ts.ObjectLiteralExpression | null = null;\n\n // Find the sampleProps export\n ts.forEachChild(sourceFile, (node) => {\n // Handle: export const sampleProps = { ... }\n if (ts.isVariableStatement(node)) {\n const isExported = node.modifiers?.some(m => m.kind === ts.SyntaxKind.ExportKeyword);\n if (isExported) {\n for (const decl of node.declarationList.declarations) {\n if (ts.isIdentifier(decl.name) && decl.name.text === 'sampleProps' && decl.initializer) {\n if (ts.isObjectLiteralExpression(decl.initializer)) {\n samplePropsNode = decl.initializer;\n }\n }\n }\n }\n }\n });\n\n if (!samplePropsNode) {\n return undefined;\n }\n\n // Extract the object literal as JSON-compatible structure\n // This is a simplified extraction - it handles basic literals\n const result: SampleProps = {};\n const propsNode = samplePropsNode as ts.ObjectLiteralExpression;\n\n for (const prop of propsNode.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {\n const propName = prop.name.text;\n\n if (propName === 'props' && ts.isObjectLiteralExpression(prop.initializer)) {\n result.props = extractObjectLiteral(prop.initializer, content);\n } else if (propName === 'children') {\n // For children, we store the raw source text\n result.children = prop.initializer.getText(sourceFile);\n } else if (propName === 'state' && ts.isObjectLiteralExpression(prop.initializer)) {\n // Extract state configuration for controlled components\n result.state = extractObjectLiteral(prop.initializer, content);\n }\n }\n }\n\n return Object.keys(result).length > 0 ? result : undefined;\n } catch (e) {\n console.warn(`[component-analyzer] Error reading docs.ts in ${dir}:`, e);\n return undefined;\n }\n}\n\n/**\n * Extract an object literal to a plain object (for simple literal values).\n */\nfunction extractObjectLiteral(node: ts.ObjectLiteralExpression, sourceContent: string): Record<string, any> {\n const result: Record<string, any> = {};\n\n for (const prop of node.properties) {\n if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {\n const key = prop.name.text;\n const init = prop.initializer;\n\n if (ts.isStringLiteral(init)) {\n result[key] = init.text;\n } else if (ts.isNumericLiteral(init)) {\n result[key] = Number(init.text);\n } else if (init.kind === ts.SyntaxKind.TrueKeyword) {\n result[key] = true;\n } else if (init.kind === ts.SyntaxKind.FalseKeyword) {\n result[key] = false;\n } else if (ts.isArrayLiteralExpression(init)) {\n result[key] = extractArrayLiteral(init, sourceContent);\n } else if (ts.isObjectLiteralExpression(init)) {\n result[key] = extractObjectLiteral(init, sourceContent);\n } else {\n // For complex expressions (JSX, functions), store the raw source\n result[key] = init.getText();\n }\n }\n }\n\n return result;\n}\n\n/**\n * Extract an array literal to a plain array.\n */\nfunction extractArrayLiteral(node: ts.ArrayLiteralExpression, sourceContent: string): any[] {\n const result: any[] = [];\n\n for (const element of node.elements) {\n if (ts.isStringLiteral(element)) {\n result.push(element.text);\n } else if (ts.isNumericLiteral(element)) {\n result.push(Number(element.text));\n } else if (element.kind === ts.SyntaxKind.TrueKeyword) {\n result.push(true);\n } else if (element.kind === ts.SyntaxKind.FalseKeyword) {\n result.push(false);\n } else if (ts.isObjectLiteralExpression(element)) {\n result.push(extractObjectLiteral(element, sourceContent));\n } else if (ts.isArrayLiteralExpression(element)) {\n result.push(extractArrayLiteral(element, sourceContent));\n } else {\n // For complex expressions, store raw source\n result.push(element.getText());\n }\n }\n\n return result;\n}\n\n/**\n * Analyze a single property symbol.\n */\nfunction analyzeProperty(\n symbol: ts.Symbol,\n typeChecker: ts.TypeChecker,\n themeValues: ThemeValues\n): PropDefinition | null {\n const name = symbol.getName();\n const declarations = symbol.getDeclarations();\n\n if (!declarations || declarations.length === 0) return null;\n\n const declaration = declarations[0];\n const type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration);\n const typeString = typeChecker.typeToString(type);\n\n // Get JSDoc description\n const description = ts.displayPartsToString(symbol.getDocumentationComment(typeChecker)) || undefined;\n\n // Check if required\n const required = !(symbol.flags & ts.SymbolFlags.Optional);\n\n // Extract values for union types / theme types\n const values = extractPropValues(type, typeString, typeChecker, themeValues);\n\n // Extract default value (from JSDoc @default tag)\n const defaultValue = extractDefaultValue(symbol);\n\n return {\n name,\n type: simplifyTypeName(typeString),\n values: values.length > 0 ? values : undefined,\n default: defaultValue,\n description,\n required,\n };\n}\n\n/**\n * Extract valid values for a prop type.\n */\nfunction extractPropValues(\n type: ts.Type,\n typeString: string,\n _typeChecker: ts.TypeChecker,\n themeValues: ThemeValues\n): string[] {\n // Handle theme-derived types\n if (typeString === 'Intent' || typeString.includes('Intent')) {\n return themeValues.intents;\n }\n if (typeString === 'Size' || typeString.includes('Size')) {\n // Return generic sizes - most components use the same keys\n return ['xs', 'sm', 'md', 'lg', 'xl'];\n }\n\n // Handle union types\n if (type.isUnion()) {\n const values: string[] = [];\n for (const unionType of type.types) {\n if (unionType.isStringLiteral()) {\n values.push(unionType.value);\n } else if ((unionType as any).intrinsicName === 'true') {\n values.push('true');\n } else if ((unionType as any).intrinsicName === 'false') {\n values.push('false');\n }\n }\n if (values.length > 0) return values;\n }\n\n // Handle boolean\n if (typeString === 'boolean') {\n return ['true', 'false'];\n }\n\n return [];\n}\n\n/**\n * Extract default value from JSDoc @default tag.\n */\nfunction extractDefaultValue(symbol: ts.Symbol): string | number | boolean | undefined {\n const tags = symbol.getJsDocTags();\n for (const tag of tags) {\n if (tag.name === 'default' && tag.text) {\n const value = ts.displayPartsToString(tag.text);\n // Try to parse as JSON\n try {\n return JSON.parse(value);\n } catch {\n return value;\n }\n }\n }\n return undefined;\n}\n\n/**\n * Get JSDoc description from a node.\n */\nfunction getJSDocDescription(node: ts.Node): string | undefined {\n const jsDocs = (node as any).jsDoc as ts.JSDoc[] | undefined;\n if (!jsDocs || jsDocs.length === 0) return undefined;\n\n const firstDoc = jsDocs[0];\n if (firstDoc.comment) {\n if (typeof firstDoc.comment === 'string') {\n return firstDoc.comment;\n }\n // Handle NodeArray of JSDocComment\n return (firstDoc.comment as ts.NodeArray<ts.JSDocComment>)\n .map(c => (c as any).text || '')\n .join('');\n }\n return undefined;\n}\n\n/**\n * Simplify type names for display.\n */\nfunction simplifyTypeName(typeString: string): string {\n // Remove import paths\n typeString = typeString.replace(/import\\([^)]+\\)\\./g, '');\n\n // Simplify common complex types\n if (typeString.includes('ReactNode')) return 'ReactNode';\n if (typeString.includes('StyleProp')) return 'Style';\n\n return typeString;\n}\n\n/**\n * Check if a prop should be excluded (internal/inherited).\n */\nfunction isInternalProp(name: string): boolean {\n const internalProps = [\n 'ref',\n 'key',\n 'children',\n 'style',\n 'testID',\n 'nativeID',\n 'accessible',\n 'accessibilityActions',\n 'accessibilityComponentType',\n 'accessibilityElementsHidden',\n 'accessibilityHint',\n 'accessibilityIgnoresInvertColors',\n 'accessibilityLabel',\n 'accessibilityLabelledBy',\n 'accessibilityLanguage',\n 'accessibilityLiveRegion',\n 'accessibilityRole',\n 'accessibilityState',\n 'accessibilityTraits',\n 'accessibilityValue',\n 'accessibilityViewIsModal',\n 'collapsable',\n 'focusable',\n 'hasTVPreferredFocus',\n 'hitSlop',\n 'importantForAccessibility',\n 'needsOffscreenAlphaCompositing',\n 'onAccessibilityAction',\n 'onAccessibilityEscape',\n 'onAccessibilityTap',\n 'onLayout',\n 'onMagicTap',\n 'onMoveShouldSetResponder',\n 'onMoveShouldSetResponderCapture',\n 'onResponderEnd',\n 'onResponderGrant',\n 'onResponderMove',\n 'onResponderReject',\n 'onResponderRelease',\n 'onResponderStart',\n 'onResponderTerminate',\n 'onResponderTerminationRequest',\n 'onStartShouldSetResponder',\n 'onStartShouldSetResponderCapture',\n 'pointerEvents',\n 'removeClippedSubviews',\n 'renderToHardwareTextureAndroid',\n 'shouldRasterizeIOS',\n 'tvParallaxMagnification',\n 'tvParallaxProperties',\n 'tvParallaxShiftDistanceX',\n 'tvParallaxShiftDistanceY',\n 'tvParallaxTiltAngle',\n ];\n\n return internalProps.includes(name) || name.startsWith('accessibility');\n}\n\n/**\n * Infer component category from name.\n */\nfunction inferCategory(componentName: string): ComponentCategory {\n const formComponents = ['Button', 'Input', 'Checkbox', 'Select', 'Switch', 'RadioButton', 'Slider', 'TextArea'];\n const displayComponents = ['Text', 'Card', 'Badge', 'Chip', 'Avatar', 'Icon', 'Skeleton', 'Alert', 'Tooltip'];\n const layoutComponents = ['View', 'Screen', 'Divider'];\n const navigationComponents = ['TabBar', 'Breadcrumb', 'Menu', 'List', 'Link'];\n const overlayComponents = ['Dialog', 'Popover', 'Modal'];\n const dataComponents = ['Table', 'Progress', 'Accordion'];\n\n if (formComponents.includes(componentName)) return 'form';\n if (displayComponents.includes(componentName)) return 'display';\n if (layoutComponents.includes(componentName)) return 'layout';\n if (navigationComponents.includes(componentName)) return 'navigation';\n if (overlayComponents.includes(componentName)) return 'overlay';\n if (dataComponents.includes(componentName)) return 'data';\n\n return 'display'; // Default\n}\n","/**\n * Theme Analyzer - Extracts theme keys by statically analyzing theme files.\n *\n * Uses TypeScript Compiler API to trace the declarative builder API:\n * - createTheme() / fromTheme(base)\n * - .addIntent('name', {...})\n * - .addRadius('name', value)\n * - .addShadow('name', {...})\n * - .setSizes({ button: { xs: {}, sm: {}, ... }, ... })\n * - .build()\n */\n\nimport * as ts from 'typescript';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { ThemeValues } from './types';\n\ninterface AnalyzerContext {\n program: ts.Program;\n typeChecker: ts.TypeChecker;\n verbose: boolean;\n}\n\n/**\n * Extract theme values from a theme file.\n */\nexport function analyzeTheme(themePath: string, verbose = false): ThemeValues {\n const resolvedPath = path.resolve(themePath);\n\n if (!fs.existsSync(resolvedPath)) {\n throw new Error(`Theme file not found: ${resolvedPath}`);\n }\n\n const log = (...args: any[]) => {\n if (verbose) console.log('[theme-analyzer]', ...args);\n };\n\n log('Analyzing theme file:', resolvedPath);\n\n // Create a TypeScript program\n const program = ts.createProgram([resolvedPath], {\n target: ts.ScriptTarget.ES2020,\n module: ts.ModuleKind.ESNext,\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n allowSyntheticDefaultImports: true,\n });\n\n const sourceFile = program.getSourceFile(resolvedPath);\n if (!sourceFile) {\n throw new Error(`Failed to parse theme file: ${resolvedPath}`);\n }\n\n const ctx: AnalyzerContext = {\n program,\n typeChecker: program.getTypeChecker(),\n verbose,\n };\n\n const values: ThemeValues = {\n intents: [],\n sizes: {},\n radii: [],\n shadows: [],\n breakpoints: [],\n typography: [],\n surfaceColors: [],\n textColors: [],\n borderColors: [],\n };\n\n // Track imports for base theme resolution\n const imports = new Map<string, { source: string; imported: string }>();\n\n // First pass: collect imports\n ts.forEachChild(sourceFile, (node) => {\n if (ts.isImportDeclaration(node)) {\n const source = (node.moduleSpecifier as ts.StringLiteral).text;\n const clause = node.importClause;\n if (clause?.namedBindings && ts.isNamedImports(clause.namedBindings)) {\n for (const element of clause.namedBindings.elements) {\n const localName = element.name.text;\n const importedName = element.propertyName?.text ?? localName;\n imports.set(localName, { source, imported: importedName });\n }\n }\n }\n });\n\n /**\n * Process a builder method call chain.\n */\n function processBuilderChain(node: ts.Node): void {\n if (!ts.isCallExpression(node)) return;\n\n // Check if this is a .build() call\n if (ts.isPropertyAccessExpression(node.expression)) {\n const methodName = node.expression.name.text;\n\n if (methodName === 'build') {\n // Trace the full chain\n const calls = traceBuilderCalls(node);\n processCalls(calls);\n return;\n }\n }\n\n // Recurse into children\n ts.forEachChild(node, processBuilderChain);\n }\n\n interface BuilderCall {\n method: string;\n args: ts.NodeArray<ts.Expression>;\n }\n\n /**\n * Trace a builder chain backwards to collect all method calls.\n */\n function traceBuilderCalls(node: ts.CallExpression, calls: BuilderCall[] = []): BuilderCall[] {\n if (!ts.isPropertyAccessExpression(node.expression)) {\n // Check for createTheme() or fromTheme()\n if (ts.isCallExpression(node) && ts.isIdentifier(node.expression)) {\n const fnName = node.expression.text;\n if (fnName === 'fromTheme' && node.arguments.length > 0) {\n const arg = node.arguments[0];\n if (ts.isIdentifier(arg)) {\n // Analyze base theme\n analyzeBaseTheme(arg.text, imports, values, ctx);\n }\n }\n }\n return calls;\n }\n\n const methodName = node.expression.name.text;\n calls.unshift({ method: methodName, args: node.arguments });\n\n // Recurse into the object being called\n const obj = node.expression.expression;\n if (ts.isCallExpression(obj)) {\n return traceBuilderCalls(obj, calls);\n }\n\n return calls;\n }\n\n /**\n * Process the collected builder method calls.\n */\n function processCalls(calls: BuilderCall[]): void {\n log('Processing', calls.length, 'builder method calls');\n\n for (const { method, args } of calls) {\n switch (method) {\n case 'addIntent': {\n const name = getStringValue(args[0]);\n if (name && !values.intents.includes(name)) {\n values.intents.push(name);\n log(' Found intent:', name);\n }\n break;\n }\n case 'addRadius': {\n const name = getStringValue(args[0]);\n if (name && !values.radii.includes(name)) {\n values.radii.push(name);\n log(' Found radius:', name);\n }\n break;\n }\n case 'addShadow': {\n const name = getStringValue(args[0]);\n if (name && !values.shadows.includes(name)) {\n values.shadows.push(name);\n log(' Found shadow:', name);\n }\n break;\n }\n case 'setSizes': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n for (const prop of args[0].properties) {\n if (ts.isPropertyAssignment(prop)) {\n const componentName = getPropertyName(prop.name);\n if (componentName && ts.isObjectLiteralExpression(prop.initializer)) {\n values.sizes[componentName] = getObjectKeys(prop.initializer);\n log(' Found sizes for', componentName + ':', values.sizes[componentName]);\n }\n }\n }\n }\n break;\n }\n case 'setBreakpoints': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n values.breakpoints = getObjectKeys(args[0]);\n log(' Found breakpoints:', values.breakpoints);\n }\n break;\n }\n case 'setColors': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n for (const prop of args[0].properties) {\n if (ts.isPropertyAssignment(prop)) {\n const colorType = getPropertyName(prop.name);\n if (ts.isObjectLiteralExpression(prop.initializer)) {\n const keys = getObjectKeys(prop.initializer);\n switch (colorType) {\n case 'surface':\n values.surfaceColors = keys;\n log(' Found surface colors:', keys);\n break;\n case 'text':\n values.textColors = keys;\n log(' Found text colors:', keys);\n break;\n case 'border':\n values.borderColors = keys;\n log(' Found border colors:', keys);\n break;\n }\n }\n }\n }\n }\n break;\n }\n case 'build':\n // End of chain\n break;\n default:\n log(' Skipping unknown method:', method);\n }\n }\n }\n\n // Second pass: find and process builder chains\n ts.forEachChild(sourceFile, (node) => {\n // Handle variable declarations\n if (ts.isVariableStatement(node)) {\n for (const decl of node.declarationList.declarations) {\n if (decl.initializer) {\n processBuilderChain(decl.initializer);\n }\n }\n }\n // Handle export statements\n if (ts.isExportAssignment(node)) {\n processBuilderChain(node.expression);\n }\n });\n\n // Extract typography keys from sizes if present\n if (values.sizes['typography']) {\n values.typography = values.sizes['typography'];\n }\n\n log('Extracted theme values:', values);\n\n return values;\n}\n\n/**\n * Analyze a base theme file referenced by an import.\n */\nfunction analyzeBaseTheme(\n varName: string,\n imports: Map<string, { source: string; imported: string }>,\n values: ThemeValues,\n ctx: AnalyzerContext\n): void {\n const log = (...args: any[]) => {\n if (ctx.verbose) console.log('[theme-analyzer]', ...args);\n };\n\n const importInfo = imports.get(varName);\n if (!importInfo) {\n log('Could not find import for base theme:', varName);\n return;\n }\n\n log('Base theme', varName, 'imported from', importInfo.source);\n\n // For @idealyst/theme imports, we know the structure\n if (importInfo.source === '@idealyst/theme' || importInfo.source.includes('@idealyst/theme')) {\n // Use default light theme values\n const defaultValues = getDefaultThemeValues();\n mergeThemeValues(values, defaultValues);\n log('Using default @idealyst/theme values');\n return;\n }\n\n // For relative imports, try to resolve and analyze\n // (This is simplified - full implementation would recursively analyze)\n log('Skipping base theme analysis for:', importInfo.source);\n}\n\n/**\n * Get default theme values from @idealyst/theme.\n */\nfunction getDefaultThemeValues(): ThemeValues {\n return {\n intents: ['primary', 'success', 'error', 'warning', 'neutral', 'info'],\n sizes: {\n button: ['xs', 'sm', 'md', 'lg', 'xl'],\n chip: ['xs', 'sm', 'md', 'lg', 'xl'],\n badge: ['xs', 'sm', 'md', 'lg', 'xl'],\n icon: ['xs', 'sm', 'md', 'lg', 'xl'],\n input: ['xs', 'sm', 'md', 'lg', 'xl'],\n radioButton: ['xs', 'sm', 'md', 'lg', 'xl'],\n select: ['xs', 'sm', 'md', 'lg', 'xl'],\n slider: ['xs', 'sm', 'md', 'lg', 'xl'],\n switch: ['xs', 'sm', 'md', 'lg', 'xl'],\n textarea: ['xs', 'sm', 'md', 'lg', 'xl'],\n avatar: ['xs', 'sm', 'md', 'lg', 'xl'],\n progress: ['xs', 'sm', 'md', 'lg', 'xl'],\n accordion: ['xs', 'sm', 'md', 'lg', 'xl'],\n activityIndicator: ['xs', 'sm', 'md', 'lg', 'xl'],\n breadcrumb: ['xs', 'sm', 'md', 'lg', 'xl'],\n list: ['xs', 'sm', 'md', 'lg', 'xl'],\n menu: ['xs', 'sm', 'md', 'lg', 'xl'],\n text: ['xs', 'sm', 'md', 'lg', 'xl'],\n tabBar: ['xs', 'sm', 'md', 'lg', 'xl'],\n table: ['xs', 'sm', 'md', 'lg', 'xl'],\n tooltip: ['xs', 'sm', 'md', 'lg', 'xl'],\n view: ['xs', 'sm', 'md', 'lg', 'xl'],\n // Typography sizes for Text component's $typography iterator\n typography: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'subtitle1', 'subtitle2', 'body1', 'body2', 'caption'],\n },\n radii: ['none', 'xs', 'sm', 'md', 'lg', 'xl'],\n shadows: ['none', 'sm', 'md', 'lg', 'xl'],\n breakpoints: ['xs', 'sm', 'md', 'lg', 'xl'],\n typography: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'subtitle1', 'subtitle2', 'body1', 'body2', 'caption'],\n surfaceColors: ['screen', 'primary', 'secondary', 'tertiary', 'inverse', 'inverse-secondary', 'inverse-tertiary'],\n textColors: ['primary', 'secondary', 'tertiary', 'inverse', 'inverse-secondary', 'inverse-tertiary'],\n borderColors: ['primary', 'secondary', 'tertiary', 'disabled'],\n };\n}\n\n/**\n * Merge theme values, avoiding duplicates.\n */\nfunction mergeThemeValues(target: ThemeValues, source: ThemeValues): void {\n target.intents.push(...source.intents.filter(k => !target.intents.includes(k)));\n target.radii.push(...source.radii.filter(k => !target.radii.includes(k)));\n target.shadows.push(...source.shadows.filter(k => !target.shadows.includes(k)));\n target.breakpoints.push(...source.breakpoints.filter(k => !target.breakpoints.includes(k)));\n target.typography.push(...source.typography.filter(k => !target.typography.includes(k)));\n target.surfaceColors.push(...source.surfaceColors.filter(k => !target.surfaceColors.includes(k)));\n target.textColors.push(...source.textColors.filter(k => !target.textColors.includes(k)));\n target.borderColors.push(...source.borderColors.filter(k => !target.borderColors.includes(k)));\n\n for (const [comp, sizes] of Object.entries(source.sizes)) {\n if (!target.sizes[comp]) {\n target.sizes[comp] = sizes;\n }\n }\n}\n\n// Helper functions\n\nfunction getStringValue(node?: ts.Expression): string | null {\n if (!node) return null;\n if (ts.isStringLiteral(node)) return node.text;\n if (ts.isIdentifier(node)) return node.text;\n return null;\n}\n\nfunction getPropertyName(node: ts.PropertyName): string | null {\n if (ts.isIdentifier(node)) return node.text;\n if (ts.isStringLiteral(node)) return node.text;\n return null;\n}\n\nfunction getObjectKeys(node: ts.ObjectLiteralExpression): string[] {\n return node.properties\n .filter(ts.isPropertyAssignment)\n .map(prop => getPropertyName(prop.name))\n .filter((k): k is string => k !== null);\n}\n\n// ============================================================================\n// Babel Plugin Compatibility Layer\n// ============================================================================\n\n/**\n * Theme keys format expected by the Babel plugin.\n * This is a subset of ThemeValues for backwards compatibility.\n */\nexport interface BabelThemeKeys {\n intents: string[];\n sizes: Record<string, string[]>;\n radii: string[];\n shadows: string[];\n typography: string[];\n}\n\n// Cache for loadThemeKeys to avoid re-parsing\nlet themeKeysCache: BabelThemeKeys | null = null;\nlet themeLoadAttempted = false;\n\n/**\n * Load theme keys for the Babel plugin.\n * This is a compatibility wrapper around analyzeTheme() that:\n * - Provides caching (only parses once per build)\n * - Returns the subset of keys needed by the Babel plugin\n * - Handles path resolution based on babel opts\n *\n * @param opts - Babel plugin options (requires themePath)\n * @param rootDir - Root directory for path resolution\n * @param _babelTypes - Unused (kept for backwards compatibility)\n * @param verboseMode - Enable verbose logging\n */\nexport function loadThemeKeys(\n opts: { themePath?: string },\n rootDir: string,\n _babelTypes?: unknown,\n verboseMode = false\n): BabelThemeKeys {\n if (themeLoadAttempted && themeKeysCache) {\n return themeKeysCache;\n }\n themeLoadAttempted = true;\n\n const themePath = opts.themePath;\n\n if (!themePath) {\n throw new Error(\n '[idealyst-plugin] themePath is required!\\n' +\n 'Add it to your babel config:\\n' +\n ' [\"@idealyst/theme/plugin\", { themePath: \"./src/theme/styles.ts\" }]'\n );\n }\n\n // Resolve the path\n const resolvedPath = themePath.startsWith('.')\n ? path.resolve(rootDir, themePath)\n : themePath;\n\n if (verboseMode) {\n console.log('[idealyst-plugin] Analyzing theme file via @idealyst/tooling:', resolvedPath);\n }\n\n // Use the TypeScript-based analyzer\n const themeValues = analyzeTheme(resolvedPath, verboseMode);\n\n // Convert to Babel-compatible format (subset of ThemeValues)\n themeKeysCache = {\n intents: themeValues.intents,\n sizes: themeValues.sizes,\n radii: themeValues.radii,\n shadows: themeValues.shadows,\n typography: themeValues.typography,\n };\n\n if (verboseMode) {\n console.log('[idealyst-plugin] Extracted theme keys:');\n console.log(' intents:', themeKeysCache.intents);\n console.log(' radii:', themeKeysCache.radii);\n console.log(' shadows:', themeKeysCache.shadows);\n console.log(' sizes:');\n for (const [component, sizes] of Object.entries(themeKeysCache.sizes)) {\n console.log(` ${component}:`, sizes);\n }\n }\n\n return themeKeysCache;\n}\n\n/**\n * Reset the theme cache. Useful for testing or hot reload.\n */\nexport function resetThemeCache(): void {\n themeKeysCache = null;\n themeLoadAttempted = false;\n}\n"],"mappings":";AA4BA,YAAYA,SAAQ;AACpB,YAAYC,WAAU;;;ACnBtB,YAAYC,SAAQ;AACpB,YAAYC,SAAQ;AACpB,YAAYC,WAAU;;;ACAtB,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,YAAY,UAAU;AAYf,SAAS,aAAa,WAAmB,UAAU,OAAoB;AAC5E,QAAM,eAAoB,aAAQ,SAAS;AAE3C,MAAI,CAAI,cAAW,YAAY,GAAG;AAChC,UAAM,IAAI,MAAM,yBAAyB,YAAY,EAAE;AAAA,EACzD;AAEA,QAAM,MAAM,IAAI,SAAgB;AAC9B,QAAI,QAAS,SAAQ,IAAI,oBAAoB,GAAG,IAAI;AAAA,EACtD;AAEA,MAAI,yBAAyB,YAAY;AAGzC,QAAM,UAAa,iBAAc,CAAC,YAAY,GAAG;AAAA,IAC/C,QAAW,gBAAa;AAAA,IACxB,QAAW,cAAW;AAAA,IACtB,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd,8BAA8B;AAAA,EAChC,CAAC;AAED,QAAM,aAAa,QAAQ,cAAc,YAAY;AACrD,MAAI,CAAC,YAAY;AACf,UAAM,IAAI,MAAM,+BAA+B,YAAY,EAAE;AAAA,EAC/D;AAEA,QAAM,MAAuB;AAAA,IAC3B;AAAA,IACA,aAAa,QAAQ,eAAe;AAAA,IACpC;AAAA,EACF;AAEA,QAAM,SAAsB;AAAA,IAC1B,SAAS,CAAC;AAAA,IACV,OAAO,CAAC;AAAA,IACR,OAAO,CAAC;AAAA,IACR,SAAS,CAAC;AAAA,IACV,aAAa,CAAC;AAAA,IACd,YAAY,CAAC;AAAA,IACb,eAAe,CAAC;AAAA,IAChB,YAAY,CAAC;AAAA,IACb,cAAc,CAAC;AAAA,EACjB;AAGA,QAAM,UAAU,oBAAI,IAAkD;AAGtE,EAAG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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAgBF;AAEA,eAAO;AAAA,UACL,MAAM;AAAA,UACN,KAAK;AAAA,QACP;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AAAA;AAAA,IAGA,gBAAgB,EAAE,MAAM,OAAO,GAAG;AAEhC,YAAM,kBACJ,QAAQ,eAAe,KAAK,OAAK,KAAK,SAAc,cAAQ,CAAC,CAAC,CAAC,MAC9D,KAAK,SAAS,KAAK,KAAK,KAAK,SAAS,MAAM;AAG/C,YAAM,cAAc,KAAK,SAAc,cAAQ,QAAQ,SAAS,CAAC;AAEjE,UAAI,mBAAmB,aAAa;AAClC,YAAI,iBAAiB,IAAI,4BAA4B;AAGrD,mBAAW;AAGX,cAAM,cAAc,MAAM,KAAK,OAAO,YAAY,cAAc,OAAO,CAAC,EACrE,OAAO,OAAK,EAAE,OAAO,EAAE,GAAG,SAAS,mBAAmB,KAAK,EAAE,GAAG,SAAS,6BAA6B,EAAE;AAE3G,oBAAY,QAAQ,OAAK,OAAO,YAAY,iBAAiB,CAAC,CAAC;AAE/D,YAAI,YAAY,SAAS,GAAG;AAC1B,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA;AAAA,IAGA,aAAa;AACX,iBAAW,iBAAiB;AAAA,IAC9B;AAAA,EACF;AACF;AAKO,SAAS,0BAA0B,SAAuD;AAC/F,SAAO,kBAAkB,OAAO;AAClC;","names":["fs","path","ts","fs","path"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idealyst/tooling",
3
- "version": "1.2.25",
3
+ "version": "1.2.27",
4
4
  "type": "module",
5
5
  "description": "Code analysis and validation utilities for Idealyst Framework",
6
6
  "readme": "README.md",
@@ -19,28 +19,34 @@
19
19
  },
20
20
  "exports": {
21
21
  ".": {
22
+ "types": "./dist/index.d.ts",
22
23
  "import": "./dist/index.js",
23
- "types": "./dist/index.d.ts"
24
+ "require": "./dist/index.cjs"
24
25
  },
25
26
  "./vite": {
27
+ "types": "./dist/vite-plugin.d.ts",
26
28
  "import": "./dist/vite-plugin.js",
27
- "types": "./dist/vite-plugin.d.ts"
29
+ "require": "./dist/vite-plugin.cjs"
28
30
  },
29
31
  "./docs": {
32
+ "types": "./dist/analyzer/index.d.ts",
30
33
  "import": "./dist/analyzer/index.js",
31
- "types": "./dist/analyzer/index.d.ts"
34
+ "require": "./dist/analyzer/index.cjs"
32
35
  },
33
36
  "./analyzers": {
37
+ "types": "./dist/analyzers/index.d.ts",
34
38
  "import": "./dist/analyzers/index.js",
35
- "types": "./dist/analyzers/index.d.ts"
39
+ "require": "./dist/analyzers/index.cjs"
36
40
  },
37
41
  "./rules": {
42
+ "types": "./dist/rules/index.d.ts",
38
43
  "import": "./dist/rules/index.js",
39
- "types": "./dist/rules/index.d.ts"
44
+ "require": "./dist/rules/index.cjs"
40
45
  },
41
46
  "./utils": {
47
+ "types": "./dist/utils/index.d.ts",
42
48
  "import": "./dist/utils/index.js",
43
- "types": "./dist/utils/index.d.ts"
49
+ "require": "./dist/utils/index.cjs"
44
50
  }
45
51
  },
46
52
  "scripts": {