@idealyst/tooling 1.2.40 → 1.2.42

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/analyzer/component-analyzer.ts","../src/analyzer/theme-analyzer.ts","../src/analyzer/theme-source-analyzer.ts","../src/vite-plugin.ts","../src/utils/fileClassifier.ts","../src/utils/importParser.ts","../src/rules/reactNativePrimitives.ts","../src/rules/reactDomPrimitives.ts","../src/analyzers/platformImports.ts","../src/analyzers/componentLinter.ts"],"sourcesContent":["/**\n * @idealyst/tooling\n *\n * Code analysis and validation utilities for Idealyst Framework.\n * Provides tools for babel plugins, CLI, and MCP to validate cross-platform code.\n *\n * Also provides component documentation generation:\n * - analyzeComponents(): Generate a component registry from TypeScript source\n * - analyzeTheme(): Extract theme values (intents, sizes, etc.)\n * - idealystDocsPlugin(): Vite plugin for virtual module support\n */\n\n// Types\nexport * from './types';\n\n// Component Documentation (also available via @idealyst/tooling/docs)\nexport {\n analyzeComponents,\n analyzeTheme,\n // Babel plugin compatibility\n loadThemeKeys,\n resetThemeCache,\n type BabelThemeKeys,\n // Types\n type ComponentRegistry,\n type ComponentDefinition,\n type PropDefinition,\n type ThemeValues,\n type ComponentAnalyzerOptions,\n type SampleProps,\n type ControlledState,\n} from './analyzer';\n\n// Vite Plugin (also available via @idealyst/tooling/vite)\nexport { idealystDocsPlugin, generateComponentRegistry } from './vite-plugin';\nexport type { IdealystDocsPluginOptions } from './analyzer/types';\n\n// Analyzers\nexport {\n // Platform import analysis\n analyzePlatformImports,\n analyzeFiles,\n summarizeResults,\n formatViolation,\n formatViolations,\n type AnalysisSummary,\n // Component linting (catches issues TypeScript can't)\n lintComponent,\n lintComponents,\n formatLintIssue,\n formatLintResults,\n summarizeLintResults,\n type LintIssueType,\n type LintIssue,\n type LintResult,\n type LintSummary,\n type ComponentLinterOptions,\n} from './analyzers';\n\n// Rules\nexport {\n // React Native\n REACT_NATIVE_SOURCES,\n REACT_NATIVE_PRIMITIVES,\n REACT_NATIVE_PRIMITIVE_NAMES,\n REACT_NATIVE_RULE_SET,\n isReactNativePrimitive,\n getReactNativePrimitive,\n // React DOM\n REACT_DOM_SOURCES,\n REACT_DOM_PRIMITIVES,\n REACT_DOM_PRIMITIVE_NAMES,\n REACT_DOM_RULE_SET,\n HTML_INTRINSIC_ELEMENTS,\n HTML_ELEMENT_NAMES,\n isReactDomPrimitive,\n isHtmlElement,\n getReactDomPrimitive,\n} from './rules';\n\n// Utilities\nexport {\n classifyFile,\n isComponentFile,\n isSharedFile,\n isPlatformSpecificFile,\n getExpectedPlatform,\n getBaseName,\n parseImports,\n getPlatformForSource,\n filterPlatformImports,\n getUniqueSources,\n groupImportsBySource,\n type ImportParserOptions,\n} from './utils';\n\n// =============================================================================\n// Runtime Placeholders - These get replaced by the Vite plugin at build time\n// =============================================================================\n\nimport type { ComponentRegistry } from './analyzer/types';\n\n/**\n * Component registry placeholder.\n * This empty object is replaced at build time by the idealystDocsPlugin\n * with the actual component metadata extracted from your codebase.\n *\n * @example\n * ```ts\n * import { componentRegistry } from '@idealyst/tooling';\n *\n * // Access component definitions\n * const buttonDef = componentRegistry['Button'];\n * console.log(buttonDef.description);\n * console.log(buttonDef.props);\n * ```\n */\nexport const componentRegistry: ComponentRegistry = {};\n\n/**\n * List of all component names in the registry.\n * Replaced at build time by the Vite plugin.\n */\nexport const componentNames: string[] = [];\n\n/**\n * Get components filtered by category.\n * Replaced at build time by the Vite plugin.\n */\nexport function getComponentsByCategory(category: string): string[] {\n return Object.entries(componentRegistry)\n .filter(([_, def]) => def.category === category)\n .map(([name]) => name);\n}\n\n/**\n * Get prop configuration for a component (useful for playgrounds).\n * Replaced at build time by the Vite plugin.\n */\nexport function getPropConfig(componentName: string): Record<string, any> {\n const def = componentRegistry[componentName];\n if (!def) return {};\n\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 }, {} as Record<string, any>);\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';\nimport { analyzeThemeSource } from './theme-source-analyzer';\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 case 'setIntent': {\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 'addSurfaceColor':\n case 'setSurfaceColor': {\n const name = getStringValue(args[0]);\n if (name && !values.surfaceColors.includes(name)) {\n values.surfaceColors.push(name);\n log(' Found surface color:', name);\n }\n break;\n }\n case 'addTextColor':\n case 'setTextColor': {\n const name = getStringValue(args[0]);\n if (name && !values.textColors.includes(name)) {\n values.textColors.push(name);\n log(' Found text color:', name);\n }\n break;\n }\n case 'addBorderColor':\n case 'setBorderColor': {\n const name = getStringValue(args[0]);\n if (name && !values.borderColors.includes(name)) {\n values.borderColors.push(name);\n log(' Found border color:', name);\n }\n break;\n }\n case 'addPalletColor':\n case 'setPalletColor': {\n // For pallet colors, we just track that they exist\n // The actual shade keys (50-900) are always the same\n const name = getStringValue(args[0]);\n if (name) {\n log(' Found pallet color:', name);\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, try to analyze from source using aliases\n if (importInfo.source === '@idealyst/theme' || importInfo.source.includes('@idealyst/theme')) {\n // Check if we have an alias for @idealyst/theme\n const aliasPath = packageAliases['@idealyst/theme'];\n if (aliasPath) {\n // Determine which theme file to analyze based on variable name\n const themeFileName = varName.toLowerCase().includes('dark') ? 'darkTheme.ts' : 'lightTheme.ts';\n const themePath = path.join(aliasPath, 'src', themeFileName);\n\n if (fs.existsSync(themePath)) {\n log(`Analyzing @idealyst/theme from source: ${themePath}`);\n try {\n const sourceValues = analyzeThemeSource(themePath, {\n verbose: ctx.verbose,\n aliases: packageAliases,\n });\n mergeThemeValues(values, sourceValues);\n log('Successfully extracted values from source');\n return;\n } catch (err) {\n log('Failed to analyze source, falling back to defaults:', (err as Error).message);\n }\n } else {\n log(`Theme file not found at alias path: ${themePath}`);\n }\n }\n\n // Fall back to default values if alias resolution fails\n log('Using default @idealyst/theme values');\n const defaultValues = getDefaultThemeValues();\n mergeThemeValues(values, defaultValues);\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', 'danger', 'warning', 'neutral', 'info'],\n sizes: {\n button: ['xs', 'sm', 'md', 'lg', 'xl'],\n iconButton: ['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 alert: ['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// Global aliases configuration (set via plugin options)\nlet packageAliases: Record<string, string> = {};\n\n/**\n * Resolve an import source using configured aliases.\n * Returns the resolved path or null if no alias matches.\n */\nfunction resolveWithAliases(source: string, fromDir: string): string | null {\n for (const [aliasPrefix, aliasPath] of Object.entries(packageAliases)) {\n if (source === aliasPrefix || source.startsWith(aliasPrefix + '/')) {\n // Replace the alias prefix with the actual path\n const remainder = source.slice(aliasPrefix.length);\n let resolved = aliasPath + remainder;\n\n // If aliasPath is relative, resolve from fromDir\n if (!path.isAbsolute(resolved)) {\n resolved = path.resolve(fromDir, resolved);\n }\n\n return resolved;\n }\n }\n return null;\n}\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, optional aliases)\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; aliases?: Record<string, 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 // Set up package aliases for resolution\n if (opts.aliases && typeof opts.aliases === 'object') {\n packageAliases = opts.aliases;\n if (verboseMode) {\n console.log('[idealyst-plugin] Configured aliases:', packageAliases);\n }\n }\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 // First try to resolve using aliases\n let resolvedPath: string;\n const aliasResolved = resolveWithAliases(themePath, rootDir);\n if (aliasResolved && fs.existsSync(aliasResolved)) {\n resolvedPath = aliasResolved;\n } else {\n resolvedPath = themePath.startsWith('.')\n ? path.resolve(rootDir, themePath)\n : themePath;\n }\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","/**\n * Theme Source Analyzer - Extracts all theme values directly from TypeScript source.\n *\n * This analyzer parses the theme file and extracts all values from the builder API\n * without relying on hardcoded defaults. It traces:\n * - createTheme() / fromTheme(base)\n * - .addIntent('name', {...})\n * - .addRadius('name', value)\n * - .addShadow('name', {...})\n * - .setSizes({ component: { size: {...}, ... }, ... })\n * - .setColors({ surface: {...}, text: {...}, border: {...}, pallet: {...} })\n * - .setBreakpoints({ xs: 0, sm: 576, ... })\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\nexport interface ThemeSourceAnalyzerOptions {\n /** Enable verbose logging */\n verbose?: boolean;\n /** Package aliases for resolving imports (e.g., { '@idealyst/theme': '/path/to/packages/theme' }) */\n aliases?: Record<string, string>;\n}\n\ninterface AnalyzerContext {\n program: ts.Program;\n typeChecker: ts.TypeChecker;\n verbose: boolean;\n aliases: Record<string, string>;\n /** Track analyzed files to avoid cycles */\n analyzedFiles: Set<string>;\n}\n\n/**\n * Analyze a theme file and extract all theme values.\n * This is the main entry point for theme analysis.\n */\nexport function analyzeThemeSource(\n themePath: string,\n options: ThemeSourceAnalyzerOptions = {}\n): ThemeValues {\n const resolvedPath = path.resolve(themePath);\n const verbose = options.verbose ?? false;\n const aliases = options.aliases ?? {};\n\n const log = (...args: unknown[]) => {\n if (verbose) console.log('[theme-source-analyzer]', ...args);\n };\n\n if (!fs.existsSync(resolvedPath)) {\n throw new Error(`Theme file not found: ${resolvedPath}`);\n }\n\n log('Analyzing theme file:', resolvedPath);\n\n // Create a TypeScript program with proper module resolution\n const configPath = ts.findConfigFile(path.dirname(resolvedPath), ts.sys.fileExists, 'tsconfig.json');\n let compilerOptions: ts.CompilerOptions = {\n target: ts.ScriptTarget.ES2020,\n module: ts.ModuleKind.ESNext,\n moduleResolution: ts.ModuleResolutionKind.Node10,\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n allowSyntheticDefaultImports: true,\n resolveJsonModule: true,\n };\n\n if (configPath) {\n const configFile = ts.readConfigFile(configPath, ts.sys.readFile);\n if (!configFile.error) {\n const parsed = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(configPath));\n compilerOptions = { ...compilerOptions, ...parsed.options };\n }\n }\n\n const program = ts.createProgram([resolvedPath], compilerOptions);\n const sourceFile = program.getSourceFile(resolvedPath);\n\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 aliases,\n analyzedFiles: new Set([resolvedPath]),\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 log(` Import: ${localName} from '${source}'`);\n }\n }\n }\n });\n\n /**\n * Resolve an import path using aliases.\n */\n function resolveImportPath(source: string, fromFile: string): string | null {\n // Check aliases first\n for (const [aliasPrefix, aliasPath] of Object.entries(ctx.aliases)) {\n if (source === aliasPrefix || source.startsWith(aliasPrefix + '/')) {\n const remainder = source.slice(aliasPrefix.length);\n let resolved = aliasPath + remainder;\n if (!path.isAbsolute(resolved)) {\n resolved = path.resolve(path.dirname(fromFile), resolved);\n }\n return resolved;\n }\n }\n\n // Try relative resolution\n if (source.startsWith('.')) {\n return path.resolve(path.dirname(fromFile), source);\n }\n\n // Try node_modules resolution\n try {\n return require.resolve(source, { paths: [path.dirname(fromFile)] });\n } catch {\n return null;\n }\n }\n\n /**\n * Find a theme file from a resolved directory/file path.\n */\n function findThemeFile(basePath: string, preferDark: boolean): string | null {\n const themeFileName = preferDark ? 'darkTheme' : 'lightTheme';\n\n const candidates = [\n basePath,\n `${basePath}.ts`,\n `${basePath}.tsx`,\n path.join(basePath, 'src', `${themeFileName}.ts`),\n path.join(basePath, `${themeFileName}.ts`),\n path.join(basePath, 'src', 'index.ts'),\n path.join(basePath, 'index.ts'),\n ];\n\n for (const candidate of candidates) {\n if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {\n return candidate;\n }\n }\n\n return null;\n }\n\n /**\n * Analyze a base theme file recursively.\n */\n function analyzeBaseTheme(varName: string): void {\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(`Analyzing base theme '${varName}' from '${importInfo.source}'`);\n\n const resolvedBase = resolveImportPath(importInfo.source, resolvedPath);\n if (!resolvedBase) {\n log(`Could not resolve import path: ${importInfo.source}`);\n return;\n }\n\n const preferDark = varName.toLowerCase().includes('dark');\n const themeFile = findThemeFile(resolvedBase, preferDark);\n\n if (!themeFile) {\n log(`Could not find theme file for: ${resolvedBase}`);\n return;\n }\n\n if (ctx.analyzedFiles.has(themeFile)) {\n log(`Already analyzed: ${themeFile}`);\n return;\n }\n\n ctx.analyzedFiles.add(themeFile);\n log(`Recursively analyzing: ${themeFile}`);\n\n // Parse and analyze the base theme file\n const baseValues = analyzeThemeSource(themeFile, { verbose, aliases });\n\n // Merge base values (base values come first, current file can override)\n mergeThemeValues(values, baseValues, false);\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[] = []): { calls: BuilderCall[]; baseThemeVar: string | null } {\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 return { calls, baseThemeVar: arg.text };\n }\n }\n }\n return { calls, baseThemeVar: null };\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, baseThemeVar: null };\n }\n\n /**\n * Get a string value from an AST node.\n */\n function 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 if (ts.isNoSubstitutionTemplateLiteral(node)) return node.text;\n return null;\n }\n\n /**\n * Get all keys from an object literal.\n */\n function getObjectKeys(node: ts.ObjectLiteralExpression): string[] {\n return node.properties\n .filter((prop): prop is ts.PropertyAssignment => ts.isPropertyAssignment(prop))\n .map(prop => {\n if (ts.isIdentifier(prop.name)) return prop.name.text;\n if (ts.isStringLiteral(prop.name)) return prop.name.text;\n return null;\n })\n .filter((k): k is string => k !== null);\n }\n\n /**\n * Process the collected builder method calls and extract values.\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 case 'setIntent': {\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\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\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\n case 'addBreakpoint': {\n const name = getStringValue(args[0]);\n if (name && !values.breakpoints.includes(name)) {\n values.breakpoints.push(name);\n log(` Found breakpoint: ${name}`);\n }\n break;\n }\n\n case 'setBreakpoints': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n const keys = getObjectKeys(args[0]);\n for (const key of keys) {\n if (!values.breakpoints.includes(key)) {\n values.breakpoints.push(key);\n }\n }\n log(` Found breakpoints: ${values.breakpoints.join(', ')}`);\n }\n break;\n }\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 let componentName: string | null = null;\n if (ts.isIdentifier(prop.name)) {\n componentName = prop.name.text;\n } else if (ts.isStringLiteral(prop.name)) {\n componentName = prop.name.text;\n }\n\n if (componentName && ts.isObjectLiteralExpression(prop.initializer)) {\n const sizeKeys = getObjectKeys(prop.initializer);\n values.sizes[componentName] = sizeKeys;\n log(` Found sizes for ${componentName}: ${sizeKeys.join(', ')}`);\n\n // Special case: typography sizes also populate the typography array\n if (componentName === 'typography') {\n for (const key of sizeKeys) {\n if (!values.typography.includes(key)) {\n values.typography.push(key);\n }\n }\n }\n }\n }\n }\n } else if (args[0] && ts.isPropertyAccessExpression(args[0])) {\n // Handle references like: .setSizes(lightTheme.sizes)\n const propAccess = args[0];\n if (ts.isIdentifier(propAccess.expression) && propAccess.name.text === 'sizes') {\n const themeVarName = propAccess.expression.text;\n log(` Found sizes reference: ${themeVarName}.sizes`);\n\n // Try to resolve this by analyzing the referenced theme\n const importInfo = imports.get(themeVarName);\n if (importInfo) {\n log(` Resolving sizes from imported theme: ${importInfo.source}`);\n const resolvedBase = resolveImportPath(importInfo.source, resolvedPath);\n if (resolvedBase) {\n const preferDark = themeVarName.toLowerCase().includes('dark');\n const themeFile = findThemeFile(resolvedBase, preferDark);\n if (themeFile && !ctx.analyzedFiles.has(themeFile)) {\n ctx.analyzedFiles.add(themeFile);\n const baseValues = analyzeThemeSource(themeFile, { verbose, aliases });\n // Copy sizes from base theme\n for (const [comp, sizes] of Object.entries(baseValues.sizes)) {\n if (!values.sizes[comp]) {\n values.sizes[comp] = sizes;\n log(` Inherited sizes for ${comp}: ${sizes.join(', ')}`);\n }\n }\n // Also copy typography if we inherited it\n for (const typo of baseValues.typography) {\n if (!values.typography.includes(typo)) {\n values.typography.push(typo);\n }\n }\n }\n }\n }\n }\n }\n break;\n }\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 let colorType: string | null = null;\n if (ts.isIdentifier(prop.name)) {\n colorType = prop.name.text;\n } else if (ts.isStringLiteral(prop.name)) {\n colorType = prop.name.text;\n }\n\n if (colorType && ts.isObjectLiteralExpression(prop.initializer)) {\n const colorKeys = getObjectKeys(prop.initializer);\n switch (colorType) {\n case 'surface':\n values.surfaceColors = colorKeys;\n log(` Found surface colors: ${colorKeys.join(', ')}`);\n break;\n case 'text':\n values.textColors = colorKeys;\n log(` Found text colors: ${colorKeys.join(', ')}`);\n break;\n case 'border':\n values.borderColors = colorKeys;\n log(` Found border colors: ${colorKeys.join(', ')}`);\n break;\n }\n }\n // Handle function calls like generateColorPallette() for pallet\n // We skip pallet since it's typically generated dynamically\n }\n }\n }\n break;\n }\n\n case 'addSurfaceColor':\n case 'setSurfaceColor': {\n const name = getStringValue(args[0]);\n if (name && !values.surfaceColors.includes(name)) {\n values.surfaceColors.push(name);\n log(` Found surface color: ${name}`);\n }\n break;\n }\n\n case 'addTextColor':\n case 'setTextColor': {\n const name = getStringValue(args[0]);\n if (name && !values.textColors.includes(name)) {\n values.textColors.push(name);\n log(` Found text color: ${name}`);\n }\n break;\n }\n\n case 'addBorderColor':\n case 'setBorderColor': {\n const name = getStringValue(args[0]);\n if (name && !values.borderColors.includes(name)) {\n values.borderColors.push(name);\n log(` Found border color: ${name}`);\n }\n break;\n }\n\n case 'addPalletColor':\n case 'setPalletColor': {\n // For pallet colors, we just track that they exist\n // The actual shade keys (50-900) are always the same\n const name = getStringValue(args[0]);\n if (name) {\n log(` Found pallet color: ${name}`);\n }\n break;\n }\n\n case 'build':\n // End of chain, nothing to extract\n break;\n\n default:\n log(` Skipping unknown method: ${method}`);\n }\n }\n }\n\n /**\n * Process a node that might be a builder chain ending with .build().\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) && node.expression.name.text === 'build') {\n log('Found .build() call, tracing chain...');\n const { calls, baseThemeVar } = traceBuilderCalls(node);\n\n // First analyze base theme if there is one\n if (baseThemeVar) {\n log(`Found fromTheme(${baseThemeVar})`);\n analyzeBaseTheme(baseThemeVar);\n }\n\n // Then process this file's calls (can override base)\n processCalls(calls);\n return;\n }\n\n // Recurse into children\n ts.forEachChild(node, processBuilderChain);\n }\n\n // Main analysis pass: find and process builder chains\n ts.forEachChild(sourceFile, (node) => {\n // Handle variable declarations: const lightTheme = createTheme()...build();\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\n // Handle export statements: export const theme = ...\n if (ts.isExportAssignment(node)) {\n processBuilderChain(node.expression);\n }\n });\n\n log('Analysis complete:');\n log(` Intents: ${values.intents.join(', ')}`);\n log(` Radii: ${values.radii.join(', ')}`);\n log(` Shadows: ${values.shadows.join(', ')}`);\n log(` Breakpoints: ${values.breakpoints.join(', ')}`);\n log(` Typography: ${values.typography.join(', ')}`);\n log(` Size components: ${Object.keys(values.sizes).join(', ')}`);\n\n return values;\n}\n\n/**\n * Merge source theme values into target.\n * @param target - The target to merge into\n * @param source - The source to merge from\n * @param sourceOverrides - If true, source values replace target; if false, target values take precedence\n */\nfunction mergeThemeValues(target: ThemeValues, source: ThemeValues, sourceOverrides: boolean): void {\n // Helper to merge arrays without duplicates\n const mergeArrays = (targetArr: string[], sourceArr: string[]): void => {\n for (const item of sourceArr) {\n if (!targetArr.includes(item)) {\n targetArr.push(item);\n }\n }\n };\n\n mergeArrays(target.intents, source.intents);\n mergeArrays(target.radii, source.radii);\n mergeArrays(target.shadows, source.shadows);\n mergeArrays(target.breakpoints, source.breakpoints);\n mergeArrays(target.typography, source.typography);\n mergeArrays(target.surfaceColors, source.surfaceColors);\n mergeArrays(target.textColors, source.textColors);\n mergeArrays(target.borderColors, source.borderColors);\n\n // Merge sizes - component by component\n for (const [component, sizes] of Object.entries(source.sizes)) {\n if (sourceOverrides || !target.sizes[component]) {\n target.sizes[component] = sizes;\n }\n }\n}\n\n/**\n * Convert ThemeValues to the format expected by the Babel plugin.\n */\nexport interface BabelThemeKeys {\n intents: string[];\n sizes: Record<string, string[]>;\n radii: string[];\n shadows: string[];\n typography: string[];\n}\n\nexport function toBabelThemeKeys(values: ThemeValues): BabelThemeKeys {\n return {\n intents: values.intents,\n sizes: values.sizes,\n radii: values.radii,\n shadows: values.shadows,\n typography: values.typography,\n };\n}\n","/**\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","import { FileType } from '../types';\nimport * as path from 'path';\n\n/**\n * Extension patterns for classification\n * Order matters - more specific patterns should come first\n */\nconst EXTENSION_PATTERNS: Array<{ pattern: RegExp; type: FileType }> = [\n // Platform-specific component files\n { pattern: /\\.web\\.(tsx|jsx)$/, type: 'web' },\n { pattern: /\\.native\\.(tsx|jsx)$/, type: 'native' },\n { pattern: /\\.ios\\.(tsx|jsx)$/, type: 'native' },\n { pattern: /\\.android\\.(tsx|jsx)$/, type: 'native' },\n\n // Style files (can be .ts or .tsx)\n { pattern: /\\.styles?\\.(tsx?|jsx?)$/, type: 'styles' },\n\n // Type definition files\n { pattern: /\\.types?\\.(ts|tsx)$/, type: 'types' },\n { pattern: /types\\.(ts|tsx)$/, type: 'types' },\n { pattern: /\\.d\\.ts$/, type: 'types' },\n\n // Shared component files (generic .tsx/.jsx without platform suffix)\n { pattern: /\\.(tsx|jsx)$/, type: 'shared' },\n];\n\n/**\n * Files that should be classified as 'other' regardless of extension\n */\nconst EXCLUDED_PATTERNS: RegExp[] = [\n /\\.test\\.(tsx?|jsx?)$/,\n /\\.spec\\.(tsx?|jsx?)$/,\n /\\.stories\\.(tsx?|jsx?)$/,\n /\\.config\\.(ts|js)$/,\n /index\\.(ts|tsx|js|jsx)$/,\n];\n\n/**\n * Classifies a file based on its path and extension\n *\n * @param filePath - The file path to classify\n * @returns The file type classification\n *\n * @example\n * classifyFile('Button.tsx') // 'shared'\n * classifyFile('Button.web.tsx') // 'web'\n * classifyFile('Button.native.tsx') // 'native'\n * classifyFile('Button.styles.tsx') // 'styles'\n * classifyFile('types.ts') // 'types'\n */\nexport function classifyFile(filePath: string): FileType {\n const fileName = path.basename(filePath);\n\n // Check if this file should be excluded from component analysis\n for (const pattern of EXCLUDED_PATTERNS) {\n if (pattern.test(fileName)) {\n return 'other';\n }\n }\n\n // Match against extension patterns\n for (const { pattern, type } of EXTENSION_PATTERNS) {\n if (pattern.test(fileName)) {\n return type;\n }\n }\n\n return 'other';\n}\n\n/**\n * Checks if a file is a component file that should be analyzed\n *\n * @param filePath - The file path to check\n * @returns True if the file is a component file (.tsx or .jsx)\n */\nexport function isComponentFile(filePath: string): boolean {\n const fileType = classifyFile(filePath);\n return fileType === 'shared' || fileType === 'web' || fileType === 'native';\n}\n\n/**\n * Checks if a file is a shared (cross-platform) component file\n * These are the files that should NOT contain platform-specific imports\n *\n * @param filePath - The file path to check\n * @returns True if the file is a shared component file\n */\nexport function isSharedFile(filePath: string): boolean {\n return classifyFile(filePath) === 'shared';\n}\n\n/**\n * Checks if a file is platform-specific\n *\n * @param filePath - The file path to check\n * @returns True if the file is web or native specific\n */\nexport function isPlatformSpecificFile(filePath: string): boolean {\n const fileType = classifyFile(filePath);\n return fileType === 'web' || fileType === 'native';\n}\n\n/**\n * Gets the expected platform for a file\n *\n * @param filePath - The file path to check\n * @returns The expected platform, or null for shared/other files\n */\nexport function getExpectedPlatform(filePath: string): 'web' | 'native' | null {\n const fileType = classifyFile(filePath);\n if (fileType === 'web') return 'web';\n if (fileType === 'native') return 'native';\n return null;\n}\n\n/**\n * Extracts the base component name from a file path\n *\n * @param filePath - The file path\n * @returns The base component name without platform suffix or extension\n *\n * @example\n * getBaseName('Button.web.tsx') // 'Button'\n * getBaseName('Button.native.tsx') // 'Button'\n * getBaseName('Button.tsx') // 'Button'\n */\nexport function getBaseName(filePath: string): string {\n const fileName = path.basename(filePath);\n return fileName\n .replace(/\\.(web|native|ios|android)\\.(tsx|jsx|ts|js)$/, '')\n .replace(/\\.styles?\\.(tsx|jsx|ts|js)$/, '')\n .replace(/\\.types?\\.(tsx|ts)$/, '')\n .replace(/\\.(tsx|jsx|ts|js)$/, '');\n}\n","import * as ts from 'typescript';\nimport { ImportInfo, Platform } from '../types';\nimport { REACT_NATIVE_SOURCES, REACT_DOM_SOURCES } from '../rules';\n\n/**\n * Options for import parsing\n */\nexport interface ImportParserOptions {\n /** Additional sources to treat as React Native */\n additionalNativeSources?: string[];\n /** Additional sources to treat as React DOM */\n additionalDomSources?: string[];\n}\n\n/**\n * Determines the platform for a given import source\n */\nexport function getPlatformForSource(\n source: string,\n options?: ImportParserOptions\n): Platform {\n const nativeSources = new Set([\n ...REACT_NATIVE_SOURCES,\n ...(options?.additionalNativeSources ?? []),\n ]);\n\n const domSources = new Set([\n ...REACT_DOM_SOURCES,\n ...(options?.additionalDomSources ?? []),\n ]);\n\n // Check for exact matches first\n if (nativeSources.has(source)) return 'react-native';\n if (domSources.has(source)) return 'react-dom';\n\n // Check for prefix matches (e.g., 'react-native-xxx')\n if (source.startsWith('react-native')) return 'react-native';\n if (source.startsWith('react-dom')) return 'react-dom';\n\n return 'neutral';\n}\n\n/**\n * Parses import statements from TypeScript/JavaScript source code\n *\n * @param sourceCode - The source code to parse\n * @param filePath - Optional file path for better error messages\n * @param options - Parser options\n * @returns Array of import information\n */\nexport function parseImports(\n sourceCode: string,\n filePath: string = 'unknown.tsx',\n options?: ImportParserOptions\n): ImportInfo[] {\n const imports: ImportInfo[] = [];\n\n // Create a source file from the code\n const sourceFile = ts.createSourceFile(\n filePath,\n sourceCode,\n ts.ScriptTarget.Latest,\n true,\n filePath.endsWith('.tsx') || filePath.endsWith('.jsx')\n ? ts.ScriptKind.TSX\n : ts.ScriptKind.TS\n );\n\n // Walk the AST to find import declarations\n const visit = (node: ts.Node): void => {\n if (ts.isImportDeclaration(node)) {\n const importInfo = parseImportDeclaration(node, sourceFile, options);\n imports.push(...importInfo);\n }\n\n // Also check for require() calls\n if (\n ts.isCallExpression(node) &&\n ts.isIdentifier(node.expression) &&\n node.expression.text === 'require' &&\n node.arguments.length === 1 &&\n ts.isStringLiteral(node.arguments[0])\n ) {\n const source = node.arguments[0].text;\n const { line, character } = sourceFile.getLineAndCharacterOfPosition(\n node.getStart()\n );\n\n imports.push({\n name: 'require',\n source,\n platform: getPlatformForSource(source, options),\n line: line + 1,\n column: character + 1,\n isDefault: false,\n isNamespace: true,\n isTypeOnly: false,\n });\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n\n return imports;\n}\n\n/**\n * Parses a single import declaration into ImportInfo objects\n */\nfunction parseImportDeclaration(\n node: ts.ImportDeclaration,\n sourceFile: ts.SourceFile,\n options?: ImportParserOptions\n): ImportInfo[] {\n const imports: ImportInfo[] = [];\n\n // Get the module specifier (the source)\n if (!ts.isStringLiteral(node.moduleSpecifier)) {\n return imports;\n }\n\n const source = node.moduleSpecifier.text;\n const platform = getPlatformForSource(source, options);\n const isTypeOnly = node.importClause?.isTypeOnly ?? false;\n\n const importClause = node.importClause;\n if (!importClause) {\n // Side-effect import: import 'module'\n return imports;\n }\n\n // Default import: import X from 'module'\n if (importClause.name) {\n const { line, character } = sourceFile.getLineAndCharacterOfPosition(\n importClause.name.getStart()\n );\n\n imports.push({\n name: importClause.name.text,\n source,\n platform,\n line: line + 1,\n column: character + 1,\n isDefault: true,\n isNamespace: false,\n isTypeOnly,\n });\n }\n\n // Named and namespace imports\n const namedBindings = importClause.namedBindings;\n if (namedBindings) {\n if (ts.isNamespaceImport(namedBindings)) {\n // Namespace import: import * as X from 'module'\n const { line, character } = sourceFile.getLineAndCharacterOfPosition(\n namedBindings.name.getStart()\n );\n\n imports.push({\n name: namedBindings.name.text,\n source,\n platform,\n line: line + 1,\n column: character + 1,\n isDefault: false,\n isNamespace: true,\n isTypeOnly,\n });\n } else if (ts.isNamedImports(namedBindings)) {\n // Named imports: import { X, Y as Z } from 'module'\n for (const element of namedBindings.elements) {\n const { line, character } = sourceFile.getLineAndCharacterOfPosition(\n element.name.getStart()\n );\n\n const importedName = element.propertyName?.text ?? element.name.text;\n const localName = element.name.text;\n\n imports.push({\n name: localName,\n originalName: element.propertyName ? importedName : undefined,\n source,\n platform,\n line: line + 1,\n column: character + 1,\n isDefault: false,\n isNamespace: false,\n isTypeOnly: isTypeOnly || element.isTypeOnly,\n });\n }\n }\n }\n\n return imports;\n}\n\n/**\n * Filters imports to only those from platform-specific sources\n */\nexport function filterPlatformImports(\n imports: ImportInfo[],\n platform?: Platform\n): ImportInfo[] {\n return imports.filter((imp) => {\n if (imp.platform === 'neutral') return false;\n if (platform && imp.platform !== platform) return false;\n return true;\n });\n}\n\n/**\n * Gets all unique import sources from a list of imports\n */\nexport function getUniqueSources(imports: ImportInfo[]): string[] {\n return [...new Set(imports.map((imp) => imp.source))];\n}\n\n/**\n * Groups imports by their source module\n */\nexport function groupImportsBySource(\n imports: ImportInfo[]\n): Map<string, ImportInfo[]> {\n const grouped = new Map<string, ImportInfo[]>();\n\n for (const imp of imports) {\n const existing = grouped.get(imp.source) ?? [];\n existing.push(imp);\n grouped.set(imp.source, existing);\n }\n\n return grouped;\n}\n","import { PrimitiveRule, PrimitiveRuleSet } from '../types';\n\n/**\n * Module sources that indicate React Native platform\n */\nexport const REACT_NATIVE_SOURCES = [\n 'react-native',\n 'react-native-web',\n 'react-native-gesture-handler',\n 'react-native-reanimated',\n 'react-native-safe-area-context',\n 'react-native-screens',\n 'react-native-svg',\n '@react-native-vector-icons/material-design-icons',\n '@react-native-vector-icons/common',\n '@react-native-community/async-storage',\n '@react-native-picker/picker',\n 'expo',\n 'expo-constants',\n 'expo-linking',\n 'expo-status-bar',\n] as const;\n\n/**\n * Core React Native view primitives\n */\nconst CORE_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'View',\n source: 'react-native',\n platform: 'react-native',\n description: 'Basic container component',\n },\n {\n name: 'Text',\n source: 'react-native',\n platform: 'react-native',\n description: 'Text display component',\n },\n {\n name: 'Image',\n source: 'react-native',\n platform: 'react-native',\n description: 'Image display component',\n },\n {\n name: 'ImageBackground',\n source: 'react-native',\n platform: 'react-native',\n description: 'Background image container',\n },\n {\n name: 'ScrollView',\n source: 'react-native',\n platform: 'react-native',\n description: 'Scrollable container',\n },\n {\n name: 'FlatList',\n source: 'react-native',\n platform: 'react-native',\n description: 'Performant list component',\n },\n {\n name: 'SectionList',\n source: 'react-native',\n platform: 'react-native',\n description: 'Sectioned list component',\n },\n {\n name: 'VirtualizedList',\n source: 'react-native',\n platform: 'react-native',\n description: 'Base virtualized list',\n },\n];\n\n/**\n * Interactive/touchable primitives\n */\nconst INTERACTIVE_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'TouchableOpacity',\n source: 'react-native',\n platform: 'react-native',\n description: 'Touch with opacity feedback',\n },\n {\n name: 'TouchableHighlight',\n source: 'react-native',\n platform: 'react-native',\n description: 'Touch with highlight feedback',\n },\n {\n name: 'TouchableWithoutFeedback',\n source: 'react-native',\n platform: 'react-native',\n description: 'Touch without visual feedback',\n },\n {\n name: 'TouchableNativeFeedback',\n source: 'react-native',\n platform: 'react-native',\n description: 'Android ripple feedback',\n },\n {\n name: 'Pressable',\n source: 'react-native',\n platform: 'react-native',\n description: 'Modern press handler component',\n },\n {\n name: 'Button',\n source: 'react-native',\n platform: 'react-native',\n description: 'Basic button component',\n },\n];\n\n/**\n * Input primitives\n */\nconst INPUT_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'TextInput',\n source: 'react-native',\n platform: 'react-native',\n description: 'Text input field',\n },\n {\n name: 'Switch',\n source: 'react-native',\n platform: 'react-native',\n description: 'Toggle switch component',\n },\n {\n name: 'Slider',\n source: 'react-native',\n platform: 'react-native',\n description: 'Slider input (deprecated)',\n },\n];\n\n/**\n * Modal and overlay primitives\n */\nconst MODAL_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'Modal',\n source: 'react-native',\n platform: 'react-native',\n description: 'Modal overlay component',\n },\n {\n name: 'Alert',\n source: 'react-native',\n platform: 'react-native',\n description: 'Native alert dialog',\n },\n {\n name: 'ActionSheetIOS',\n source: 'react-native',\n platform: 'react-native',\n description: 'iOS action sheet',\n },\n {\n name: 'StatusBar',\n source: 'react-native',\n platform: 'react-native',\n description: 'Status bar controller',\n },\n];\n\n/**\n * Animation primitives\n */\nconst ANIMATION_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'Animated',\n source: 'react-native',\n platform: 'react-native',\n description: 'Animation library namespace',\n },\n {\n name: 'Easing',\n source: 'react-native',\n platform: 'react-native',\n description: 'Easing functions',\n },\n {\n name: 'LayoutAnimation',\n source: 'react-native',\n platform: 'react-native',\n description: 'Layout animation controller',\n },\n];\n\n/**\n * Platform and device primitives\n */\nconst PLATFORM_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'Platform',\n source: 'react-native',\n platform: 'react-native',\n description: 'Platform detection utility',\n },\n {\n name: 'Dimensions',\n source: 'react-native',\n platform: 'react-native',\n description: 'Screen dimensions utility',\n },\n {\n name: 'PixelRatio',\n source: 'react-native',\n platform: 'react-native',\n description: 'Pixel ratio utility',\n },\n {\n name: 'Appearance',\n source: 'react-native',\n platform: 'react-native',\n description: 'Color scheme detection',\n },\n {\n name: 'useColorScheme',\n source: 'react-native',\n platform: 'react-native',\n description: 'Color scheme hook',\n },\n {\n name: 'useWindowDimensions',\n source: 'react-native',\n platform: 'react-native',\n description: 'Window dimensions hook',\n },\n];\n\n/**\n * Event handling primitives\n */\nconst EVENT_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'BackHandler',\n source: 'react-native',\n platform: 'react-native',\n description: 'Android back button handler',\n },\n {\n name: 'Keyboard',\n source: 'react-native',\n platform: 'react-native',\n description: 'Keyboard event handler',\n },\n {\n name: 'PanResponder',\n source: 'react-native',\n platform: 'react-native',\n description: 'Gesture responder system',\n },\n {\n name: 'Linking',\n source: 'react-native',\n platform: 'react-native',\n description: 'Deep linking utility',\n },\n {\n name: 'AppState',\n source: 'react-native',\n platform: 'react-native',\n description: 'App lifecycle state',\n },\n];\n\n/**\n * Safety primitives\n */\nconst SAFETY_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'SafeAreaView',\n source: 'react-native',\n platform: 'react-native',\n description: 'Safe area inset container',\n },\n {\n name: 'KeyboardAvoidingView',\n source: 'react-native',\n platform: 'react-native',\n description: 'Keyboard avoidance container',\n },\n];\n\n/**\n * Accessibility primitives\n */\nconst ACCESSIBILITY_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'AccessibilityInfo',\n source: 'react-native',\n platform: 'react-native',\n description: 'Accessibility information API',\n },\n];\n\n/**\n * Style primitives\n */\nconst STYLE_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'StyleSheet',\n source: 'react-native',\n platform: 'react-native',\n description: 'Style sheet creator',\n },\n];\n\n/**\n * All React Native primitives combined\n */\nexport const REACT_NATIVE_PRIMITIVES: PrimitiveRule[] = [\n ...CORE_PRIMITIVES,\n ...INTERACTIVE_PRIMITIVES,\n ...INPUT_PRIMITIVES,\n ...MODAL_PRIMITIVES,\n ...ANIMATION_PRIMITIVES,\n ...PLATFORM_PRIMITIVES,\n ...EVENT_PRIMITIVES,\n ...SAFETY_PRIMITIVES,\n ...ACCESSIBILITY_PRIMITIVES,\n ...STYLE_PRIMITIVES,\n];\n\n/**\n * Set of primitive names for quick lookup\n */\nexport const REACT_NATIVE_PRIMITIVE_NAMES = new Set(\n REACT_NATIVE_PRIMITIVES.map((p) => p.name)\n);\n\n/**\n * Complete rule set for React Native\n */\nexport const REACT_NATIVE_RULE_SET: PrimitiveRuleSet = {\n platform: 'react-native',\n primitives: REACT_NATIVE_PRIMITIVES,\n sources: [...REACT_NATIVE_SOURCES],\n};\n\n/**\n * Check if a name is a React Native primitive\n */\nexport function isReactNativePrimitive(name: string): boolean {\n return REACT_NATIVE_PRIMITIVE_NAMES.has(name);\n}\n\n/**\n * Get primitive info by name\n */\nexport function getReactNativePrimitive(name: string): PrimitiveRule | undefined {\n return REACT_NATIVE_PRIMITIVES.find((p) => p.name === name);\n}\n","import { PrimitiveRule, PrimitiveRuleSet } from '../types';\n\n/**\n * Module sources that indicate React DOM platform\n */\nexport const REACT_DOM_SOURCES = [\n 'react-dom',\n 'react-dom/client',\n 'react-dom/server',\n] as const;\n\n/**\n * React DOM API primitives\n * These are functions/components that are React DOM specific\n */\nconst DOM_API_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'createPortal',\n source: 'react-dom',\n platform: 'react-dom',\n description: 'Render children into a different DOM node',\n },\n {\n name: 'flushSync',\n source: 'react-dom',\n platform: 'react-dom',\n description: 'Force synchronous DOM updates',\n },\n {\n name: 'createRoot',\n source: 'react-dom/client',\n platform: 'react-dom',\n description: 'Create a React root for rendering',\n },\n {\n name: 'hydrateRoot',\n source: 'react-dom/client',\n platform: 'react-dom',\n description: 'Hydrate server-rendered content',\n },\n {\n name: 'render',\n source: 'react-dom',\n platform: 'react-dom',\n description: 'Legacy render function (deprecated)',\n },\n {\n name: 'hydrate',\n source: 'react-dom',\n platform: 'react-dom',\n description: 'Legacy hydrate function (deprecated)',\n },\n {\n name: 'unmountComponentAtNode',\n source: 'react-dom',\n platform: 'react-dom',\n description: 'Legacy unmount function (deprecated)',\n },\n {\n name: 'findDOMNode',\n source: 'react-dom',\n platform: 'react-dom',\n description: 'Find DOM node (deprecated)',\n },\n];\n\n/**\n * Intrinsic HTML elements that indicate web-only code\n * These are JSX intrinsic elements that only exist in DOM\n *\n * Note: These are detected via JSX usage, not imports\n * This list is for reference and specialized detection\n */\nexport const HTML_INTRINSIC_ELEMENTS = [\n // Document structure\n 'html',\n 'head',\n 'body',\n 'main',\n 'header',\n 'footer',\n 'nav',\n 'aside',\n 'article',\n 'section',\n\n // Content sectioning\n 'div',\n 'span',\n 'p',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n\n // Text content\n 'a',\n 'strong',\n 'em',\n 'code',\n 'pre',\n 'blockquote',\n 'br',\n 'hr',\n\n // Lists\n 'ul',\n 'ol',\n 'li',\n 'dl',\n 'dt',\n 'dd',\n\n // Tables\n 'table',\n 'thead',\n 'tbody',\n 'tfoot',\n 'tr',\n 'th',\n 'td',\n 'caption',\n 'colgroup',\n 'col',\n\n // Forms\n 'form',\n 'input',\n 'textarea',\n 'select',\n 'option',\n 'optgroup',\n 'button',\n 'label',\n 'fieldset',\n 'legend',\n 'datalist',\n 'output',\n 'progress',\n 'meter',\n\n // Media\n 'img',\n 'video',\n 'audio',\n 'source',\n 'track',\n 'picture',\n 'figure',\n 'figcaption',\n 'canvas',\n 'svg',\n 'iframe',\n 'embed',\n 'object',\n\n // Interactive\n 'details',\n 'summary',\n 'dialog',\n 'menu',\n\n // Scripting\n 'script',\n 'noscript',\n 'template',\n 'slot',\n] as const;\n\n/**\n * All React DOM primitives (API functions)\n */\nexport const REACT_DOM_PRIMITIVES: PrimitiveRule[] = [...DOM_API_PRIMITIVES];\n\n/**\n * Set of primitive names for quick lookup\n */\nexport const REACT_DOM_PRIMITIVE_NAMES = new Set(\n REACT_DOM_PRIMITIVES.map((p) => p.name)\n);\n\n/**\n * Set of HTML intrinsic element names for quick lookup\n */\nexport const HTML_ELEMENT_NAMES: Set<string> = new Set(HTML_INTRINSIC_ELEMENTS);\n\n/**\n * Complete rule set for React DOM\n */\nexport const REACT_DOM_RULE_SET: PrimitiveRuleSet = {\n platform: 'react-dom',\n primitives: REACT_DOM_PRIMITIVES,\n sources: [...REACT_DOM_SOURCES],\n};\n\n/**\n * Check if a name is a React DOM primitive (API function)\n */\nexport function isReactDomPrimitive(name: string): boolean {\n return REACT_DOM_PRIMITIVE_NAMES.has(name);\n}\n\n/**\n * Check if a name is an HTML intrinsic element\n */\nexport function isHtmlElement(name: string): boolean {\n return HTML_ELEMENT_NAMES.has(name);\n}\n\n/**\n * Get primitive info by name\n */\nexport function getReactDomPrimitive(name: string): PrimitiveRule | undefined {\n return REACT_DOM_PRIMITIVES.find((p) => p.name === name);\n}\n","import {\n AnalyzerOptions,\n AnalysisResult,\n FileInput,\n ImportInfo,\n Severity,\n Violation,\n ViolationType,\n} from '../types';\nimport { classifyFile } from '../utils/fileClassifier';\nimport { parseImports } from '../utils/importParser';\nimport {\n REACT_NATIVE_SOURCES,\n isReactNativePrimitive,\n} from '../rules/reactNativePrimitives';\nimport {\n isReactDomPrimitive,\n} from '../rules/reactDomPrimitives';\n\n/**\n * Default analyzer options\n */\nconst DEFAULT_OPTIONS: Required<AnalyzerOptions> = {\n severity: 'error',\n additionalNativePrimitives: [],\n additionalDomPrimitives: [],\n ignoredPrimitives: [],\n ignoredPatterns: [],\n additionalNativeSources: [],\n additionalDomSources: [],\n};\n\n/**\n * Check if a file path matches any of the ignored patterns\n */\nfunction matchesIgnoredPattern(\n filePath: string,\n patterns: string[]\n): boolean {\n if (patterns.length === 0) return false;\n\n for (const pattern of patterns) {\n // Simple glob matching - convert glob to regex\n const regexPattern = pattern\n .replace(/\\*\\*/g, '{{GLOBSTAR}}')\n .replace(/\\*/g, '[^/]*')\n .replace(/{{GLOBSTAR}}/g, '.*')\n .replace(/\\?/g, '.');\n\n const regex = new RegExp(regexPattern);\n if (regex.test(filePath)) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Creates a violation object\n */\nfunction createViolation(\n type: ViolationType,\n primitive: string,\n source: string,\n filePath: string,\n line: number,\n column: number,\n severity: Severity\n): Violation {\n const messages: Record<ViolationType, string> = {\n 'native-in-shared': `React Native primitive '${primitive}' from '${source}' should not be used in shared files. Use a .native.tsx file instead.`,\n 'dom-in-shared': `React DOM primitive '${primitive}' from '${source}' should not be used in shared files. Use a .web.tsx file instead.`,\n 'native-in-web': `React Native primitive '${primitive}' from '${source}' should not be used in web-specific files.`,\n 'dom-in-native': `React DOM primitive '${primitive}' from '${source}' should not be used in native-specific files.`,\n };\n\n return {\n type,\n primitive,\n source,\n filePath,\n line,\n column,\n message: messages[type],\n severity,\n };\n}\n\n/**\n * Check if an import should be flagged as a React Native primitive\n */\nfunction isNativePrimitive(\n importInfo: ImportInfo,\n additionalPrimitives: string[]\n): boolean {\n const name = importInfo.originalName ?? importInfo.name;\n\n // Check built-in primitives\n if (isReactNativePrimitive(name)) return true;\n\n // Check additional primitives\n if (additionalPrimitives.includes(name)) return true;\n\n // Check if the source is a known React Native source\n const nativeSources: Set<string> = new Set([...REACT_NATIVE_SOURCES]);\n if (nativeSources.has(importInfo.source)) {\n // Any import from react-native that's a component (starts with uppercase)\n if (/^[A-Z]/.test(name)) return true;\n }\n\n return false;\n}\n\n/**\n * Check if an import should be flagged as a React DOM primitive\n */\nfunction isDomPrimitive(\n importInfo: ImportInfo,\n additionalPrimitives: string[]\n): boolean {\n const name = importInfo.originalName ?? importInfo.name;\n\n // Check built-in primitives\n if (isReactDomPrimitive(name)) return true;\n\n // Check additional primitives\n if (additionalPrimitives.includes(name)) return true;\n\n return false;\n}\n\n/**\n * Analyze a single file for platform import violations\n *\n * @param filePath - Path to the file being analyzed\n * @param sourceCode - The source code content\n * @param options - Analyzer options\n * @returns Analysis result with violations\n *\n * @example\n * ```typescript\n * const result = analyzePlatformImports(\n * 'src/components/Button.tsx',\n * sourceCode,\n * { severity: 'error' }\n * );\n *\n * if (result.violations.length > 0) {\n * for (const v of result.violations) {\n * console.error(`${v.filePath}:${v.line}:${v.column} - ${v.message}`);\n * }\n * }\n * ```\n */\nexport function analyzePlatformImports(\n filePath: string,\n sourceCode: string,\n options?: AnalyzerOptions\n): AnalysisResult {\n const opts = { ...DEFAULT_OPTIONS, ...options };\n const fileType = classifyFile(filePath);\n const violations: Violation[] = [];\n\n // Skip ignored files\n if (matchesIgnoredPattern(filePath, opts.ignoredPatterns)) {\n return {\n filePath,\n fileType,\n violations: [],\n imports: [],\n passed: true,\n };\n }\n\n // Skip non-component files\n if (fileType === 'other' || fileType === 'styles' || fileType === 'types') {\n return {\n filePath,\n fileType,\n violations: [],\n imports: [],\n passed: true,\n };\n }\n\n // Parse imports\n const imports = parseImports(sourceCode, filePath, {\n additionalNativeSources: opts.additionalNativeSources,\n additionalDomSources: opts.additionalDomSources,\n });\n\n // Build ignored primitives set\n const ignoredPrimitives = new Set(opts.ignoredPrimitives);\n\n // Analyze each import\n for (const imp of imports) {\n // Skip type-only imports\n if (imp.isTypeOnly) continue;\n\n // Skip ignored primitives\n const primitiveName = imp.originalName ?? imp.name;\n if (ignoredPrimitives.has(primitiveName)) continue;\n\n // Check for violations based on file type\n switch (fileType) {\n case 'shared':\n // Shared files should not use platform-specific imports\n if (isNativePrimitive(imp, opts.additionalNativePrimitives)) {\n violations.push(\n createViolation(\n 'native-in-shared',\n primitiveName,\n imp.source,\n filePath,\n imp.line,\n imp.column,\n opts.severity\n )\n );\n }\n if (isDomPrimitive(imp, opts.additionalDomPrimitives)) {\n violations.push(\n createViolation(\n 'dom-in-shared',\n primitiveName,\n imp.source,\n filePath,\n imp.line,\n imp.column,\n opts.severity\n )\n );\n }\n break;\n\n case 'web':\n // Web files should not use React Native imports\n if (isNativePrimitive(imp, opts.additionalNativePrimitives)) {\n violations.push(\n createViolation(\n 'native-in-web',\n primitiveName,\n imp.source,\n filePath,\n imp.line,\n imp.column,\n opts.severity\n )\n );\n }\n break;\n\n case 'native':\n // Native files should not use React DOM imports\n if (isDomPrimitive(imp, opts.additionalDomPrimitives)) {\n violations.push(\n createViolation(\n 'dom-in-native',\n primitiveName,\n imp.source,\n filePath,\n imp.line,\n imp.column,\n opts.severity\n )\n );\n }\n break;\n }\n }\n\n return {\n filePath,\n fileType,\n violations,\n imports,\n passed: violations.length === 0,\n };\n}\n\n/**\n * Analyze multiple files for platform import violations\n *\n * @param files - Array of files to analyze\n * @param options - Analyzer options\n * @returns Array of analysis results\n *\n * @example\n * ```typescript\n * const results = analyzeFiles(\n * [\n * { path: 'Button.tsx', content: buttonSource },\n * { path: 'Button.web.tsx', content: webSource },\n * { path: 'Button.native.tsx', content: nativeSource },\n * ],\n * { severity: 'warning' }\n * );\n *\n * const failed = results.filter(r => !r.passed);\n * ```\n */\nexport function analyzeFiles(\n files: FileInput[],\n options?: AnalyzerOptions\n): AnalysisResult[] {\n return files.map((file) =>\n analyzePlatformImports(file.path, file.content, options)\n );\n}\n\n/**\n * Get a summary of analysis results\n */\nexport interface AnalysisSummary {\n totalFiles: number;\n passedFiles: number;\n failedFiles: number;\n totalViolations: number;\n violationsByType: Record<ViolationType, number>;\n violationsBySeverity: Record<Severity, number>;\n}\n\n/**\n * Summarize analysis results\n *\n * @param results - Array of analysis results\n * @returns Summary statistics\n */\nexport function summarizeResults(results: AnalysisResult[]): AnalysisSummary {\n const violationsByType: Record<ViolationType, number> = {\n 'native-in-shared': 0,\n 'dom-in-shared': 0,\n 'native-in-web': 0,\n 'dom-in-native': 0,\n };\n\n const violationsBySeverity: Record<Severity, number> = {\n error: 0,\n warning: 0,\n info: 0,\n };\n\n let totalViolations = 0;\n\n for (const result of results) {\n for (const violation of result.violations) {\n totalViolations++;\n violationsByType[violation.type]++;\n violationsBySeverity[violation.severity]++;\n }\n }\n\n return {\n totalFiles: results.length,\n passedFiles: results.filter((r) => r.passed).length,\n failedFiles: results.filter((r) => !r.passed).length,\n totalViolations,\n violationsByType,\n violationsBySeverity,\n };\n}\n\n/**\n * Format a violation for console output\n */\nexport function formatViolation(violation: Violation): string {\n const severityPrefix =\n violation.severity === 'error'\n ? 'ERROR'\n : violation.severity === 'warning'\n ? 'WARN'\n : 'INFO';\n\n return `${severityPrefix}: ${violation.filePath}:${violation.line}:${violation.column} - ${violation.message}`;\n}\n\n/**\n * Format all violations from results for console output\n */\nexport function formatViolations(results: AnalysisResult[]): string[] {\n const lines: string[] = [];\n\n for (const result of results) {\n for (const violation of result.violations) {\n lines.push(formatViolation(violation));\n }\n }\n\n return lines;\n}\n","import { Severity } from '../types';\n\n/**\n * Types of linting issues the component linter can detect.\n *\n * These are issues that TypeScript cannot catch - primarily style/pattern issues\n * that are syntactically valid but violate Idealyst conventions.\n */\nexport type LintIssueType =\n | 'hardcoded-color' // Using color strings like '#fff', 'red', 'rgb()'\n | 'direct-platform-import'; // Importing directly from react-native in shared file\n\n/**\n * A single lint issue found during analysis\n */\nexport interface LintIssue {\n /** Type of lint issue */\n type: LintIssueType;\n /** Severity level */\n severity: Severity;\n /** Line number where issue occurred */\n line: number;\n /** Column number where issue occurred */\n column: number;\n /** The problematic code snippet */\n code: string;\n /** Human-readable message describing the issue */\n message: string;\n /** Suggested fix (if available) */\n suggestion?: string;\n}\n\n/**\n * Result of linting a component file\n */\nexport interface LintResult {\n /** Path to the analyzed file */\n filePath: string;\n /** List of issues found */\n issues: LintIssue[];\n /** Whether the file passed linting (no errors) */\n passed: boolean;\n /** Count of issues by severity */\n counts: {\n error: number;\n warning: number;\n info: number;\n };\n}\n\n/**\n * Options for the component linter\n */\nexport interface ComponentLinterOptions {\n /**\n * Which rules to enable (all enabled by default)\n */\n rules?: {\n /** Detect hardcoded color values like '#fff', 'red', 'rgb()' */\n hardcodedColors?: boolean | Severity;\n /** Detect direct imports from 'react-native' in shared files */\n directPlatformImports?: boolean | Severity;\n };\n\n /**\n * Glob patterns for files to ignore\n */\n ignoredPatterns?: string[];\n\n /**\n * Color values that are allowed (e.g., 'transparent', 'inherit')\n * @default ['transparent', 'inherit', 'currentColor']\n */\n allowedColors?: string[];\n}\n\n// Common CSS color names that indicate hardcoded colors\nconst CSS_COLOR_NAMES = new Set([\n 'aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque',\n 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue',\n 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan',\n 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkgrey',\n 'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred',\n 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategray', 'darkslategrey',\n 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dimgrey',\n 'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro',\n 'ghostwhite', 'gold', 'goldenrod', 'gray', 'green', 'greenyellow', 'grey',\n 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender',\n 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan',\n 'lightgoldenrodyellow', 'lightgray', 'lightgreen', 'lightgrey', 'lightpink',\n 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategray', 'lightslategrey',\n 'lightsteelblue', 'lightyellow', 'lime', 'limegreen', 'linen', 'magenta', 'maroon',\n 'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple', 'mediumseagreen',\n 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise', 'mediumvioletred',\n 'midnightblue', 'mintcream', 'mistyrose', 'moccasin', 'navajowhite', 'navy',\n 'oldlace', 'olive', 'olivedrab', 'orange', 'orangered', 'orchid', 'palegoldenrod',\n 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff', 'peru',\n 'pink', 'plum', 'powderblue', 'purple', 'rebeccapurple', 'red', 'rosybrown',\n 'royalblue', 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna',\n 'silver', 'skyblue', 'slateblue', 'slategray', 'slategrey', 'snow', 'springgreen',\n 'steelblue', 'tan', 'teal', 'thistle', 'tomato', 'turquoise', 'violet', 'wheat',\n 'white', 'whitesmoke', 'yellow', 'yellowgreen',\n]);\n\n// Colors that are generally safe to use\nconst DEFAULT_ALLOWED_COLORS = new Set([\n 'transparent',\n 'inherit',\n 'currentColor',\n 'currentcolor',\n]);\n\n// Style properties that typically use colors\nconst COLOR_PROPERTIES = [\n 'color',\n 'backgroundColor',\n 'borderColor',\n 'borderTopColor',\n 'borderRightColor',\n 'borderBottomColor',\n 'borderLeftColor',\n 'shadowColor',\n 'textDecorationColor',\n 'tintColor',\n 'overlayColor',\n];\n\n/**\n * Check if a string is a hardcoded color value\n */\nfunction isHardcodedColor(value: string, allowedColors: Set<string>): boolean {\n const trimmed = value.trim().toLowerCase();\n\n // Check if it's an allowed color\n if (allowedColors.has(trimmed)) {\n return false;\n }\n\n // Hex color: #fff, #ffffff, #ffffffff\n if (/^#[0-9a-f]{3,8}$/i.test(trimmed)) {\n return true;\n }\n\n // RGB/RGBA: rgb(0,0,0), rgba(0,0,0,0.5)\n if (/^rgba?\\s*\\(/.test(trimmed)) {\n return true;\n }\n\n // HSL/HSLA: hsl(0,0%,0%), hsla(0,0%,0%,0.5)\n if (/^hsla?\\s*\\(/.test(trimmed)) {\n return true;\n }\n\n // CSS named color\n if (CSS_COLOR_NAMES.has(trimmed)) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Get the severity for a rule, handling boolean and severity values\n */\nfunction getRuleSeverity(\n rule: boolean | Severity | undefined,\n defaultSeverity: Severity\n): Severity | null {\n if (rule === false) return null;\n if (rule === true || rule === undefined) return defaultSeverity;\n return rule;\n}\n\n/**\n * Parse source code and find line/column for a match index\n */\nfunction getLineColumn(source: string, index: number): { line: number; column: number } {\n const lines = source.substring(0, index).split('\\n');\n return {\n line: lines.length,\n column: lines[lines.length - 1].length + 1,\n };\n}\n\n/**\n * Lint a component file for Idealyst-specific issues.\n *\n * Detects issues that TypeScript cannot catch:\n * - Hardcoded colors (TypeScript sees these as valid strings)\n * - Direct react-native imports in shared files (valid TS, but breaks web)\n *\n * @param filePath - Path to the file being analyzed\n * @param sourceCode - The source code content\n * @param options - Linter options\n * @returns Lint result with issues found\n *\n * @example\n * ```typescript\n * const result = lintComponent(\n * 'src/components/MyButton.tsx',\n * sourceCode,\n * { rules: { hardcodedColors: 'error' } }\n * );\n *\n * if (!result.passed) {\n * for (const issue of result.issues) {\n * console.error(`${issue.line}:${issue.column} - ${issue.message}`);\n * }\n * }\n * ```\n */\nexport function lintComponent(\n filePath: string,\n sourceCode: string,\n options: ComponentLinterOptions = {}\n): LintResult {\n const issues: LintIssue[] = [];\n const rules = options.rules || {};\n\n const allowedColors = new Set([\n ...DEFAULT_ALLOWED_COLORS,\n ...(options.allowedColors || []).map(c => c.toLowerCase()),\n ]);\n\n // Rule: Hardcoded colors\n const hardcodedColorSeverity = getRuleSeverity(rules.hardcodedColors, 'warning');\n if (hardcodedColorSeverity) {\n // Match color properties with string values\n for (const prop of COLOR_PROPERTIES) {\n // Match: backgroundColor: '#fff' or backgroundColor: \"red\"\n const propRegex = new RegExp(`${prop}\\\\s*:\\\\s*['\"]([^'\"]+)['\"]`, 'g');\n let match;\n while ((match = propRegex.exec(sourceCode)) !== null) {\n const colorValue = match[1];\n if (isHardcodedColor(colorValue, allowedColors)) {\n const { line, column } = getLineColumn(sourceCode, match.index);\n issues.push({\n type: 'hardcoded-color',\n severity: hardcodedColorSeverity,\n line,\n column,\n code: match[0],\n message: `Hardcoded color '${colorValue}' in ${prop}. Use theme colors instead.`,\n suggestion: `Use theme.colors.*, theme.intents[intent].*, or pass color via props`,\n });\n }\n }\n }\n\n // Also check for color/backgroundColor in template literals\n const templateColorRegex = /(?:color|backgroundColor)\\s*:\\s*`[^`]*#[0-9a-fA-F]{3,8}[^`]*`/g;\n let templateMatch;\n while ((templateMatch = templateColorRegex.exec(sourceCode)) !== null) {\n const { line, column } = getLineColumn(sourceCode, templateMatch.index);\n issues.push({\n type: 'hardcoded-color',\n severity: hardcodedColorSeverity,\n line,\n column,\n code: templateMatch[0],\n message: `Hardcoded hex color in template literal. Use theme colors instead.`,\n suggestion: `Use theme.colors.* or theme.intents[intent].*`,\n });\n }\n }\n\n // Rule: Direct platform imports in shared files\n const directPlatformSeverity = getRuleSeverity(rules.directPlatformImports, 'warning');\n if (directPlatformSeverity) {\n // Only check shared files (not .web.tsx or .native.tsx)\n const isSharedFile = !filePath.includes('.web.') && !filePath.includes('.native.');\n if (isSharedFile) {\n // Check for direct react-native imports\n const rnImportRegex = /import\\s+.*\\s+from\\s+['\"]react-native['\"]/g;\n let match;\n while ((match = rnImportRegex.exec(sourceCode)) !== null) {\n const { line, column } = getLineColumn(sourceCode, match.index);\n issues.push({\n type: 'direct-platform-import',\n severity: directPlatformSeverity,\n line,\n column,\n code: match[0],\n message: `Direct import from 'react-native' in shared file. Use @idealyst/components instead.`,\n suggestion: `Import View, Text, etc. from '@idealyst/components'`,\n });\n }\n }\n }\n\n // Calculate counts\n const counts = {\n error: issues.filter(i => i.severity === 'error').length,\n warning: issues.filter(i => i.severity === 'warning').length,\n info: issues.filter(i => i.severity === 'info').length,\n };\n\n return {\n filePath,\n issues,\n passed: counts.error === 0,\n counts,\n };\n}\n\n/**\n * Lint multiple component files\n *\n * @param files - Array of files to lint\n * @param options - Linter options\n * @returns Array of lint results\n */\nexport function lintComponents(\n files: Array<{ path: string; content: string }>,\n options: ComponentLinterOptions = {}\n): LintResult[] {\n return files.map(file => lintComponent(file.path, file.content, options));\n}\n\n/**\n * Format a lint issue for console output\n */\nexport function formatLintIssue(issue: LintIssue, filePath: string): string {\n const severityPrefix = issue.severity === 'error'\n ? 'ERROR'\n : issue.severity === 'warning'\n ? 'WARN'\n : 'INFO';\n\n let output = `${severityPrefix}: ${filePath}:${issue.line}:${issue.column} - ${issue.message}`;\n if (issue.suggestion) {\n output += `\\n Suggestion: ${issue.suggestion}`;\n }\n return output;\n}\n\n/**\n * Format all lint results for console output\n */\nexport function formatLintResults(results: LintResult[]): string[] {\n const lines: string[] = [];\n\n for (const result of results) {\n for (const issue of result.issues) {\n lines.push(formatLintIssue(issue, result.filePath));\n }\n }\n\n return lines;\n}\n\n/**\n * Summary of lint results\n */\nexport interface LintSummary {\n totalFiles: number;\n passedFiles: number;\n failedFiles: number;\n totalIssues: number;\n issuesByType: Record<LintIssueType, number>;\n issuesBySeverity: Record<Severity, number>;\n}\n\n/**\n * Summarize lint results\n */\nexport function summarizeLintResults(results: LintResult[]): LintSummary {\n const issuesByType: Record<LintIssueType, number> = {\n 'hardcoded-color': 0,\n 'direct-platform-import': 0,\n };\n\n const issuesBySeverity: Record<Severity, number> = {\n error: 0,\n warning: 0,\n info: 0,\n };\n\n let totalIssues = 0;\n\n for (const result of results) {\n for (const issue of result.issues) {\n totalIssues++;\n issuesByType[issue.type]++;\n issuesBySeverity[issue.severity]++;\n }\n }\n\n return {\n totalFiles: results.length,\n passedFiles: results.filter(r => r.passed).length,\n failedFiles: results.filter(r => !r.passed).length,\n totalIssues,\n issuesByType,\n issuesBySeverity,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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AK,QAAQ,SAAS,KAAK,QAAQ;AAAA,IAC3E,WAAW,KAAK,SAAS,WAAW;AAClC,UAAI,GAAG,IAAI,EAAE,MAAM,WAAW,SAAS,KAAK,WAAW,MAAM;AAAA,IAC/D,WAAW,KAAK,SAAS,UAAU;AACjC,UAAI,GAAG,IAAI,EAAE,MAAM,QAAQ,SAAS,KAAK,WAAW,GAAG;AAAA,IACzD,WAAW,KAAK,SAAS,UAAU;AACjC,UAAI,GAAG,IAAI,EAAE,MAAM,UAAU,SAAS,KAAK,WAAW,EAAE;AAAA,IAC1D;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAwB;AAC9B;","names":["ts","fs","path","ts","fs","path","analyzeBaseTheme","getStringValue","getObjectKeys","mergeThemeValues","fs","path","isComponentFile","path","ts","isSharedFile"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/analyzer/component-analyzer.ts","../src/analyzer/theme-analyzer.ts","../src/analyzer/theme-source-analyzer.ts","../src/vite-plugin.ts","../src/utils/fileClassifier.ts","../src/utils/importParser.ts","../src/rules/reactNativePrimitives.ts","../src/rules/reactDomPrimitives.ts","../src/analyzers/platformImports.ts","../src/analyzers/componentLinter.ts"],"sourcesContent":["/**\n * @idealyst/tooling\n *\n * Code analysis and validation utilities for Idealyst Framework.\n * Provides tools for babel plugins, CLI, and MCP to validate cross-platform code.\n *\n * Also provides component documentation generation:\n * - analyzeComponents(): Generate a component registry from TypeScript source\n * - analyzeTheme(): Extract theme values (intents, sizes, etc.)\n * - idealystDocsPlugin(): Vite plugin for virtual module support\n */\n\n// Types\nexport * from './types';\n\n// Component Documentation (also available via @idealyst/tooling/docs)\nexport {\n analyzeComponents,\n analyzeTheme,\n // Babel plugin compatibility\n loadThemeKeys,\n resetThemeCache,\n type BabelThemeKeys,\n // Types\n type ComponentRegistry,\n type ComponentDefinition,\n type PropDefinition,\n type ThemeValues,\n type ComponentAnalyzerOptions,\n type SampleProps,\n type ControlledState,\n} from './analyzer';\n\n// Vite Plugin (also available via @idealyst/tooling/vite)\nexport { idealystDocsPlugin, generateComponentRegistry } from './vite-plugin';\nexport type { IdealystDocsPluginOptions } from './analyzer/types';\n\n// Analyzers\nexport {\n // Platform import analysis\n analyzePlatformImports,\n analyzeFiles,\n summarizeResults,\n formatViolation,\n formatViolations,\n type AnalysisSummary,\n // Component linting (catches issues TypeScript can't)\n lintComponent,\n lintComponents,\n formatLintIssue,\n formatLintResults,\n summarizeLintResults,\n type LintIssueType,\n type LintIssue,\n type LintResult,\n type LintSummary,\n type ComponentLinterOptions,\n} from './analyzers';\n\n// Rules\nexport {\n // React Native\n REACT_NATIVE_SOURCES,\n REACT_NATIVE_PRIMITIVES,\n REACT_NATIVE_PRIMITIVE_NAMES,\n REACT_NATIVE_RULE_SET,\n isReactNativePrimitive,\n getReactNativePrimitive,\n // React DOM\n REACT_DOM_SOURCES,\n REACT_DOM_PRIMITIVES,\n REACT_DOM_PRIMITIVE_NAMES,\n REACT_DOM_RULE_SET,\n HTML_INTRINSIC_ELEMENTS,\n HTML_ELEMENT_NAMES,\n isReactDomPrimitive,\n isHtmlElement,\n getReactDomPrimitive,\n} from './rules';\n\n// Utilities\nexport {\n classifyFile,\n isComponentFile,\n isSharedFile,\n isPlatformSpecificFile,\n getExpectedPlatform,\n getBaseName,\n parseImports,\n getPlatformForSource,\n filterPlatformImports,\n getUniqueSources,\n groupImportsBySource,\n type ImportParserOptions,\n} from './utils';\n\n// =============================================================================\n// Runtime Placeholders - These get replaced by the Vite plugin at build time\n// =============================================================================\n\nimport type { ComponentRegistry } from './analyzer/types';\n\n/**\n * Component registry placeholder.\n * This empty object is replaced at build time by the idealystDocsPlugin\n * with the actual component metadata extracted from your codebase.\n *\n * @example\n * ```ts\n * import { componentRegistry } from '@idealyst/tooling';\n *\n * // Access component definitions\n * const buttonDef = componentRegistry['Button'];\n * console.log(buttonDef.description);\n * console.log(buttonDef.props);\n * ```\n */\nexport const componentRegistry: ComponentRegistry = {};\n\n/**\n * List of all component names in the registry.\n * Replaced at build time by the Vite plugin.\n */\nexport const componentNames: string[] = [];\n\n/**\n * Get components filtered by category.\n * Replaced at build time by the Vite plugin.\n */\nexport function getComponentsByCategory(category: string): string[] {\n return Object.entries(componentRegistry)\n .filter(([_, def]) => def.category === category)\n .map(([name]) => name);\n}\n\n/**\n * Get prop configuration for a component (useful for playgrounds).\n * Replaced at build time by the Vite plugin.\n */\nexport function getPropConfig(componentName: string): Record<string, any> {\n const def = componentRegistry[componentName];\n if (!def) return {};\n\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 }, {} as Record<string, any>);\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';\nimport { analyzeThemeSource } from './theme-source-analyzer';\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 case 'setIntent': {\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 'addSurfaceColor':\n case 'setSurfaceColor': {\n const name = getStringValue(args[0]);\n if (name && !values.surfaceColors.includes(name)) {\n values.surfaceColors.push(name);\n log(' Found surface color:', name);\n }\n break;\n }\n case 'addTextColor':\n case 'setTextColor': {\n const name = getStringValue(args[0]);\n if (name && !values.textColors.includes(name)) {\n values.textColors.push(name);\n log(' Found text color:', name);\n }\n break;\n }\n case 'addBorderColor':\n case 'setBorderColor': {\n const name = getStringValue(args[0]);\n if (name && !values.borderColors.includes(name)) {\n values.borderColors.push(name);\n log(' Found border color:', name);\n }\n break;\n }\n case 'addPalletColor':\n case 'setPalletColor': {\n // For pallet colors, we just track that they exist\n // The actual shade keys (50-900) are always the same\n const name = getStringValue(args[0]);\n if (name) {\n log(' Found pallet color:', name);\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, try to analyze from source using aliases\n if (importInfo.source === '@idealyst/theme' || importInfo.source.includes('@idealyst/theme')) {\n // Check if we have an alias for @idealyst/theme\n const aliasPath = packageAliases['@idealyst/theme'];\n if (aliasPath) {\n // Determine which theme file to analyze based on variable name\n const themeFileName = varName.toLowerCase().includes('dark') ? 'darkTheme.ts' : 'lightTheme.ts';\n const themePath = path.join(aliasPath, 'src', themeFileName);\n\n if (fs.existsSync(themePath)) {\n log(`Analyzing @idealyst/theme from source: ${themePath}`);\n try {\n const sourceValues = analyzeThemeSource(themePath, {\n verbose: ctx.verbose,\n aliases: packageAliases,\n });\n mergeThemeValues(values, sourceValues);\n log('Successfully extracted values from source');\n return;\n } catch (err) {\n log('Failed to analyze source, falling back to defaults:', (err as Error).message);\n }\n } else {\n log(`Theme file not found at alias path: ${themePath}`);\n }\n }\n\n // Fall back to default values if alias resolution fails\n log('Using default @idealyst/theme values');\n const defaultValues = getDefaultThemeValues();\n mergeThemeValues(values, defaultValues);\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', 'danger', 'warning', 'neutral', 'info'],\n sizes: {\n button: ['xs', 'sm', 'md', 'lg', 'xl'],\n iconButton: ['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 alert: ['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 surfaceColors: string[];\n textColors: string[];\n borderColors: string[];\n}\n\n// Cache for loadThemeKeys to avoid re-parsing\nlet themeKeysCache: BabelThemeKeys | null = null;\nlet themeLoadAttempted = false;\n\n// Global aliases configuration (set via plugin options)\nlet packageAliases: Record<string, string> = {};\n\n/**\n * Resolve an import source using configured aliases.\n * Returns the resolved path or null if no alias matches.\n */\nfunction resolveWithAliases(source: string, fromDir: string): string | null {\n for (const [aliasPrefix, aliasPath] of Object.entries(packageAliases)) {\n if (source === aliasPrefix || source.startsWith(aliasPrefix + '/')) {\n // Replace the alias prefix with the actual path\n const remainder = source.slice(aliasPrefix.length);\n let resolved = aliasPath + remainder;\n\n // If aliasPath is relative, resolve from fromDir\n if (!path.isAbsolute(resolved)) {\n resolved = path.resolve(fromDir, resolved);\n }\n\n return resolved;\n }\n }\n return null;\n}\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, optional aliases)\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; aliases?: Record<string, 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 // Set up package aliases for resolution\n if (opts.aliases && typeof opts.aliases === 'object') {\n packageAliases = opts.aliases;\n if (verboseMode) {\n console.log('[idealyst-plugin] Configured aliases:', packageAliases);\n }\n }\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 // First try to resolve using aliases\n let resolvedPath: string;\n const aliasResolved = resolveWithAliases(themePath, rootDir);\n if (aliasResolved && fs.existsSync(aliasResolved)) {\n resolvedPath = aliasResolved;\n } else {\n resolvedPath = themePath.startsWith('.')\n ? path.resolve(rootDir, themePath)\n : themePath;\n }\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 surfaceColors: themeValues.surfaceColors,\n textColors: themeValues.textColors,\n borderColors: themeValues.borderColors,\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(' surfaceColors:', themeKeysCache.surfaceColors);\n console.log(' textColors:', themeKeysCache.textColors);\n console.log(' borderColors:', themeKeysCache.borderColors);\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","/**\n * Theme Source Analyzer - Extracts all theme values directly from TypeScript source.\n *\n * This analyzer parses the theme file and extracts all values from the builder API\n * without relying on hardcoded defaults. It traces:\n * - createTheme() / fromTheme(base)\n * - .addIntent('name', {...})\n * - .addRadius('name', value)\n * - .addShadow('name', {...})\n * - .setSizes({ component: { size: {...}, ... }, ... })\n * - .setColors({ surface: {...}, text: {...}, border: {...}, pallet: {...} })\n * - .setBreakpoints({ xs: 0, sm: 576, ... })\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\nexport interface ThemeSourceAnalyzerOptions {\n /** Enable verbose logging */\n verbose?: boolean;\n /** Package aliases for resolving imports (e.g., { '@idealyst/theme': '/path/to/packages/theme' }) */\n aliases?: Record<string, string>;\n}\n\ninterface AnalyzerContext {\n program: ts.Program;\n typeChecker: ts.TypeChecker;\n verbose: boolean;\n aliases: Record<string, string>;\n /** Track analyzed files to avoid cycles */\n analyzedFiles: Set<string>;\n}\n\n/**\n * Analyze a theme file and extract all theme values.\n * This is the main entry point for theme analysis.\n */\nexport function analyzeThemeSource(\n themePath: string,\n options: ThemeSourceAnalyzerOptions = {}\n): ThemeValues {\n const resolvedPath = path.resolve(themePath);\n const verbose = options.verbose ?? false;\n const aliases = options.aliases ?? {};\n\n const log = (...args: unknown[]) => {\n if (verbose) console.log('[theme-source-analyzer]', ...args);\n };\n\n if (!fs.existsSync(resolvedPath)) {\n throw new Error(`Theme file not found: ${resolvedPath}`);\n }\n\n log('Analyzing theme file:', resolvedPath);\n\n // Create a TypeScript program with proper module resolution\n const configPath = ts.findConfigFile(path.dirname(resolvedPath), ts.sys.fileExists, 'tsconfig.json');\n let compilerOptions: ts.CompilerOptions = {\n target: ts.ScriptTarget.ES2020,\n module: ts.ModuleKind.ESNext,\n moduleResolution: ts.ModuleResolutionKind.Node10,\n strict: true,\n esModuleInterop: true,\n skipLibCheck: true,\n allowSyntheticDefaultImports: true,\n resolveJsonModule: true,\n };\n\n if (configPath) {\n const configFile = ts.readConfigFile(configPath, ts.sys.readFile);\n if (!configFile.error) {\n const parsed = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(configPath));\n compilerOptions = { ...compilerOptions, ...parsed.options };\n }\n }\n\n const program = ts.createProgram([resolvedPath], compilerOptions);\n const sourceFile = program.getSourceFile(resolvedPath);\n\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 aliases,\n analyzedFiles: new Set([resolvedPath]),\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 log(` Import: ${localName} from '${source}'`);\n }\n }\n }\n });\n\n /**\n * Resolve an import path using aliases.\n */\n function resolveImportPath(source: string, fromFile: string): string | null {\n // Check aliases first\n for (const [aliasPrefix, aliasPath] of Object.entries(ctx.aliases)) {\n if (source === aliasPrefix || source.startsWith(aliasPrefix + '/')) {\n const remainder = source.slice(aliasPrefix.length);\n let resolved = aliasPath + remainder;\n if (!path.isAbsolute(resolved)) {\n resolved = path.resolve(path.dirname(fromFile), resolved);\n }\n return resolved;\n }\n }\n\n // Try relative resolution\n if (source.startsWith('.')) {\n return path.resolve(path.dirname(fromFile), source);\n }\n\n // Try node_modules resolution\n try {\n return require.resolve(source, { paths: [path.dirname(fromFile)] });\n } catch {\n return null;\n }\n }\n\n /**\n * Find a theme file from a resolved directory/file path.\n */\n function findThemeFile(basePath: string, preferDark: boolean): string | null {\n const themeFileName = preferDark ? 'darkTheme' : 'lightTheme';\n\n const candidates = [\n basePath,\n `${basePath}.ts`,\n `${basePath}.tsx`,\n path.join(basePath, 'src', `${themeFileName}.ts`),\n path.join(basePath, `${themeFileName}.ts`),\n path.join(basePath, 'src', 'index.ts'),\n path.join(basePath, 'index.ts'),\n ];\n\n for (const candidate of candidates) {\n if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {\n return candidate;\n }\n }\n\n return null;\n }\n\n /**\n * Analyze a base theme file recursively.\n */\n function analyzeBaseTheme(varName: string): void {\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(`Analyzing base theme '${varName}' from '${importInfo.source}'`);\n\n const resolvedBase = resolveImportPath(importInfo.source, resolvedPath);\n if (!resolvedBase) {\n log(`Could not resolve import path: ${importInfo.source}`);\n return;\n }\n\n const preferDark = varName.toLowerCase().includes('dark');\n const themeFile = findThemeFile(resolvedBase, preferDark);\n\n if (!themeFile) {\n log(`Could not find theme file for: ${resolvedBase}`);\n return;\n }\n\n if (ctx.analyzedFiles.has(themeFile)) {\n log(`Already analyzed: ${themeFile}`);\n return;\n }\n\n ctx.analyzedFiles.add(themeFile);\n log(`Recursively analyzing: ${themeFile}`);\n\n // Parse and analyze the base theme file\n const baseValues = analyzeThemeSource(themeFile, { verbose, aliases });\n\n // Merge base values (base values come first, current file can override)\n mergeThemeValues(values, baseValues, false);\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[] = []): { calls: BuilderCall[]; baseThemeVar: string | null } {\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 return { calls, baseThemeVar: arg.text };\n }\n }\n }\n return { calls, baseThemeVar: null };\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, baseThemeVar: null };\n }\n\n /**\n * Get a string value from an AST node.\n */\n function 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 if (ts.isNoSubstitutionTemplateLiteral(node)) return node.text;\n return null;\n }\n\n /**\n * Get all keys from an object literal.\n */\n function getObjectKeys(node: ts.ObjectLiteralExpression): string[] {\n return node.properties\n .filter((prop): prop is ts.PropertyAssignment => ts.isPropertyAssignment(prop))\n .map(prop => {\n if (ts.isIdentifier(prop.name)) return prop.name.text;\n if (ts.isStringLiteral(prop.name)) return prop.name.text;\n return null;\n })\n .filter((k): k is string => k !== null);\n }\n\n /**\n * Process the collected builder method calls and extract values.\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 case 'setIntent': {\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\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\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\n case 'addBreakpoint': {\n const name = getStringValue(args[0]);\n if (name && !values.breakpoints.includes(name)) {\n values.breakpoints.push(name);\n log(` Found breakpoint: ${name}`);\n }\n break;\n }\n\n case 'setBreakpoints': {\n if (args[0] && ts.isObjectLiteralExpression(args[0])) {\n const keys = getObjectKeys(args[0]);\n for (const key of keys) {\n if (!values.breakpoints.includes(key)) {\n values.breakpoints.push(key);\n }\n }\n log(` Found breakpoints: ${values.breakpoints.join(', ')}`);\n }\n break;\n }\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 let componentName: string | null = null;\n if (ts.isIdentifier(prop.name)) {\n componentName = prop.name.text;\n } else if (ts.isStringLiteral(prop.name)) {\n componentName = prop.name.text;\n }\n\n if (componentName && ts.isObjectLiteralExpression(prop.initializer)) {\n const sizeKeys = getObjectKeys(prop.initializer);\n values.sizes[componentName] = sizeKeys;\n log(` Found sizes for ${componentName}: ${sizeKeys.join(', ')}`);\n\n // Special case: typography sizes also populate the typography array\n if (componentName === 'typography') {\n for (const key of sizeKeys) {\n if (!values.typography.includes(key)) {\n values.typography.push(key);\n }\n }\n }\n }\n }\n }\n } else if (args[0] && ts.isPropertyAccessExpression(args[0])) {\n // Handle references like: .setSizes(lightTheme.sizes)\n const propAccess = args[0];\n if (ts.isIdentifier(propAccess.expression) && propAccess.name.text === 'sizes') {\n const themeVarName = propAccess.expression.text;\n log(` Found sizes reference: ${themeVarName}.sizes`);\n\n // Try to resolve this by analyzing the referenced theme\n const importInfo = imports.get(themeVarName);\n if (importInfo) {\n log(` Resolving sizes from imported theme: ${importInfo.source}`);\n const resolvedBase = resolveImportPath(importInfo.source, resolvedPath);\n if (resolvedBase) {\n const preferDark = themeVarName.toLowerCase().includes('dark');\n const themeFile = findThemeFile(resolvedBase, preferDark);\n if (themeFile && !ctx.analyzedFiles.has(themeFile)) {\n ctx.analyzedFiles.add(themeFile);\n const baseValues = analyzeThemeSource(themeFile, { verbose, aliases });\n // Copy sizes from base theme\n for (const [comp, sizes] of Object.entries(baseValues.sizes)) {\n if (!values.sizes[comp]) {\n values.sizes[comp] = sizes;\n log(` Inherited sizes for ${comp}: ${sizes.join(', ')}`);\n }\n }\n // Also copy typography if we inherited it\n for (const typo of baseValues.typography) {\n if (!values.typography.includes(typo)) {\n values.typography.push(typo);\n }\n }\n }\n }\n }\n }\n }\n break;\n }\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 let colorType: string | null = null;\n if (ts.isIdentifier(prop.name)) {\n colorType = prop.name.text;\n } else if (ts.isStringLiteral(prop.name)) {\n colorType = prop.name.text;\n }\n\n if (colorType && ts.isObjectLiteralExpression(prop.initializer)) {\n const colorKeys = getObjectKeys(prop.initializer);\n switch (colorType) {\n case 'surface':\n values.surfaceColors = colorKeys;\n log(` Found surface colors: ${colorKeys.join(', ')}`);\n break;\n case 'text':\n values.textColors = colorKeys;\n log(` Found text colors: ${colorKeys.join(', ')}`);\n break;\n case 'border':\n values.borderColors = colorKeys;\n log(` Found border colors: ${colorKeys.join(', ')}`);\n break;\n }\n }\n // Handle function calls like generateColorPallette() for pallet\n // We skip pallet since it's typically generated dynamically\n }\n }\n }\n break;\n }\n\n case 'addSurfaceColor':\n case 'setSurfaceColor': {\n const name = getStringValue(args[0]);\n if (name && !values.surfaceColors.includes(name)) {\n values.surfaceColors.push(name);\n log(` Found surface color: ${name}`);\n }\n break;\n }\n\n case 'addTextColor':\n case 'setTextColor': {\n const name = getStringValue(args[0]);\n if (name && !values.textColors.includes(name)) {\n values.textColors.push(name);\n log(` Found text color: ${name}`);\n }\n break;\n }\n\n case 'addBorderColor':\n case 'setBorderColor': {\n const name = getStringValue(args[0]);\n if (name && !values.borderColors.includes(name)) {\n values.borderColors.push(name);\n log(` Found border color: ${name}`);\n }\n break;\n }\n\n case 'addPalletColor':\n case 'setPalletColor': {\n // For pallet colors, we just track that they exist\n // The actual shade keys (50-900) are always the same\n const name = getStringValue(args[0]);\n if (name) {\n log(` Found pallet color: ${name}`);\n }\n break;\n }\n\n case 'build':\n // End of chain, nothing to extract\n break;\n\n default:\n log(` Skipping unknown method: ${method}`);\n }\n }\n }\n\n /**\n * Process a node that might be a builder chain ending with .build().\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) && node.expression.name.text === 'build') {\n log('Found .build() call, tracing chain...');\n const { calls, baseThemeVar } = traceBuilderCalls(node);\n\n // First analyze base theme if there is one\n if (baseThemeVar) {\n log(`Found fromTheme(${baseThemeVar})`);\n analyzeBaseTheme(baseThemeVar);\n }\n\n // Then process this file's calls (can override base)\n processCalls(calls);\n return;\n }\n\n // Recurse into children\n ts.forEachChild(node, processBuilderChain);\n }\n\n // Main analysis pass: find and process builder chains\n ts.forEachChild(sourceFile, (node) => {\n // Handle variable declarations: const lightTheme = createTheme()...build();\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\n // Handle export statements: export const theme = ...\n if (ts.isExportAssignment(node)) {\n processBuilderChain(node.expression);\n }\n });\n\n log('Analysis complete:');\n log(` Intents: ${values.intents.join(', ')}`);\n log(` Radii: ${values.radii.join(', ')}`);\n log(` Shadows: ${values.shadows.join(', ')}`);\n log(` Breakpoints: ${values.breakpoints.join(', ')}`);\n log(` Typography: ${values.typography.join(', ')}`);\n log(` Size components: ${Object.keys(values.sizes).join(', ')}`);\n\n return values;\n}\n\n/**\n * Merge source theme values into target.\n * @param target - The target to merge into\n * @param source - The source to merge from\n * @param sourceOverrides - If true, source values replace target; if false, target values take precedence\n */\nfunction mergeThemeValues(target: ThemeValues, source: ThemeValues, sourceOverrides: boolean): void {\n // Helper to merge arrays without duplicates\n const mergeArrays = (targetArr: string[], sourceArr: string[]): void => {\n for (const item of sourceArr) {\n if (!targetArr.includes(item)) {\n targetArr.push(item);\n }\n }\n };\n\n mergeArrays(target.intents, source.intents);\n mergeArrays(target.radii, source.radii);\n mergeArrays(target.shadows, source.shadows);\n mergeArrays(target.breakpoints, source.breakpoints);\n mergeArrays(target.typography, source.typography);\n mergeArrays(target.surfaceColors, source.surfaceColors);\n mergeArrays(target.textColors, source.textColors);\n mergeArrays(target.borderColors, source.borderColors);\n\n // Merge sizes - component by component\n for (const [component, sizes] of Object.entries(source.sizes)) {\n if (sourceOverrides || !target.sizes[component]) {\n target.sizes[component] = sizes;\n }\n }\n}\n\n/**\n * Convert ThemeValues to the format expected by the Babel plugin.\n */\nexport interface BabelThemeKeys {\n intents: string[];\n sizes: Record<string, string[]>;\n radii: string[];\n shadows: string[];\n typography: string[];\n surfaceColors: string[];\n textColors: string[];\n borderColors: string[];\n}\n\nexport function toBabelThemeKeys(values: ThemeValues): BabelThemeKeys {\n return {\n intents: values.intents,\n sizes: values.sizes,\n radii: values.radii,\n shadows: values.shadows,\n typography: values.typography,\n surfaceColors: values.surfaceColors,\n textColors: values.textColors,\n borderColors: values.borderColors,\n };\n}\n","/**\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","import { FileType } from '../types';\nimport * as path from 'path';\n\n/**\n * Extension patterns for classification\n * Order matters - more specific patterns should come first\n */\nconst EXTENSION_PATTERNS: Array<{ pattern: RegExp; type: FileType }> = [\n // Platform-specific component files\n { pattern: /\\.web\\.(tsx|jsx)$/, type: 'web' },\n { pattern: /\\.native\\.(tsx|jsx)$/, type: 'native' },\n { pattern: /\\.ios\\.(tsx|jsx)$/, type: 'native' },\n { pattern: /\\.android\\.(tsx|jsx)$/, type: 'native' },\n\n // Style files (can be .ts or .tsx)\n { pattern: /\\.styles?\\.(tsx?|jsx?)$/, type: 'styles' },\n\n // Type definition files\n { pattern: /\\.types?\\.(ts|tsx)$/, type: 'types' },\n { pattern: /types\\.(ts|tsx)$/, type: 'types' },\n { pattern: /\\.d\\.ts$/, type: 'types' },\n\n // Shared component files (generic .tsx/.jsx without platform suffix)\n { pattern: /\\.(tsx|jsx)$/, type: 'shared' },\n];\n\n/**\n * Files that should be classified as 'other' regardless of extension\n */\nconst EXCLUDED_PATTERNS: RegExp[] = [\n /\\.test\\.(tsx?|jsx?)$/,\n /\\.spec\\.(tsx?|jsx?)$/,\n /\\.stories\\.(tsx?|jsx?)$/,\n /\\.config\\.(ts|js)$/,\n /index\\.(ts|tsx|js|jsx)$/,\n];\n\n/**\n * Classifies a file based on its path and extension\n *\n * @param filePath - The file path to classify\n * @returns The file type classification\n *\n * @example\n * classifyFile('Button.tsx') // 'shared'\n * classifyFile('Button.web.tsx') // 'web'\n * classifyFile('Button.native.tsx') // 'native'\n * classifyFile('Button.styles.tsx') // 'styles'\n * classifyFile('types.ts') // 'types'\n */\nexport function classifyFile(filePath: string): FileType {\n const fileName = path.basename(filePath);\n\n // Check if this file should be excluded from component analysis\n for (const pattern of EXCLUDED_PATTERNS) {\n if (pattern.test(fileName)) {\n return 'other';\n }\n }\n\n // Match against extension patterns\n for (const { pattern, type } of EXTENSION_PATTERNS) {\n if (pattern.test(fileName)) {\n return type;\n }\n }\n\n return 'other';\n}\n\n/**\n * Checks if a file is a component file that should be analyzed\n *\n * @param filePath - The file path to check\n * @returns True if the file is a component file (.tsx or .jsx)\n */\nexport function isComponentFile(filePath: string): boolean {\n const fileType = classifyFile(filePath);\n return fileType === 'shared' || fileType === 'web' || fileType === 'native';\n}\n\n/**\n * Checks if a file is a shared (cross-platform) component file\n * These are the files that should NOT contain platform-specific imports\n *\n * @param filePath - The file path to check\n * @returns True if the file is a shared component file\n */\nexport function isSharedFile(filePath: string): boolean {\n return classifyFile(filePath) === 'shared';\n}\n\n/**\n * Checks if a file is platform-specific\n *\n * @param filePath - The file path to check\n * @returns True if the file is web or native specific\n */\nexport function isPlatformSpecificFile(filePath: string): boolean {\n const fileType = classifyFile(filePath);\n return fileType === 'web' || fileType === 'native';\n}\n\n/**\n * Gets the expected platform for a file\n *\n * @param filePath - The file path to check\n * @returns The expected platform, or null for shared/other files\n */\nexport function getExpectedPlatform(filePath: string): 'web' | 'native' | null {\n const fileType = classifyFile(filePath);\n if (fileType === 'web') return 'web';\n if (fileType === 'native') return 'native';\n return null;\n}\n\n/**\n * Extracts the base component name from a file path\n *\n * @param filePath - The file path\n * @returns The base component name without platform suffix or extension\n *\n * @example\n * getBaseName('Button.web.tsx') // 'Button'\n * getBaseName('Button.native.tsx') // 'Button'\n * getBaseName('Button.tsx') // 'Button'\n */\nexport function getBaseName(filePath: string): string {\n const fileName = path.basename(filePath);\n return fileName\n .replace(/\\.(web|native|ios|android)\\.(tsx|jsx|ts|js)$/, '')\n .replace(/\\.styles?\\.(tsx|jsx|ts|js)$/, '')\n .replace(/\\.types?\\.(tsx|ts)$/, '')\n .replace(/\\.(tsx|jsx|ts|js)$/, '');\n}\n","import * as ts from 'typescript';\nimport { ImportInfo, Platform } from '../types';\nimport { REACT_NATIVE_SOURCES, REACT_DOM_SOURCES } from '../rules';\n\n/**\n * Options for import parsing\n */\nexport interface ImportParserOptions {\n /** Additional sources to treat as React Native */\n additionalNativeSources?: string[];\n /** Additional sources to treat as React DOM */\n additionalDomSources?: string[];\n}\n\n/**\n * Determines the platform for a given import source\n */\nexport function getPlatformForSource(\n source: string,\n options?: ImportParserOptions\n): Platform {\n const nativeSources = new Set([\n ...REACT_NATIVE_SOURCES,\n ...(options?.additionalNativeSources ?? []),\n ]);\n\n const domSources = new Set([\n ...REACT_DOM_SOURCES,\n ...(options?.additionalDomSources ?? []),\n ]);\n\n // Check for exact matches first\n if (nativeSources.has(source)) return 'react-native';\n if (domSources.has(source)) return 'react-dom';\n\n // Check for prefix matches (e.g., 'react-native-xxx')\n if (source.startsWith('react-native')) return 'react-native';\n if (source.startsWith('react-dom')) return 'react-dom';\n\n return 'neutral';\n}\n\n/**\n * Parses import statements from TypeScript/JavaScript source code\n *\n * @param sourceCode - The source code to parse\n * @param filePath - Optional file path for better error messages\n * @param options - Parser options\n * @returns Array of import information\n */\nexport function parseImports(\n sourceCode: string,\n filePath: string = 'unknown.tsx',\n options?: ImportParserOptions\n): ImportInfo[] {\n const imports: ImportInfo[] = [];\n\n // Create a source file from the code\n const sourceFile = ts.createSourceFile(\n filePath,\n sourceCode,\n ts.ScriptTarget.Latest,\n true,\n filePath.endsWith('.tsx') || filePath.endsWith('.jsx')\n ? ts.ScriptKind.TSX\n : ts.ScriptKind.TS\n );\n\n // Walk the AST to find import declarations\n const visit = (node: ts.Node): void => {\n if (ts.isImportDeclaration(node)) {\n const importInfo = parseImportDeclaration(node, sourceFile, options);\n imports.push(...importInfo);\n }\n\n // Also check for require() calls\n if (\n ts.isCallExpression(node) &&\n ts.isIdentifier(node.expression) &&\n node.expression.text === 'require' &&\n node.arguments.length === 1 &&\n ts.isStringLiteral(node.arguments[0])\n ) {\n const source = node.arguments[0].text;\n const { line, character } = sourceFile.getLineAndCharacterOfPosition(\n node.getStart()\n );\n\n imports.push({\n name: 'require',\n source,\n platform: getPlatformForSource(source, options),\n line: line + 1,\n column: character + 1,\n isDefault: false,\n isNamespace: true,\n isTypeOnly: false,\n });\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n\n return imports;\n}\n\n/**\n * Parses a single import declaration into ImportInfo objects\n */\nfunction parseImportDeclaration(\n node: ts.ImportDeclaration,\n sourceFile: ts.SourceFile,\n options?: ImportParserOptions\n): ImportInfo[] {\n const imports: ImportInfo[] = [];\n\n // Get the module specifier (the source)\n if (!ts.isStringLiteral(node.moduleSpecifier)) {\n return imports;\n }\n\n const source = node.moduleSpecifier.text;\n const platform = getPlatformForSource(source, options);\n const isTypeOnly = node.importClause?.isTypeOnly ?? false;\n\n const importClause = node.importClause;\n if (!importClause) {\n // Side-effect import: import 'module'\n return imports;\n }\n\n // Default import: import X from 'module'\n if (importClause.name) {\n const { line, character } = sourceFile.getLineAndCharacterOfPosition(\n importClause.name.getStart()\n );\n\n imports.push({\n name: importClause.name.text,\n source,\n platform,\n line: line + 1,\n column: character + 1,\n isDefault: true,\n isNamespace: false,\n isTypeOnly,\n });\n }\n\n // Named and namespace imports\n const namedBindings = importClause.namedBindings;\n if (namedBindings) {\n if (ts.isNamespaceImport(namedBindings)) {\n // Namespace import: import * as X from 'module'\n const { line, character } = sourceFile.getLineAndCharacterOfPosition(\n namedBindings.name.getStart()\n );\n\n imports.push({\n name: namedBindings.name.text,\n source,\n platform,\n line: line + 1,\n column: character + 1,\n isDefault: false,\n isNamespace: true,\n isTypeOnly,\n });\n } else if (ts.isNamedImports(namedBindings)) {\n // Named imports: import { X, Y as Z } from 'module'\n for (const element of namedBindings.elements) {\n const { line, character } = sourceFile.getLineAndCharacterOfPosition(\n element.name.getStart()\n );\n\n const importedName = element.propertyName?.text ?? element.name.text;\n const localName = element.name.text;\n\n imports.push({\n name: localName,\n originalName: element.propertyName ? importedName : undefined,\n source,\n platform,\n line: line + 1,\n column: character + 1,\n isDefault: false,\n isNamespace: false,\n isTypeOnly: isTypeOnly || element.isTypeOnly,\n });\n }\n }\n }\n\n return imports;\n}\n\n/**\n * Filters imports to only those from platform-specific sources\n */\nexport function filterPlatformImports(\n imports: ImportInfo[],\n platform?: Platform\n): ImportInfo[] {\n return imports.filter((imp) => {\n if (imp.platform === 'neutral') return false;\n if (platform && imp.platform !== platform) return false;\n return true;\n });\n}\n\n/**\n * Gets all unique import sources from a list of imports\n */\nexport function getUniqueSources(imports: ImportInfo[]): string[] {\n return [...new Set(imports.map((imp) => imp.source))];\n}\n\n/**\n * Groups imports by their source module\n */\nexport function groupImportsBySource(\n imports: ImportInfo[]\n): Map<string, ImportInfo[]> {\n const grouped = new Map<string, ImportInfo[]>();\n\n for (const imp of imports) {\n const existing = grouped.get(imp.source) ?? [];\n existing.push(imp);\n grouped.set(imp.source, existing);\n }\n\n return grouped;\n}\n","import { PrimitiveRule, PrimitiveRuleSet } from '../types';\n\n/**\n * Module sources that indicate React Native platform\n */\nexport const REACT_NATIVE_SOURCES = [\n 'react-native',\n 'react-native-web',\n 'react-native-gesture-handler',\n 'react-native-reanimated',\n 'react-native-safe-area-context',\n 'react-native-screens',\n 'react-native-svg',\n '@react-native-vector-icons/material-design-icons',\n '@react-native-vector-icons/common',\n '@react-native-community/async-storage',\n '@react-native-picker/picker',\n 'expo',\n 'expo-constants',\n 'expo-linking',\n 'expo-status-bar',\n] as const;\n\n/**\n * Core React Native view primitives\n */\nconst CORE_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'View',\n source: 'react-native',\n platform: 'react-native',\n description: 'Basic container component',\n },\n {\n name: 'Text',\n source: 'react-native',\n platform: 'react-native',\n description: 'Text display component',\n },\n {\n name: 'Image',\n source: 'react-native',\n platform: 'react-native',\n description: 'Image display component',\n },\n {\n name: 'ImageBackground',\n source: 'react-native',\n platform: 'react-native',\n description: 'Background image container',\n },\n {\n name: 'ScrollView',\n source: 'react-native',\n platform: 'react-native',\n description: 'Scrollable container',\n },\n {\n name: 'FlatList',\n source: 'react-native',\n platform: 'react-native',\n description: 'Performant list component',\n },\n {\n name: 'SectionList',\n source: 'react-native',\n platform: 'react-native',\n description: 'Sectioned list component',\n },\n {\n name: 'VirtualizedList',\n source: 'react-native',\n platform: 'react-native',\n description: 'Base virtualized list',\n },\n];\n\n/**\n * Interactive/touchable primitives\n */\nconst INTERACTIVE_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'TouchableOpacity',\n source: 'react-native',\n platform: 'react-native',\n description: 'Touch with opacity feedback',\n },\n {\n name: 'TouchableHighlight',\n source: 'react-native',\n platform: 'react-native',\n description: 'Touch with highlight feedback',\n },\n {\n name: 'TouchableWithoutFeedback',\n source: 'react-native',\n platform: 'react-native',\n description: 'Touch without visual feedback',\n },\n {\n name: 'TouchableNativeFeedback',\n source: 'react-native',\n platform: 'react-native',\n description: 'Android ripple feedback',\n },\n {\n name: 'Pressable',\n source: 'react-native',\n platform: 'react-native',\n description: 'Modern press handler component',\n },\n {\n name: 'Button',\n source: 'react-native',\n platform: 'react-native',\n description: 'Basic button component',\n },\n];\n\n/**\n * Input primitives\n */\nconst INPUT_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'TextInput',\n source: 'react-native',\n platform: 'react-native',\n description: 'Text input field',\n },\n {\n name: 'Switch',\n source: 'react-native',\n platform: 'react-native',\n description: 'Toggle switch component',\n },\n {\n name: 'Slider',\n source: 'react-native',\n platform: 'react-native',\n description: 'Slider input (deprecated)',\n },\n];\n\n/**\n * Modal and overlay primitives\n */\nconst MODAL_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'Modal',\n source: 'react-native',\n platform: 'react-native',\n description: 'Modal overlay component',\n },\n {\n name: 'Alert',\n source: 'react-native',\n platform: 'react-native',\n description: 'Native alert dialog',\n },\n {\n name: 'ActionSheetIOS',\n source: 'react-native',\n platform: 'react-native',\n description: 'iOS action sheet',\n },\n {\n name: 'StatusBar',\n source: 'react-native',\n platform: 'react-native',\n description: 'Status bar controller',\n },\n];\n\n/**\n * Animation primitives\n */\nconst ANIMATION_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'Animated',\n source: 'react-native',\n platform: 'react-native',\n description: 'Animation library namespace',\n },\n {\n name: 'Easing',\n source: 'react-native',\n platform: 'react-native',\n description: 'Easing functions',\n },\n {\n name: 'LayoutAnimation',\n source: 'react-native',\n platform: 'react-native',\n description: 'Layout animation controller',\n },\n];\n\n/**\n * Platform and device primitives\n */\nconst PLATFORM_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'Platform',\n source: 'react-native',\n platform: 'react-native',\n description: 'Platform detection utility',\n },\n {\n name: 'Dimensions',\n source: 'react-native',\n platform: 'react-native',\n description: 'Screen dimensions utility',\n },\n {\n name: 'PixelRatio',\n source: 'react-native',\n platform: 'react-native',\n description: 'Pixel ratio utility',\n },\n {\n name: 'Appearance',\n source: 'react-native',\n platform: 'react-native',\n description: 'Color scheme detection',\n },\n {\n name: 'useColorScheme',\n source: 'react-native',\n platform: 'react-native',\n description: 'Color scheme hook',\n },\n {\n name: 'useWindowDimensions',\n source: 'react-native',\n platform: 'react-native',\n description: 'Window dimensions hook',\n },\n];\n\n/**\n * Event handling primitives\n */\nconst EVENT_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'BackHandler',\n source: 'react-native',\n platform: 'react-native',\n description: 'Android back button handler',\n },\n {\n name: 'Keyboard',\n source: 'react-native',\n platform: 'react-native',\n description: 'Keyboard event handler',\n },\n {\n name: 'PanResponder',\n source: 'react-native',\n platform: 'react-native',\n description: 'Gesture responder system',\n },\n {\n name: 'Linking',\n source: 'react-native',\n platform: 'react-native',\n description: 'Deep linking utility',\n },\n {\n name: 'AppState',\n source: 'react-native',\n platform: 'react-native',\n description: 'App lifecycle state',\n },\n];\n\n/**\n * Safety primitives\n */\nconst SAFETY_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'SafeAreaView',\n source: 'react-native',\n platform: 'react-native',\n description: 'Safe area inset container',\n },\n {\n name: 'KeyboardAvoidingView',\n source: 'react-native',\n platform: 'react-native',\n description: 'Keyboard avoidance container',\n },\n];\n\n/**\n * Accessibility primitives\n */\nconst ACCESSIBILITY_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'AccessibilityInfo',\n source: 'react-native',\n platform: 'react-native',\n description: 'Accessibility information API',\n },\n];\n\n/**\n * Style primitives\n */\nconst STYLE_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'StyleSheet',\n source: 'react-native',\n platform: 'react-native',\n description: 'Style sheet creator',\n },\n];\n\n/**\n * All React Native primitives combined\n */\nexport const REACT_NATIVE_PRIMITIVES: PrimitiveRule[] = [\n ...CORE_PRIMITIVES,\n ...INTERACTIVE_PRIMITIVES,\n ...INPUT_PRIMITIVES,\n ...MODAL_PRIMITIVES,\n ...ANIMATION_PRIMITIVES,\n ...PLATFORM_PRIMITIVES,\n ...EVENT_PRIMITIVES,\n ...SAFETY_PRIMITIVES,\n ...ACCESSIBILITY_PRIMITIVES,\n ...STYLE_PRIMITIVES,\n];\n\n/**\n * Set of primitive names for quick lookup\n */\nexport const REACT_NATIVE_PRIMITIVE_NAMES = new Set(\n REACT_NATIVE_PRIMITIVES.map((p) => p.name)\n);\n\n/**\n * Complete rule set for React Native\n */\nexport const REACT_NATIVE_RULE_SET: PrimitiveRuleSet = {\n platform: 'react-native',\n primitives: REACT_NATIVE_PRIMITIVES,\n sources: [...REACT_NATIVE_SOURCES],\n};\n\n/**\n * Check if a name is a React Native primitive\n */\nexport function isReactNativePrimitive(name: string): boolean {\n return REACT_NATIVE_PRIMITIVE_NAMES.has(name);\n}\n\n/**\n * Get primitive info by name\n */\nexport function getReactNativePrimitive(name: string): PrimitiveRule | undefined {\n return REACT_NATIVE_PRIMITIVES.find((p) => p.name === name);\n}\n","import { PrimitiveRule, PrimitiveRuleSet } from '../types';\n\n/**\n * Module sources that indicate React DOM platform\n */\nexport const REACT_DOM_SOURCES = [\n 'react-dom',\n 'react-dom/client',\n 'react-dom/server',\n] as const;\n\n/**\n * React DOM API primitives\n * These are functions/components that are React DOM specific\n */\nconst DOM_API_PRIMITIVES: PrimitiveRule[] = [\n {\n name: 'createPortal',\n source: 'react-dom',\n platform: 'react-dom',\n description: 'Render children into a different DOM node',\n },\n {\n name: 'flushSync',\n source: 'react-dom',\n platform: 'react-dom',\n description: 'Force synchronous DOM updates',\n },\n {\n name: 'createRoot',\n source: 'react-dom/client',\n platform: 'react-dom',\n description: 'Create a React root for rendering',\n },\n {\n name: 'hydrateRoot',\n source: 'react-dom/client',\n platform: 'react-dom',\n description: 'Hydrate server-rendered content',\n },\n {\n name: 'render',\n source: 'react-dom',\n platform: 'react-dom',\n description: 'Legacy render function (deprecated)',\n },\n {\n name: 'hydrate',\n source: 'react-dom',\n platform: 'react-dom',\n description: 'Legacy hydrate function (deprecated)',\n },\n {\n name: 'unmountComponentAtNode',\n source: 'react-dom',\n platform: 'react-dom',\n description: 'Legacy unmount function (deprecated)',\n },\n {\n name: 'findDOMNode',\n source: 'react-dom',\n platform: 'react-dom',\n description: 'Find DOM node (deprecated)',\n },\n];\n\n/**\n * Intrinsic HTML elements that indicate web-only code\n * These are JSX intrinsic elements that only exist in DOM\n *\n * Note: These are detected via JSX usage, not imports\n * This list is for reference and specialized detection\n */\nexport const HTML_INTRINSIC_ELEMENTS = [\n // Document structure\n 'html',\n 'head',\n 'body',\n 'main',\n 'header',\n 'footer',\n 'nav',\n 'aside',\n 'article',\n 'section',\n\n // Content sectioning\n 'div',\n 'span',\n 'p',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n\n // Text content\n 'a',\n 'strong',\n 'em',\n 'code',\n 'pre',\n 'blockquote',\n 'br',\n 'hr',\n\n // Lists\n 'ul',\n 'ol',\n 'li',\n 'dl',\n 'dt',\n 'dd',\n\n // Tables\n 'table',\n 'thead',\n 'tbody',\n 'tfoot',\n 'tr',\n 'th',\n 'td',\n 'caption',\n 'colgroup',\n 'col',\n\n // Forms\n 'form',\n 'input',\n 'textarea',\n 'select',\n 'option',\n 'optgroup',\n 'button',\n 'label',\n 'fieldset',\n 'legend',\n 'datalist',\n 'output',\n 'progress',\n 'meter',\n\n // Media\n 'img',\n 'video',\n 'audio',\n 'source',\n 'track',\n 'picture',\n 'figure',\n 'figcaption',\n 'canvas',\n 'svg',\n 'iframe',\n 'embed',\n 'object',\n\n // Interactive\n 'details',\n 'summary',\n 'dialog',\n 'menu',\n\n // Scripting\n 'script',\n 'noscript',\n 'template',\n 'slot',\n] as const;\n\n/**\n * All React DOM primitives (API functions)\n */\nexport const REACT_DOM_PRIMITIVES: PrimitiveRule[] = [...DOM_API_PRIMITIVES];\n\n/**\n * Set of primitive names for quick lookup\n */\nexport const REACT_DOM_PRIMITIVE_NAMES = new Set(\n REACT_DOM_PRIMITIVES.map((p) => p.name)\n);\n\n/**\n * Set of HTML intrinsic element names for quick lookup\n */\nexport const HTML_ELEMENT_NAMES: Set<string> = new Set(HTML_INTRINSIC_ELEMENTS);\n\n/**\n * Complete rule set for React DOM\n */\nexport const REACT_DOM_RULE_SET: PrimitiveRuleSet = {\n platform: 'react-dom',\n primitives: REACT_DOM_PRIMITIVES,\n sources: [...REACT_DOM_SOURCES],\n};\n\n/**\n * Check if a name is a React DOM primitive (API function)\n */\nexport function isReactDomPrimitive(name: string): boolean {\n return REACT_DOM_PRIMITIVE_NAMES.has(name);\n}\n\n/**\n * Check if a name is an HTML intrinsic element\n */\nexport function isHtmlElement(name: string): boolean {\n return HTML_ELEMENT_NAMES.has(name);\n}\n\n/**\n * Get primitive info by name\n */\nexport function getReactDomPrimitive(name: string): PrimitiveRule | undefined {\n return REACT_DOM_PRIMITIVES.find((p) => p.name === name);\n}\n","import {\n AnalyzerOptions,\n AnalysisResult,\n FileInput,\n ImportInfo,\n Severity,\n Violation,\n ViolationType,\n} from '../types';\nimport { classifyFile } from '../utils/fileClassifier';\nimport { parseImports } from '../utils/importParser';\nimport {\n REACT_NATIVE_SOURCES,\n isReactNativePrimitive,\n} from '../rules/reactNativePrimitives';\nimport {\n isReactDomPrimitive,\n} from '../rules/reactDomPrimitives';\n\n/**\n * Default analyzer options\n */\nconst DEFAULT_OPTIONS: Required<AnalyzerOptions> = {\n severity: 'error',\n additionalNativePrimitives: [],\n additionalDomPrimitives: [],\n ignoredPrimitives: [],\n ignoredPatterns: [],\n additionalNativeSources: [],\n additionalDomSources: [],\n};\n\n/**\n * Check if a file path matches any of the ignored patterns\n */\nfunction matchesIgnoredPattern(\n filePath: string,\n patterns: string[]\n): boolean {\n if (patterns.length === 0) return false;\n\n for (const pattern of patterns) {\n // Simple glob matching - convert glob to regex\n const regexPattern = pattern\n .replace(/\\*\\*/g, '{{GLOBSTAR}}')\n .replace(/\\*/g, '[^/]*')\n .replace(/{{GLOBSTAR}}/g, '.*')\n .replace(/\\?/g, '.');\n\n const regex = new RegExp(regexPattern);\n if (regex.test(filePath)) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Creates a violation object\n */\nfunction createViolation(\n type: ViolationType,\n primitive: string,\n source: string,\n filePath: string,\n line: number,\n column: number,\n severity: Severity\n): Violation {\n const messages: Record<ViolationType, string> = {\n 'native-in-shared': `React Native primitive '${primitive}' from '${source}' should not be used in shared files. Use a .native.tsx file instead.`,\n 'dom-in-shared': `React DOM primitive '${primitive}' from '${source}' should not be used in shared files. Use a .web.tsx file instead.`,\n 'native-in-web': `React Native primitive '${primitive}' from '${source}' should not be used in web-specific files.`,\n 'dom-in-native': `React DOM primitive '${primitive}' from '${source}' should not be used in native-specific files.`,\n };\n\n return {\n type,\n primitive,\n source,\n filePath,\n line,\n column,\n message: messages[type],\n severity,\n };\n}\n\n/**\n * Check if an import should be flagged as a React Native primitive\n */\nfunction isNativePrimitive(\n importInfo: ImportInfo,\n additionalPrimitives: string[]\n): boolean {\n const name = importInfo.originalName ?? importInfo.name;\n\n // Check built-in primitives\n if (isReactNativePrimitive(name)) return true;\n\n // Check additional primitives\n if (additionalPrimitives.includes(name)) return true;\n\n // Check if the source is a known React Native source\n const nativeSources: Set<string> = new Set([...REACT_NATIVE_SOURCES]);\n if (nativeSources.has(importInfo.source)) {\n // Any import from react-native that's a component (starts with uppercase)\n if (/^[A-Z]/.test(name)) return true;\n }\n\n return false;\n}\n\n/**\n * Check if an import should be flagged as a React DOM primitive\n */\nfunction isDomPrimitive(\n importInfo: ImportInfo,\n additionalPrimitives: string[]\n): boolean {\n const name = importInfo.originalName ?? importInfo.name;\n\n // Check built-in primitives\n if (isReactDomPrimitive(name)) return true;\n\n // Check additional primitives\n if (additionalPrimitives.includes(name)) return true;\n\n return false;\n}\n\n/**\n * Analyze a single file for platform import violations\n *\n * @param filePath - Path to the file being analyzed\n * @param sourceCode - The source code content\n * @param options - Analyzer options\n * @returns Analysis result with violations\n *\n * @example\n * ```typescript\n * const result = analyzePlatformImports(\n * 'src/components/Button.tsx',\n * sourceCode,\n * { severity: 'error' }\n * );\n *\n * if (result.violations.length > 0) {\n * for (const v of result.violations) {\n * console.error(`${v.filePath}:${v.line}:${v.column} - ${v.message}`);\n * }\n * }\n * ```\n */\nexport function analyzePlatformImports(\n filePath: string,\n sourceCode: string,\n options?: AnalyzerOptions\n): AnalysisResult {\n const opts = { ...DEFAULT_OPTIONS, ...options };\n const fileType = classifyFile(filePath);\n const violations: Violation[] = [];\n\n // Skip ignored files\n if (matchesIgnoredPattern(filePath, opts.ignoredPatterns)) {\n return {\n filePath,\n fileType,\n violations: [],\n imports: [],\n passed: true,\n };\n }\n\n // Skip non-component files\n if (fileType === 'other' || fileType === 'styles' || fileType === 'types') {\n return {\n filePath,\n fileType,\n violations: [],\n imports: [],\n passed: true,\n };\n }\n\n // Parse imports\n const imports = parseImports(sourceCode, filePath, {\n additionalNativeSources: opts.additionalNativeSources,\n additionalDomSources: opts.additionalDomSources,\n });\n\n // Build ignored primitives set\n const ignoredPrimitives = new Set(opts.ignoredPrimitives);\n\n // Analyze each import\n for (const imp of imports) {\n // Skip type-only imports\n if (imp.isTypeOnly) continue;\n\n // Skip ignored primitives\n const primitiveName = imp.originalName ?? imp.name;\n if (ignoredPrimitives.has(primitiveName)) continue;\n\n // Check for violations based on file type\n switch (fileType) {\n case 'shared':\n // Shared files should not use platform-specific imports\n if (isNativePrimitive(imp, opts.additionalNativePrimitives)) {\n violations.push(\n createViolation(\n 'native-in-shared',\n primitiveName,\n imp.source,\n filePath,\n imp.line,\n imp.column,\n opts.severity\n )\n );\n }\n if (isDomPrimitive(imp, opts.additionalDomPrimitives)) {\n violations.push(\n createViolation(\n 'dom-in-shared',\n primitiveName,\n imp.source,\n filePath,\n imp.line,\n imp.column,\n opts.severity\n )\n );\n }\n break;\n\n case 'web':\n // Web files should not use React Native imports\n if (isNativePrimitive(imp, opts.additionalNativePrimitives)) {\n violations.push(\n createViolation(\n 'native-in-web',\n primitiveName,\n imp.source,\n filePath,\n imp.line,\n imp.column,\n opts.severity\n )\n );\n }\n break;\n\n case 'native':\n // Native files should not use React DOM imports\n if (isDomPrimitive(imp, opts.additionalDomPrimitives)) {\n violations.push(\n createViolation(\n 'dom-in-native',\n primitiveName,\n imp.source,\n filePath,\n imp.line,\n imp.column,\n opts.severity\n )\n );\n }\n break;\n }\n }\n\n return {\n filePath,\n fileType,\n violations,\n imports,\n passed: violations.length === 0,\n };\n}\n\n/**\n * Analyze multiple files for platform import violations\n *\n * @param files - Array of files to analyze\n * @param options - Analyzer options\n * @returns Array of analysis results\n *\n * @example\n * ```typescript\n * const results = analyzeFiles(\n * [\n * { path: 'Button.tsx', content: buttonSource },\n * { path: 'Button.web.tsx', content: webSource },\n * { path: 'Button.native.tsx', content: nativeSource },\n * ],\n * { severity: 'warning' }\n * );\n *\n * const failed = results.filter(r => !r.passed);\n * ```\n */\nexport function analyzeFiles(\n files: FileInput[],\n options?: AnalyzerOptions\n): AnalysisResult[] {\n return files.map((file) =>\n analyzePlatformImports(file.path, file.content, options)\n );\n}\n\n/**\n * Get a summary of analysis results\n */\nexport interface AnalysisSummary {\n totalFiles: number;\n passedFiles: number;\n failedFiles: number;\n totalViolations: number;\n violationsByType: Record<ViolationType, number>;\n violationsBySeverity: Record<Severity, number>;\n}\n\n/**\n * Summarize analysis results\n *\n * @param results - Array of analysis results\n * @returns Summary statistics\n */\nexport function summarizeResults(results: AnalysisResult[]): AnalysisSummary {\n const violationsByType: Record<ViolationType, number> = {\n 'native-in-shared': 0,\n 'dom-in-shared': 0,\n 'native-in-web': 0,\n 'dom-in-native': 0,\n };\n\n const violationsBySeverity: Record<Severity, number> = {\n error: 0,\n warning: 0,\n info: 0,\n };\n\n let totalViolations = 0;\n\n for (const result of results) {\n for (const violation of result.violations) {\n totalViolations++;\n violationsByType[violation.type]++;\n violationsBySeverity[violation.severity]++;\n }\n }\n\n return {\n totalFiles: results.length,\n passedFiles: results.filter((r) => r.passed).length,\n failedFiles: results.filter((r) => !r.passed).length,\n totalViolations,\n violationsByType,\n violationsBySeverity,\n };\n}\n\n/**\n * Format a violation for console output\n */\nexport function formatViolation(violation: Violation): string {\n const severityPrefix =\n violation.severity === 'error'\n ? 'ERROR'\n : violation.severity === 'warning'\n ? 'WARN'\n : 'INFO';\n\n return `${severityPrefix}: ${violation.filePath}:${violation.line}:${violation.column} - ${violation.message}`;\n}\n\n/**\n * Format all violations from results for console output\n */\nexport function formatViolations(results: AnalysisResult[]): string[] {\n const lines: string[] = [];\n\n for (const result of results) {\n for (const violation of result.violations) {\n lines.push(formatViolation(violation));\n }\n }\n\n return lines;\n}\n","import { Severity } from '../types';\n\n/**\n * Types of linting issues the component linter can detect.\n *\n * These are issues that TypeScript cannot catch - primarily style/pattern issues\n * that are syntactically valid but violate Idealyst conventions.\n */\nexport type LintIssueType =\n | 'hardcoded-color' // Using color strings like '#fff', 'red', 'rgb()'\n | 'direct-platform-import'; // Importing directly from react-native in shared file\n\n/**\n * A single lint issue found during analysis\n */\nexport interface LintIssue {\n /** Type of lint issue */\n type: LintIssueType;\n /** Severity level */\n severity: Severity;\n /** Line number where issue occurred */\n line: number;\n /** Column number where issue occurred */\n column: number;\n /** The problematic code snippet */\n code: string;\n /** Human-readable message describing the issue */\n message: string;\n /** Suggested fix (if available) */\n suggestion?: string;\n}\n\n/**\n * Result of linting a component file\n */\nexport interface LintResult {\n /** Path to the analyzed file */\n filePath: string;\n /** List of issues found */\n issues: LintIssue[];\n /** Whether the file passed linting (no errors) */\n passed: boolean;\n /** Count of issues by severity */\n counts: {\n error: number;\n warning: number;\n info: number;\n };\n}\n\n/**\n * Options for the component linter\n */\nexport interface ComponentLinterOptions {\n /**\n * Which rules to enable (all enabled by default)\n */\n rules?: {\n /** Detect hardcoded color values like '#fff', 'red', 'rgb()' */\n hardcodedColors?: boolean | Severity;\n /** Detect direct imports from 'react-native' in shared files */\n directPlatformImports?: boolean | Severity;\n };\n\n /**\n * Glob patterns for files to ignore\n */\n ignoredPatterns?: string[];\n\n /**\n * Color values that are allowed (e.g., 'transparent', 'inherit')\n * @default ['transparent', 'inherit', 'currentColor']\n */\n allowedColors?: string[];\n}\n\n// Common CSS color names that indicate hardcoded colors\nconst CSS_COLOR_NAMES = new Set([\n 'aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque',\n 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue',\n 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan',\n 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkgrey',\n 'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred',\n 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategray', 'darkslategrey',\n 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dimgrey',\n 'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro',\n 'ghostwhite', 'gold', 'goldenrod', 'gray', 'green', 'greenyellow', 'grey',\n 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender',\n 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan',\n 'lightgoldenrodyellow', 'lightgray', 'lightgreen', 'lightgrey', 'lightpink',\n 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategray', 'lightslategrey',\n 'lightsteelblue', 'lightyellow', 'lime', 'limegreen', 'linen', 'magenta', 'maroon',\n 'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple', 'mediumseagreen',\n 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise', 'mediumvioletred',\n 'midnightblue', 'mintcream', 'mistyrose', 'moccasin', 'navajowhite', 'navy',\n 'oldlace', 'olive', 'olivedrab', 'orange', 'orangered', 'orchid', 'palegoldenrod',\n 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff', 'peru',\n 'pink', 'plum', 'powderblue', 'purple', 'rebeccapurple', 'red', 'rosybrown',\n 'royalblue', 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna',\n 'silver', 'skyblue', 'slateblue', 'slategray', 'slategrey', 'snow', 'springgreen',\n 'steelblue', 'tan', 'teal', 'thistle', 'tomato', 'turquoise', 'violet', 'wheat',\n 'white', 'whitesmoke', 'yellow', 'yellowgreen',\n]);\n\n// Colors that are generally safe to use\nconst DEFAULT_ALLOWED_COLORS = new Set([\n 'transparent',\n 'inherit',\n 'currentColor',\n 'currentcolor',\n]);\n\n// Style properties that typically use colors\nconst COLOR_PROPERTIES = [\n 'color',\n 'backgroundColor',\n 'borderColor',\n 'borderTopColor',\n 'borderRightColor',\n 'borderBottomColor',\n 'borderLeftColor',\n 'shadowColor',\n 'textDecorationColor',\n 'tintColor',\n 'overlayColor',\n];\n\n/**\n * Check if a string is a hardcoded color value\n */\nfunction isHardcodedColor(value: string, allowedColors: Set<string>): boolean {\n const trimmed = value.trim().toLowerCase();\n\n // Check if it's an allowed color\n if (allowedColors.has(trimmed)) {\n return false;\n }\n\n // Hex color: #fff, #ffffff, #ffffffff\n if (/^#[0-9a-f]{3,8}$/i.test(trimmed)) {\n return true;\n }\n\n // RGB/RGBA: rgb(0,0,0), rgba(0,0,0,0.5)\n if (/^rgba?\\s*\\(/.test(trimmed)) {\n return true;\n }\n\n // HSL/HSLA: hsl(0,0%,0%), hsla(0,0%,0%,0.5)\n if (/^hsla?\\s*\\(/.test(trimmed)) {\n return true;\n }\n\n // CSS named color\n if (CSS_COLOR_NAMES.has(trimmed)) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Get the severity for a rule, handling boolean and severity values\n */\nfunction getRuleSeverity(\n rule: boolean | Severity | undefined,\n defaultSeverity: Severity\n): Severity | null {\n if (rule === false) return null;\n if (rule === true || rule === undefined) return defaultSeverity;\n return rule;\n}\n\n/**\n * Parse source code and find line/column for a match index\n */\nfunction getLineColumn(source: string, index: number): { line: number; column: number } {\n const lines = source.substring(0, index).split('\\n');\n return {\n line: lines.length,\n column: lines[lines.length - 1].length + 1,\n };\n}\n\n/**\n * Lint a component file for Idealyst-specific issues.\n *\n * Detects issues that TypeScript cannot catch:\n * - Hardcoded colors (TypeScript sees these as valid strings)\n * - Direct react-native imports in shared files (valid TS, but breaks web)\n *\n * @param filePath - Path to the file being analyzed\n * @param sourceCode - The source code content\n * @param options - Linter options\n * @returns Lint result with issues found\n *\n * @example\n * ```typescript\n * const result = lintComponent(\n * 'src/components/MyButton.tsx',\n * sourceCode,\n * { rules: { hardcodedColors: 'error' } }\n * );\n *\n * if (!result.passed) {\n * for (const issue of result.issues) {\n * console.error(`${issue.line}:${issue.column} - ${issue.message}`);\n * }\n * }\n * ```\n */\nexport function lintComponent(\n filePath: string,\n sourceCode: string,\n options: ComponentLinterOptions = {}\n): LintResult {\n const issues: LintIssue[] = [];\n const rules = options.rules || {};\n\n const allowedColors = new Set([\n ...DEFAULT_ALLOWED_COLORS,\n ...(options.allowedColors || []).map(c => c.toLowerCase()),\n ]);\n\n // Rule: Hardcoded colors\n const hardcodedColorSeverity = getRuleSeverity(rules.hardcodedColors, 'warning');\n if (hardcodedColorSeverity) {\n // Match color properties with string values\n for (const prop of COLOR_PROPERTIES) {\n // Match: backgroundColor: '#fff' or backgroundColor: \"red\"\n const propRegex = new RegExp(`${prop}\\\\s*:\\\\s*['\"]([^'\"]+)['\"]`, 'g');\n let match;\n while ((match = propRegex.exec(sourceCode)) !== null) {\n const colorValue = match[1];\n if (isHardcodedColor(colorValue, allowedColors)) {\n const { line, column } = getLineColumn(sourceCode, match.index);\n issues.push({\n type: 'hardcoded-color',\n severity: hardcodedColorSeverity,\n line,\n column,\n code: match[0],\n message: `Hardcoded color '${colorValue}' in ${prop}. Use theme colors instead.`,\n suggestion: `Use theme.colors.*, theme.intents[intent].*, or pass color via props`,\n });\n }\n }\n }\n\n // Also check for color/backgroundColor in template literals\n const templateColorRegex = /(?:color|backgroundColor)\\s*:\\s*`[^`]*#[0-9a-fA-F]{3,8}[^`]*`/g;\n let templateMatch;\n while ((templateMatch = templateColorRegex.exec(sourceCode)) !== null) {\n const { line, column } = getLineColumn(sourceCode, templateMatch.index);\n issues.push({\n type: 'hardcoded-color',\n severity: hardcodedColorSeverity,\n line,\n column,\n code: templateMatch[0],\n message: `Hardcoded hex color in template literal. Use theme colors instead.`,\n suggestion: `Use theme.colors.* or theme.intents[intent].*`,\n });\n }\n }\n\n // Rule: Direct platform imports in shared files\n const directPlatformSeverity = getRuleSeverity(rules.directPlatformImports, 'warning');\n if (directPlatformSeverity) {\n // Only check shared files (not .web.tsx or .native.tsx)\n const isSharedFile = !filePath.includes('.web.') && !filePath.includes('.native.');\n if (isSharedFile) {\n // Check for direct react-native imports\n const rnImportRegex = /import\\s+.*\\s+from\\s+['\"]react-native['\"]/g;\n let match;\n while ((match = rnImportRegex.exec(sourceCode)) !== null) {\n const { line, column } = getLineColumn(sourceCode, match.index);\n issues.push({\n type: 'direct-platform-import',\n severity: directPlatformSeverity,\n line,\n column,\n code: match[0],\n message: `Direct import from 'react-native' in shared file. Use @idealyst/components instead.`,\n suggestion: `Import View, Text, etc. from '@idealyst/components'`,\n });\n }\n }\n }\n\n // Calculate counts\n const counts = {\n error: issues.filter(i => i.severity === 'error').length,\n warning: issues.filter(i => i.severity === 'warning').length,\n info: issues.filter(i => i.severity === 'info').length,\n };\n\n return {\n filePath,\n issues,\n passed: counts.error === 0,\n counts,\n };\n}\n\n/**\n * Lint multiple component files\n *\n * @param files - Array of files to lint\n * @param options - Linter options\n * @returns Array of lint results\n */\nexport function lintComponents(\n files: Array<{ path: string; content: string }>,\n options: ComponentLinterOptions = {}\n): LintResult[] {\n return files.map(file => lintComponent(file.path, file.content, options));\n}\n\n/**\n * Format a lint issue for console output\n */\nexport function formatLintIssue(issue: LintIssue, filePath: string): string {\n const severityPrefix = issue.severity === 'error'\n ? 'ERROR'\n : issue.severity === 'warning'\n ? 'WARN'\n : 'INFO';\n\n let output = `${severityPrefix}: ${filePath}:${issue.line}:${issue.column} - ${issue.message}`;\n if (issue.suggestion) {\n output += `\\n Suggestion: ${issue.suggestion}`;\n }\n return output;\n}\n\n/**\n * Format all lint results for console output\n */\nexport function formatLintResults(results: LintResult[]): string[] {\n const lines: string[] = [];\n\n for (const result of results) {\n for (const issue of result.issues) {\n lines.push(formatLintIssue(issue, result.filePath));\n }\n }\n\n return lines;\n}\n\n/**\n * Summary of lint results\n */\nexport interface LintSummary {\n totalFiles: number;\n passedFiles: number;\n failedFiles: number;\n totalIssues: number;\n issuesByType: Record<LintIssueType, number>;\n issuesBySeverity: Record<Severity, number>;\n}\n\n/**\n * Summarize lint results\n */\nexport function summarizeLintResults(results: LintResult[]): LintSummary {\n const issuesByType: Record<LintIssueType, number> = {\n 'hardcoded-color': 0,\n 'direct-platform-import': 0,\n };\n\n const issuesBySeverity: Record<Severity, number> = {\n error: 0,\n warning: 0,\n info: 0,\n };\n\n let totalIssues = 0;\n\n for (const result of results) {\n for (const issue of result.issues) {\n totalIssues++;\n issuesByType[issue.type]++;\n issuesBySeverity[issue.severity]++;\n }\n }\n\n return {\n totalFiles: results.length,\n passedFiles: results.filter(r => r.passed).length,\n failedFiles: results.filter(r => !r.passed).length,\n totalIssues,\n issuesByType,\n issuesBySeverity,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACUA,IAAAA,MAAoB;AACpB,IAAAC,MAAoB;AACpB,IAAAC,QAAsB;;;ACAtB,IAAAC,MAAoB;AACpB,IAAAC,MAAoB;AACpB,IAAAC,QAAsB;;;ACCtB,SAAoB;AACpB,SAAoB;AACpB,WAAsB;AAuBf,SAAS,mBACd,WACA,UAAsC,CAAC,GAC1B;AACb,QAAM,eAAoB,aAAQ,SAAS;AAC3C,QAAM,UAAU,QAAQ,WAAW;AACnC,QAAM,UAAU,QAAQ,WAAW,CAAC;AAEpC,QAAM,MAAM,IAAI,SAAoB;AAClC,QAAI,QAAS,SAAQ,IAAI,2BAA2B,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GAAG,CAAC,CAAwB;AAC9B;","names":["ts","fs","path","ts","fs","path","analyzeBaseTheme","getStringValue","getObjectKeys","mergeThemeValues","fs","path","isComponentFile","path","ts","isSharedFile"]}