@fragments-sdk/cli 0.11.1 → 0.12.1

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.
Files changed (86) hide show
  1. package/dist/ai-client-I6MDWNYA.js +21 -0
  2. package/dist/bin.js +275 -368
  3. package/dist/bin.js.map +1 -1
  4. package/dist/{chunk-PW7QTQA6.js → chunk-4OC7FTJB.js} +2 -2
  5. package/dist/{chunk-HRFUSSZI.js → chunk-AM4MRTMN.js} +2 -2
  6. package/dist/{chunk-5G3VZH43.js → chunk-GVDSFQ4E.js} +281 -351
  7. package/dist/chunk-GVDSFQ4E.js.map +1 -0
  8. package/dist/chunk-JJ2VRTBU.js +626 -0
  9. package/dist/chunk-JJ2VRTBU.js.map +1 -0
  10. package/dist/{chunk-D5PYOXEI.js → chunk-LVWFOLUZ.js} +148 -13
  11. package/dist/{chunk-D5PYOXEI.js.map → chunk-LVWFOLUZ.js.map} +1 -1
  12. package/dist/{chunk-WXSR2II7.js → chunk-OQKMEFOS.js} +58 -6
  13. package/dist/chunk-OQKMEFOS.js.map +1 -0
  14. package/dist/chunk-SXTKFDCR.js +104 -0
  15. package/dist/chunk-SXTKFDCR.js.map +1 -0
  16. package/dist/chunk-T5OMVL7E.js +443 -0
  17. package/dist/chunk-T5OMVL7E.js.map +1 -0
  18. package/dist/{chunk-ZM4ZQZWZ.js → chunk-TPWGL2XS.js} +39 -37
  19. package/dist/chunk-TPWGL2XS.js.map +1 -0
  20. package/dist/{chunk-OQO55NKV.js → chunk-WFS63PCW.js} +85 -11
  21. package/dist/chunk-WFS63PCW.js.map +1 -0
  22. package/dist/core/index.js +9 -1
  23. package/dist/{discovery-NEOY4MPN.js → discovery-ZJQSXF56.js} +3 -3
  24. package/dist/{generate-FBHSXR3D.js → generate-RJFS2JWA.js} +4 -4
  25. package/dist/index.js +7 -6
  26. package/dist/index.js.map +1 -1
  27. package/dist/init-ZSX3NRCZ.js +636 -0
  28. package/dist/init-ZSX3NRCZ.js.map +1 -0
  29. package/dist/mcp-bin.js +2 -2
  30. package/dist/{scan-CJF2DOQW.js → scan-3PMCJ4RB.js} +6 -6
  31. package/dist/scan-generate-SYU4PYZD.js +1115 -0
  32. package/dist/scan-generate-SYU4PYZD.js.map +1 -0
  33. package/dist/{service-TQYWY65E.js → service-VMGNJZ42.js} +3 -3
  34. package/dist/{snapshot-SV2JOFZH.js → snapshot-XOISO2IS.js} +2 -2
  35. package/dist/{static-viewer-NUBFPKWH.js → static-viewer-5GXH2MGE.js} +3 -3
  36. package/dist/static-viewer-5GXH2MGE.js.map +1 -0
  37. package/dist/{test-Z5LVO724.js → test-SI4NSHQX.js} +4 -4
  38. package/dist/{tokens-CE46OTMD.js → tokens-T6SIVUT5.js} +5 -5
  39. package/dist/{viewer-DLLJIMCK.js → viewer-7ZEAFBVN.js} +13 -13
  40. package/package.json +4 -4
  41. package/src/ai-client.ts +156 -0
  42. package/src/bin.ts +44 -2
  43. package/src/build.ts +95 -33
  44. package/src/commands/__tests__/drift-sync.test.ts +252 -0
  45. package/src/commands/__tests__/scan-generate.test.ts +497 -45
  46. package/src/commands/enhance.ts +11 -35
  47. package/src/commands/init.ts +288 -260
  48. package/src/commands/scan-generate.ts +740 -139
  49. package/src/commands/scan.ts +37 -32
  50. package/src/commands/setup.ts +143 -52
  51. package/src/commands/sync.ts +357 -0
  52. package/src/commands/validate.ts +43 -1
  53. package/src/core/component-extractor.test.ts +282 -0
  54. package/src/core/component-extractor.ts +1030 -0
  55. package/src/core/discovery.ts +93 -7
  56. package/src/service/enhance/props-extractor.ts +235 -13
  57. package/src/validators.ts +236 -0
  58. package/dist/chunk-5G3VZH43.js.map +0 -1
  59. package/dist/chunk-OQO55NKV.js.map +0 -1
  60. package/dist/chunk-WXSR2II7.js.map +0 -1
  61. package/dist/chunk-ZM4ZQZWZ.js.map +0 -1
  62. package/dist/init-UFGK5TCN.js +0 -867
  63. package/dist/init-UFGK5TCN.js.map +0 -1
  64. package/dist/scan-generate-SJAN5MVI.js +0 -691
  65. package/dist/scan-generate-SJAN5MVI.js.map +0 -1
  66. package/src/ai.ts +0 -266
  67. package/src/commands/init-framework.ts +0 -414
  68. package/src/mcp/bin.ts +0 -36
  69. package/src/migrate/bin.ts +0 -114
  70. package/src/theme/index.ts +0 -77
  71. package/src/viewer/bin.ts +0 -86
  72. package/src/viewer/cli/health.ts +0 -256
  73. package/src/viewer/cli/index.ts +0 -33
  74. package/src/viewer/cli/scan.ts +0 -124
  75. package/src/viewer/cli/utils.ts +0 -174
  76. /package/dist/{discovery-NEOY4MPN.js.map → ai-client-I6MDWNYA.js.map} +0 -0
  77. /package/dist/{chunk-PW7QTQA6.js.map → chunk-4OC7FTJB.js.map} +0 -0
  78. /package/dist/{chunk-HRFUSSZI.js.map → chunk-AM4MRTMN.js.map} +0 -0
  79. /package/dist/{scan-CJF2DOQW.js.map → discovery-ZJQSXF56.js.map} +0 -0
  80. /package/dist/{generate-FBHSXR3D.js.map → generate-RJFS2JWA.js.map} +0 -0
  81. /package/dist/{service-TQYWY65E.js.map → scan-3PMCJ4RB.js.map} +0 -0
  82. /package/dist/{static-viewer-NUBFPKWH.js.map → service-VMGNJZ42.js.map} +0 -0
  83. /package/dist/{snapshot-SV2JOFZH.js.map → snapshot-XOISO2IS.js.map} +0 -0
  84. /package/dist/{test-Z5LVO724.js.map → test-SI4NSHQX.js.map} +0 -0
  85. /package/dist/{tokens-CE46OTMD.js.map → tokens-T6SIVUT5.js.map} +0 -0
  86. /package/dist/{viewer-DLLJIMCK.js.map → viewer-7ZEAFBVN.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/component-extractor.ts"],"sourcesContent":["/**\n * ComponentExtractor — persistent LanguageService-based prop extraction.\n *\n * Replaces auto-props.ts with:\n * - Persistent ts.LanguageService (not throwaway ts.createProgram())\n * - Incremental invalidation via projectVersion\n * - Compound component (Object.assign) sub-component prop extraction\n * - Full type serialization to PropMeta format\n *\n * Zero additional dependencies — uses raw TypeScript APIs.\n */\n\nimport ts from 'typescript';\nimport { existsSync, readFileSync, statSync, readdirSync } from 'node:fs';\nimport { resolve, dirname, join } from 'node:path';\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport interface ComponentExtractor {\n /** Extract metadata for a single component by export name */\n extract(filePath: string, exportName?: string): ComponentMeta | null;\n\n /** Extract all exported components found in a file */\n extractAll(filePath: string): ComponentMeta[];\n\n /** Notify extractor that a file changed (incremental) */\n invalidate(filePath: string): void;\n\n /** Clean up resources */\n dispose(): void;\n}\n\nexport interface ComponentMeta {\n name: string;\n filePath: string;\n description: string;\n props: Record<string, PropMeta>;\n composition: CompositionMeta | null;\n exports: string[];\n dependencies: string[];\n}\n\nexport interface PropMeta {\n name: string;\n type: string;\n typeKind: PropTypeKind;\n values?: string[];\n default?: string;\n description?: string;\n required: boolean;\n source: 'local' | 'inherited';\n}\n\nexport type PropTypeKind =\n | 'string' | 'number' | 'boolean'\n | 'enum'\n | 'function'\n | 'node'\n | 'element'\n | 'object' | 'array'\n | 'union'\n | 'custom';\n\nexport interface CompositionMeta {\n pattern: 'compound' | 'controlled' | 'simple';\n parts: PartMeta[];\n required: string[];\n}\n\nexport interface PartMeta {\n name: string;\n props: Record<string, PropMeta>;\n}\n\n// ---------------------------------------------------------------------------\n// Internal types\n// ---------------------------------------------------------------------------\n\ninterface ResolvedComponent {\n name: string;\n propsType: ts.Type | null;\n componentNode: ts.Node | null;\n compoundParts: Map<string, ts.Type> | null;\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\nexport function createComponentExtractor(tsconfigPath?: string): ComponentExtractor {\n let projectVersion = 0;\n const fileVersions = new Map<string, number>();\n const fileSnapshots = new Map<string, ts.IScriptSnapshot>();\n\n // Parse tsconfig or use inferred settings\n const rootDir = tsconfigPath ? dirname(resolve(tsconfigPath)) : process.cwd();\n const parsedCommandLine = tsconfigPath\n ? parseTsConfig(tsconfigPath)\n : inferCompilerOptions(rootDir);\n\n const scriptFileNames = new Set(parsedCommandLine.fileNames);\n\n const host: ts.LanguageServiceHost = {\n getProjectVersion: () => projectVersion.toString(),\n getScriptVersion: (fileName) => (fileVersions.get(fileName) ?? 0).toString(),\n getScriptSnapshot: (fileName) => {\n const cached = fileSnapshots.get(fileName);\n if (cached) return cached;\n\n let text: string;\n try {\n text = readFileSync(fileName, 'utf-8');\n } catch {\n return undefined;\n }\n const snapshot = ts.ScriptSnapshot.fromString(text);\n fileSnapshots.set(fileName, snapshot);\n return snapshot;\n },\n getScriptFileNames: () => [...scriptFileNames],\n getCompilationSettings: () => parsedCommandLine.options,\n getCurrentDirectory: () => rootDir,\n getDefaultLibFileName: ts.getDefaultLibFilePath,\n fileExists: ts.sys.fileExists,\n readFile: ts.sys.readFile,\n readDirectory: ts.sys.readDirectory,\n directoryExists: ts.sys.directoryExists,\n getDirectories: ts.sys.getDirectories,\n };\n\n const languageService = ts.createLanguageService(host, ts.createDocumentRegistry());\n\n function ensureFile(filePath: string): void {\n const resolved = resolve(filePath);\n if (!scriptFileNames.has(resolved)) {\n scriptFileNames.add(resolved);\n projectVersion++;\n }\n }\n\n function getChecker(): ts.TypeChecker {\n const program = languageService.getProgram();\n if (!program) throw new Error('Failed to get program from LanguageService');\n return program.getTypeChecker();\n }\n\n function getSourceFile(filePath: string): ts.SourceFile | undefined {\n return languageService.getProgram()?.getSourceFile(resolve(filePath));\n }\n\n return {\n extract(filePath: string, exportName?: string): ComponentMeta | null {\n const resolved = resolve(filePath);\n ensureFile(resolved);\n\n const sourceFile = getSourceFile(resolved);\n if (!sourceFile) return null;\n\n const checker = getChecker();\n const moduleSymbol = checker.getSymbolAtLocation(sourceFile);\n if (!moduleSymbol) return null;\n\n const exports = checker.getExportsOfModule(moduleSymbol);\n const targetName = exportName ?? findPrimaryExport(exports, sourceFile);\n if (!targetName) return null;\n\n const exportSymbol = exports.find(s => s.getName() === targetName);\n if (!exportSymbol) return null;\n\n const component = resolveExportedComponent(checker, exportSymbol, sourceFile);\n if (!component) return null;\n\n return buildComponentMeta(checker, component, resolved, sourceFile, exports);\n },\n\n extractAll(filePath: string): ComponentMeta[] {\n const resolved = resolve(filePath);\n ensureFile(resolved);\n\n const sourceFile = getSourceFile(resolved);\n if (!sourceFile) return [];\n\n const checker = getChecker();\n const moduleSymbol = checker.getSymbolAtLocation(sourceFile);\n if (!moduleSymbol) return [];\n\n const exports = checker.getExportsOfModule(moduleSymbol);\n const results: ComponentMeta[] = [];\n\n for (const exportSymbol of exports) {\n const name = exportSymbol.getName();\n // Only consider PascalCase exports as potential components\n if (!/^[A-Z]/.test(name)) continue;\n\n const component = resolveExportedComponent(checker, exportSymbol, sourceFile);\n if (!component) continue;\n\n const meta = buildComponentMeta(checker, component, resolved, sourceFile, exports);\n if (meta) results.push(meta);\n }\n\n return results;\n },\n\n invalidate(filePath: string): void {\n const resolved = resolve(filePath);\n fileVersions.set(resolved, (fileVersions.get(resolved) ?? 0) + 1);\n fileSnapshots.delete(resolved);\n projectVersion++;\n },\n\n dispose(): void {\n languageService.dispose();\n fileSnapshots.clear();\n fileVersions.clear();\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n// tsconfig parsing\n// ---------------------------------------------------------------------------\n\nfunction parseTsConfig(tsconfigPath: string): ts.ParsedCommandLine {\n const resolved = resolve(tsconfigPath);\n const configFile = ts.readConfigFile(resolved, ts.sys.readFile);\n if (configFile.error) {\n throw new Error(`Failed to read tsconfig: ${ts.flattenDiagnosticMessageText(configFile.error.messageText, '\\n')}`);\n }\n\n return ts.parseJsonConfigFileContent(\n configFile.config,\n ts.sys,\n dirname(resolved),\n undefined,\n resolved,\n );\n}\n\nfunction inferCompilerOptions(rootDir: string): ts.ParsedCommandLine {\n return {\n options: {\n target: ts.ScriptTarget.ES2022,\n module: ts.ModuleKind.ESNext,\n moduleResolution: ts.ModuleResolutionKind.Bundler,\n jsx: ts.JsxEmit.ReactJSX,\n allowSyntheticDefaultImports: true,\n esModuleInterop: true,\n skipLibCheck: true,\n strict: false,\n noEmit: true,\n },\n fileNames: [],\n errors: [],\n };\n}\n\n// ---------------------------------------------------------------------------\n// Export resolution\n// ---------------------------------------------------------------------------\n\n/**\n * Find the \"primary\" export — prefers the default export or the first PascalCase export.\n */\nfunction findPrimaryExport(exports: ts.Symbol[], sourceFile: ts.SourceFile): string | null {\n // Default export\n const defaultExport = exports.find(s => s.getName() === 'default');\n if (defaultExport) return 'default';\n\n // First PascalCase named export\n for (const s of exports) {\n if (/^[A-Z][a-zA-Z0-9]*$/.test(s.getName())) {\n return s.getName();\n }\n }\n\n return null;\n}\n\n/**\n * Resolve an export symbol to a component with its props type.\n * Handles: direct functions, forwardRef, memo, Object.assign, FC<Props>.\n */\nfunction resolveExportedComponent(\n checker: ts.TypeChecker,\n exportSymbol: ts.Symbol,\n sourceFile: ts.SourceFile,\n): ResolvedComponent | null {\n const name = exportSymbol.getName();\n\n // Follow aliases (re-exports)\n let symbol = exportSymbol;\n if (symbol.flags & ts.SymbolFlags.Alias) {\n symbol = checker.getAliasedSymbol(symbol);\n }\n\n const declarations = symbol.getDeclarations();\n if (!declarations || declarations.length === 0) return null;\n\n const declaration = declarations[0];\n\n // Variable declaration: const X = ... (forwardRef, memo, Object.assign, arrow, FC)\n if (ts.isVariableDeclaration(declaration) && declaration.initializer) {\n return resolveFromExpression(checker, name, declaration.initializer, declaration, sourceFile);\n }\n\n // Function declaration: function X(props: Props) { ... }\n if (ts.isFunctionDeclaration(declaration)) {\n const propsType = extractPropsFromFunctionLike(checker, declaration);\n return propsType ? { name, propsType, componentNode: declaration, compoundParts: null } : null;\n }\n\n // Export assignment: export default X\n if (ts.isExportAssignment(declaration) && declaration.expression) {\n return resolveFromExpression(checker, name, declaration.expression, null, sourceFile);\n }\n\n return null;\n}\n\nfunction resolveFromExpression(\n checker: ts.TypeChecker,\n name: string,\n expression: ts.Expression,\n variableDecl: ts.VariableDeclaration | null,\n sourceFile: ts.SourceFile,\n): ResolvedComponent | null {\n // Unwrap parentheses, type assertions\n expression = unwrapExpression(expression);\n\n // Arrow function or function expression\n if (ts.isArrowFunction(expression) || ts.isFunctionExpression(expression)) {\n const propsType = extractPropsFromFunctionLike(checker, expression);\n return propsType ? { name, propsType, componentNode: expression, compoundParts: null } : null;\n }\n\n // Call expression: React.forwardRef, React.memo, Object.assign\n if (ts.isCallExpression(expression)) {\n return resolveCallExpression(checker, name, expression, variableDecl, sourceFile);\n }\n\n // Identifier reference — follow to its declaration\n if (ts.isIdentifier(expression)) {\n const sym = checker.getSymbolAtLocation(expression);\n if (sym) {\n const decls = sym.getDeclarations();\n if (decls && decls.length > 0) {\n const decl = decls[0];\n if (ts.isVariableDeclaration(decl) && decl.initializer) {\n return resolveFromExpression(checker, name, decl.initializer, decl, sourceFile);\n }\n if (ts.isFunctionDeclaration(decl)) {\n const propsType = extractPropsFromFunctionLike(checker, decl);\n return propsType ? { name, propsType, componentNode: decl, compoundParts: null } : null;\n }\n }\n }\n }\n\n // FC<Props> typed variable\n if (variableDecl?.type && ts.isTypeReferenceNode(variableDecl.type)) {\n const typeName = variableDecl.type.typeName.getText(sourceFile);\n if (typeName.includes('FC') || typeName.includes('FunctionComponent')) {\n const typeArg = variableDecl.type.typeArguments?.[0];\n if (typeArg) {\n const propsType = checker.getTypeFromTypeNode(typeArg);\n return { name, propsType, componentNode: expression, compoundParts: null };\n }\n }\n }\n\n return null;\n}\n\nfunction resolveCallExpression(\n checker: ts.TypeChecker,\n name: string,\n call: ts.CallExpression,\n variableDecl: ts.VariableDeclaration | null,\n sourceFile: ts.SourceFile,\n): ResolvedComponent | null {\n const callee = call.expression;\n\n // Object.assign(Root, { Header, Body, ... })\n if (isObjectAssignCall(callee, sourceFile)) {\n return resolveObjectAssign(checker, name, call, sourceFile);\n }\n\n // React.forwardRef<Ref, Props>(fn) or forwardRef<Ref, Props>(fn)\n if (isForwardRefCall(callee)) {\n return resolveForwardRef(checker, name, call, sourceFile);\n }\n\n // React.memo(Component) or memo(Component)\n if (isMemoCall(callee)) {\n const innerArg = call.arguments[0];\n if (innerArg) {\n return resolveFromExpression(checker, name, innerArg, variableDecl, sourceFile);\n }\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Object.assign compound component resolution\n// ---------------------------------------------------------------------------\n\nfunction resolveObjectAssign(\n checker: ts.TypeChecker,\n name: string,\n call: ts.CallExpression,\n sourceFile: ts.SourceFile,\n): ResolvedComponent | null {\n if (call.arguments.length < 2) return null;\n\n // First arg is the root component\n const rootExpr = call.arguments[0];\n const rootResult = resolveFromExpression(checker, name, rootExpr, null, sourceFile);\n\n // Second arg is the object literal with sub-components\n const subsArg = call.arguments[1];\n const compoundParts = new Map<string, ts.Type>();\n\n if (ts.isObjectLiteralExpression(subsArg)) {\n for (const prop of subsArg.properties) {\n let subName: string | null = null;\n let subExpression: ts.Expression | null = null;\n\n if (ts.isShorthandPropertyAssignment(prop)) {\n subName = prop.name.text;\n // Resolve the identifier to its type\n const sym = checker.getSymbolAtLocation(prop.name);\n if (sym) {\n const subPropsType = extractPropsFromComponentSymbol(checker, sym);\n if (subPropsType) {\n compoundParts.set(subName, subPropsType);\n }\n }\n } else if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {\n subName = prop.name.text;\n subExpression = prop.initializer;\n if (subExpression) {\n const subType = extractPropsFromExpression(checker, subExpression, sourceFile);\n if (subType) {\n compoundParts.set(subName, subType);\n }\n }\n }\n }\n }\n\n return {\n name,\n propsType: rootResult?.propsType ?? null,\n componentNode: rootResult?.componentNode ?? rootExpr,\n compoundParts: compoundParts.size > 0 ? compoundParts : null,\n };\n}\n\n/**\n * Extract props type from a component symbol (function, variable, etc.)\n */\nfunction extractPropsFromComponentSymbol(checker: ts.TypeChecker, symbol: ts.Symbol): ts.Type | null {\n // Follow aliases\n let sym = symbol;\n if (sym.flags & ts.SymbolFlags.Alias) {\n sym = checker.getAliasedSymbol(sym);\n }\n\n const decls = sym.getDeclarations();\n if (!decls || decls.length === 0) return null;\n\n const decl = decls[0];\n\n if (ts.isFunctionDeclaration(decl)) {\n return extractPropsFromFunctionLike(checker, decl);\n }\n\n if (ts.isVariableDeclaration(decl) && decl.initializer) {\n // forwardRef, memo, arrow function, etc.\n return extractPropsFromExpressionDeep(checker, decl);\n }\n\n return null;\n}\n\n/**\n * Extract props type from an arbitrary expression (used for Object.assign values).\n */\nfunction extractPropsFromExpression(checker: ts.TypeChecker, expr: ts.Expression, sourceFile: ts.SourceFile): ts.Type | null {\n expr = unwrapExpression(expr);\n\n if (ts.isIdentifier(expr)) {\n const sym = checker.getSymbolAtLocation(expr);\n if (sym) return extractPropsFromComponentSymbol(checker, sym);\n }\n\n if (ts.isArrowFunction(expr) || ts.isFunctionExpression(expr)) {\n return extractPropsFromFunctionLike(checker, expr);\n }\n\n if (ts.isCallExpression(expr)) {\n if (isForwardRefCall(expr.expression)) {\n const typeArg = expr.typeArguments?.[1];\n if (typeArg) return checker.getTypeFromTypeNode(typeArg);\n const innerArg = expr.arguments[0];\n if (innerArg && (ts.isArrowFunction(innerArg) || ts.isFunctionExpression(innerArg))) {\n return extractPropsFromFunctionLike(checker, innerArg);\n }\n }\n if (isMemoCall(expr.expression) && expr.arguments[0]) {\n return extractPropsFromExpression(checker, expr.arguments[0], sourceFile);\n }\n }\n\n return null;\n}\n\n/**\n * Deep extraction from a variable declaration.\n */\nfunction extractPropsFromExpressionDeep(checker: ts.TypeChecker, decl: ts.VariableDeclaration): ts.Type | null {\n if (!decl.initializer) return null;\n let expr = unwrapExpression(decl.initializer);\n\n if (ts.isArrowFunction(expr) || ts.isFunctionExpression(expr)) {\n return extractPropsFromFunctionLike(checker, expr);\n }\n\n if (ts.isCallExpression(expr)) {\n if (isForwardRefCall(expr.expression)) {\n const typeArg = expr.typeArguments?.[1];\n if (typeArg) return checker.getTypeFromTypeNode(typeArg);\n const innerArg = expr.arguments[0];\n if (innerArg && (ts.isArrowFunction(innerArg) || ts.isFunctionExpression(innerArg))) {\n return extractPropsFromFunctionLike(checker, innerArg);\n }\n }\n if (isMemoCall(expr.expression) && expr.arguments[0]) {\n return extractPropsFromExpressionDeep(checker, {\n ...decl,\n initializer: expr.arguments[0],\n } as ts.VariableDeclaration);\n }\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// forwardRef resolution\n// ---------------------------------------------------------------------------\n\nfunction resolveForwardRef(\n checker: ts.TypeChecker,\n name: string,\n call: ts.CallExpression,\n sourceFile: ts.SourceFile,\n): ResolvedComponent | null {\n // Try type arguments first: forwardRef<Ref, Props>(...)\n const propsTypeArg = call.typeArguments?.[1];\n if (propsTypeArg) {\n const propsType = checker.getTypeFromTypeNode(propsTypeArg);\n const innerArg = call.arguments[0];\n const componentNode = innerArg && (ts.isArrowFunction(innerArg) || ts.isFunctionExpression(innerArg))\n ? innerArg : null;\n return { name, propsType, componentNode, compoundParts: null };\n }\n\n // Fall back to inner function's parameter type\n const innerArg = call.arguments[0];\n if (innerArg) {\n if (ts.isArrowFunction(innerArg) || ts.isFunctionExpression(innerArg)) {\n const propsType = extractPropsFromFunctionLike(checker, innerArg);\n return propsType ? { name, propsType, componentNode: innerArg, compoundParts: null } : null;\n }\n if (ts.isIdentifier(innerArg)) {\n const sym = checker.getSymbolAtLocation(innerArg);\n if (sym) {\n const propsType = extractPropsFromComponentSymbol(checker, sym);\n if (propsType) return { name, propsType, componentNode: innerArg, compoundParts: null };\n }\n }\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Props extraction from function-like declarations\n// ---------------------------------------------------------------------------\n\n/**\n * Extract the props type from a function's first parameter.\n */\nfunction extractPropsFromFunctionLike(\n checker: ts.TypeChecker,\n func: ts.FunctionLikeDeclaration,\n): ts.Type | null {\n const firstParam = func.parameters[0];\n if (!firstParam) return null;\n\n // If there's a type annotation, use it\n if (firstParam.type) {\n return checker.getTypeFromTypeNode(firstParam.type);\n }\n\n // Otherwise try to infer from the parameter's symbol\n const paramSymbol = checker.getSymbolAtLocation(firstParam.name);\n if (paramSymbol) {\n return checker.getTypeOfSymbolAtLocation(paramSymbol, firstParam);\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Build ComponentMeta from resolved component\n// ---------------------------------------------------------------------------\n\nfunction buildComponentMeta(\n checker: ts.TypeChecker,\n component: ResolvedComponent,\n filePath: string,\n sourceFile: ts.SourceFile,\n moduleExports: ts.Symbol[],\n): ComponentMeta | null {\n const props: Record<string, PropMeta> = {};\n const sourceFilePath = toPosixPath(sourceFile.fileName);\n\n if (component.propsType) {\n extractPropsFromType(checker, component.propsType, props, sourceFilePath);\n }\n\n // Extract defaults from the component function body\n const defaults = component.componentNode\n ? extractDefaultValues(component.componentNode)\n : {};\n\n // Apply defaults\n for (const [propName, defaultVal] of Object.entries(defaults)) {\n if (props[propName]) {\n props[propName].default = defaultVal;\n }\n }\n\n // Build composition meta\n let composition: CompositionMeta | null = null;\n if (component.compoundParts && component.compoundParts.size > 0) {\n const parts: PartMeta[] = [];\n for (const [partName, partType] of component.compoundParts) {\n const partProps: Record<string, PropMeta> = {};\n extractPropsFromType(checker, partType, partProps, sourceFilePath);\n parts.push({ name: partName, props: partProps });\n }\n\n composition = {\n pattern: 'compound',\n parts,\n required: [], // Could be inferred from usage patterns\n };\n }\n\n // Extract description from JSDoc\n let description = '';\n const componentSymbol = moduleExports.find(s => s.getName() === component.name);\n if (componentSymbol) {\n description = extractJSDocDescription(checker, componentSymbol);\n }\n\n // Collect export names\n const exportNames = moduleExports\n .filter(s => /^[A-Z]/.test(s.getName()))\n .map(s => s.getName());\n\n // Collect import dependencies (other components imported)\n const dependencies = extractDependencies(sourceFile);\n\n return {\n name: component.name,\n filePath,\n description,\n props,\n composition,\n exports: exportNames,\n dependencies,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Type → PropMeta extraction\n// ---------------------------------------------------------------------------\n\nfunction extractPropsFromType(\n checker: ts.TypeChecker,\n propsType: ts.Type,\n result: Record<string, PropMeta>,\n sourceFilePath: string,\n): void {\n for (const symbol of checker.getPropertiesOfType(propsType)) {\n const propName = symbol.getName();\n\n // Skip internal/private props\n if (propName.startsWith('_') || propName.startsWith('$')) continue;\n\n // Skip React internal props\n if (propName === 'key' || propName === 'ref') continue;\n\n const declarations = symbol.getDeclarations() ?? [];\n\n // Determine source: local vs inherited\n const isLocal = declarations.some(\n d => toPosixPath(d.getSourceFile().fileName) === sourceFilePath,\n );\n\n const referenceNode = declarations[0];\n if (!referenceNode) continue;\n\n const propType = checker.getTypeOfSymbolAtLocation(symbol, referenceNode);\n const serialized = serializePropType(checker, propType);\n const description = ts.displayPartsToString(symbol.getDocumentationComment(checker)).trim();\n const required = (symbol.flags & ts.SymbolFlags.Optional) === 0;\n\n // Extract @default from JSDoc tags\n let jsDocDefault: string | undefined;\n const jsDocTags = symbol.getJsDocTags(checker);\n const defaultTag = jsDocTags.find(t => t.name === 'default');\n if (defaultTag?.text) {\n jsDocDefault = ts.displayPartsToString(defaultTag.text).trim();\n }\n\n result[propName] = {\n name: propName,\n type: serialized.type,\n typeKind: serialized.typeKind,\n values: serialized.values,\n default: jsDocDefault,\n description: description || undefined,\n required,\n source: isLocal ? 'local' : 'inherited',\n };\n }\n}\n\n// ---------------------------------------------------------------------------\n// Type serializer: ts.Type → PropMeta shape\n// ---------------------------------------------------------------------------\n\nfunction serializePropType(\n checker: ts.TypeChecker,\n type: ts.Type,\n): Pick<PropMeta, 'type' | 'typeKind' | 'values'> {\n // Check for ReactNode/ReactElement BEFORE union decomposition,\n // because ReactNode is defined as a large union in React's types.\n const aliasSymbol = type.aliasSymbol;\n if (aliasSymbol) {\n const aliasName = aliasSymbol.getName();\n if (aliasName === 'ReactNode') {\n return { type: 'ReactNode', typeKind: 'node' };\n }\n if (aliasName === 'ReactElement') {\n return { type: 'ReactElement', typeKind: 'element' };\n }\n }\n\n // Handle union types (including optional which adds undefined)\n if (type.isUnion()) {\n const nonNullableTypes = type.types.filter(\n t => !((t.flags & ts.TypeFlags.Undefined) || (t.flags & ts.TypeFlags.Null) || (t.flags & ts.TypeFlags.Void)),\n );\n\n // Single type after filtering nullable\n if (nonNullableTypes.length === 1) {\n return serializePropType(checker, nonNullableTypes[0]);\n }\n\n // All string literals → enum\n if (nonNullableTypes.length > 0 && nonNullableTypes.every(t => t.isStringLiteral())) {\n const values = nonNullableTypes.map(t => (t as ts.StringLiteralType).value);\n return {\n type: values.map(v => `\"${v}\"`).join(' | '),\n typeKind: 'enum',\n values,\n };\n }\n\n // All boolean-like\n if (nonNullableTypes.every(t => isBooleanLike(t))) {\n return { type: 'boolean', typeKind: 'boolean' };\n }\n\n // Mixed union\n const typeStr = checker.typeToString(type, undefined, ts.TypeFormatFlags.NoTruncation);\n return { type: typeStr, typeKind: 'union' };\n }\n\n // Check for ReactNode / ReactElement\n const typeStr = checker.typeToString(type, undefined, ts.TypeFormatFlags.NoTruncation);\n if (typeStr.includes('ReactNode')) {\n return { type: 'ReactNode', typeKind: 'node' };\n }\n if (typeStr.includes('ReactElement') || typeStr.includes('JSX.Element')) {\n return { type: 'ReactElement', typeKind: 'element' };\n }\n\n // Function types\n if (type.getCallSignatures().length > 0) {\n return { type: typeStr, typeKind: 'function' };\n }\n\n // Primitives\n if (type.flags & ts.TypeFlags.String) return { type: 'string', typeKind: 'string' };\n if (type.flags & ts.TypeFlags.Number) return { type: 'number', typeKind: 'number' };\n if (type.flags & ts.TypeFlags.Boolean || type.flags & ts.TypeFlags.BooleanLiteral) {\n return { type: 'boolean', typeKind: 'boolean' };\n }\n\n // String literal (not in union)\n if (type.isStringLiteral()) {\n return { type: `\"${type.value}\"`, typeKind: 'enum', values: [type.value] };\n }\n\n // Array\n if (checker.isArrayType(type) || checker.isTupleType(type)) {\n return { type: typeStr, typeKind: 'array' };\n }\n\n // Object\n if (type.flags & ts.TypeFlags.Object) {\n return { type: typeStr, typeKind: 'object' };\n }\n\n return { type: typeStr, typeKind: 'custom' };\n}\n\n// ---------------------------------------------------------------------------\n// Default value extraction\n// ---------------------------------------------------------------------------\n\nfunction extractDefaultValues(node: ts.Node): Record<string, string> {\n const defaults: Record<string, string> = {};\n\n // Find function-like node\n let funcNode: ts.FunctionLikeDeclaration | null = null;\n if (ts.isFunctionDeclaration(node) || ts.isArrowFunction(node) || ts.isFunctionExpression(node)) {\n funcNode = node;\n }\n\n if (!funcNode?.parameters?.length) return defaults;\n\n const firstParam = funcNode.parameters[0];\n if (!ts.isObjectBindingPattern(firstParam.name)) return defaults;\n\n for (const element of firstParam.name.elements) {\n let propName: string | null = null;\n\n if (element.propertyName) {\n if (ts.isIdentifier(element.propertyName) || ts.isStringLiteral(element.propertyName)) {\n propName = element.propertyName.text;\n }\n } else if (ts.isIdentifier(element.name)) {\n propName = element.name.text;\n }\n\n if (!propName || !element.initializer) continue;\n\n const value = readLiteralValue(element.initializer);\n if (value !== undefined) {\n defaults[propName] = value;\n }\n }\n\n return defaults;\n}\n\nfunction readLiteralValue(expression: ts.Expression): string | undefined {\n if (ts.isStringLiteral(expression) || ts.isNoSubstitutionTemplateLiteral(expression)) {\n return expression.text;\n }\n if (ts.isNumericLiteral(expression)) {\n return expression.text;\n }\n if (expression.kind === ts.SyntaxKind.TrueKeyword) return 'true';\n if (expression.kind === ts.SyntaxKind.FalseKeyword) return 'false';\n if (expression.kind === ts.SyntaxKind.NullKeyword) return 'null';\n if (\n ts.isPrefixUnaryExpression(expression) &&\n expression.operator === ts.SyntaxKind.MinusToken &&\n ts.isNumericLiteral(expression.operand)\n ) {\n return `-${expression.operand.text}`;\n }\n\n return undefined;\n}\n\n// ---------------------------------------------------------------------------\n// JSDoc extraction\n// ---------------------------------------------------------------------------\n\nfunction extractJSDocDescription(checker: ts.TypeChecker, symbol: ts.Symbol): string {\n // Follow aliases\n let sym = symbol;\n if (sym.flags & ts.SymbolFlags.Alias) {\n sym = checker.getAliasedSymbol(sym);\n }\n\n const docComment = ts.displayPartsToString(sym.getDocumentationComment(checker)).trim();\n if (docComment) return docComment;\n\n // Try to get from the Props interface\n const decls = sym.getDeclarations();\n if (decls) {\n for (const decl of decls) {\n // Look for the Props type\n const sourceFile = decl.getSourceFile();\n for (const stmt of sourceFile.statements) {\n if (\n (ts.isInterfaceDeclaration(stmt) || ts.isTypeAliasDeclaration(stmt)) &&\n stmt.name.text === `${symbol.getName()}Props`\n ) {\n const propsDoc = ts.displayPartsToString(\n checker.getSymbolAtLocation(stmt.name)?.getDocumentationComment(checker) ?? [],\n ).trim();\n if (propsDoc) return propsDoc;\n }\n }\n }\n }\n\n return '';\n}\n\n// ---------------------------------------------------------------------------\n// Import dependency extraction\n// ---------------------------------------------------------------------------\n\nfunction extractDependencies(sourceFile: ts.SourceFile): string[] {\n const deps: string[] = [];\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n if (!ts.isStringLiteral(stmt.moduleSpecifier)) continue;\n\n const modulePath = stmt.moduleSpecifier.text;\n // Only relative imports to other components\n if (!modulePath.startsWith('.') && !modulePath.startsWith('/')) continue;\n\n const clause = stmt.importClause;\n if (!clause) continue;\n\n // Default import\n if (clause.name && /^[A-Z]/.test(clause.name.text)) {\n deps.push(clause.name.text);\n }\n\n // Named imports\n if (clause.namedBindings && ts.isNamedImports(clause.namedBindings)) {\n for (const element of clause.namedBindings.elements) {\n if (/^[A-Z]/.test(element.name.text)) {\n deps.push(element.name.text);\n }\n }\n }\n }\n return deps;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction unwrapExpression(expr: ts.Expression): ts.Expression {\n while (true) {\n if (ts.isParenthesizedExpression(expr)) {\n expr = expr.expression;\n } else if (ts.isAsExpression(expr) || ts.isTypeAssertionExpression(expr)) {\n expr = expr.expression;\n } else {\n return expr;\n }\n }\n}\n\nfunction isObjectAssignCall(callee: ts.Expression, sourceFile: ts.SourceFile): boolean {\n if (\n ts.isPropertyAccessExpression(callee) &&\n ts.isIdentifier(callee.expression) &&\n callee.expression.text === 'Object' &&\n callee.name.text === 'assign'\n ) {\n return true;\n }\n return false;\n}\n\nfunction isForwardRefCall(callee: ts.Expression): boolean {\n // React.forwardRef(...)\n if (ts.isPropertyAccessExpression(callee) && callee.name.text === 'forwardRef') {\n return true;\n }\n // forwardRef(...)\n if (ts.isIdentifier(callee) && callee.text === 'forwardRef') {\n return true;\n }\n return false;\n}\n\nfunction isMemoCall(callee: ts.Expression): boolean {\n if (ts.isPropertyAccessExpression(callee) && callee.name.text === 'memo') {\n return true;\n }\n if (ts.isIdentifier(callee) && callee.text === 'memo') {\n return true;\n }\n return false;\n}\n\nfunction isBooleanLike(type: ts.Type): boolean {\n return (\n (type.flags & ts.TypeFlags.BooleanLike) !== 0 ||\n type.flags === ts.TypeFlags.BooleanLiteral\n );\n}\n\nfunction toPosixPath(filePath: string): string {\n return filePath.replace(/\\\\/g, '/');\n}\n"],"mappings":";;;AAYA,OAAO,QAAQ;AACf,SAAqB,oBAA2C;AAChE,SAAS,SAAS,eAAqB;AA6EhC,SAAS,yBAAyB,cAA2C;AAClF,MAAI,iBAAiB;AACrB,QAAM,eAAe,oBAAI,IAAoB;AAC7C,QAAM,gBAAgB,oBAAI,IAAgC;AAG1D,QAAM,UAAU,eAAe,QAAQ,QAAQ,YAAY,CAAC,IAAI,QAAQ,IAAI;AAC5E,QAAM,oBAAoB,eACtB,cAAc,YAAY,IAC1B,qBAAqB,OAAO;AAEhC,QAAM,kBAAkB,IAAI,IAAI,kBAAkB,SAAS;AAE3D,QAAM,OAA+B;AAAA,IACnC,mBAAmB,MAAM,eAAe,SAAS;AAAA,IACjD,kBAAkB,CAAC,cAAc,aAAa,IAAI,QAAQ,KAAK,GAAG,SAAS;AAAA,IAC3E,mBAAmB,CAAC,aAAa;AAC/B,YAAM,SAAS,cAAc,IAAI,QAAQ;AACzC,UAAI,OAAQ,QAAO;AAEnB,UAAI;AACJ,UAAI;AACF,eAAO,aAAa,UAAU,OAAO;AAAA,MACvC,QAAQ;AACN,eAAO;AAAA,MACT;AACA,YAAM,WAAW,GAAG,eAAe,WAAW,IAAI;AAClD,oBAAc,IAAI,UAAU,QAAQ;AACpC,aA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AO;AAAA,EACT;AACA,SAAO;AACT;AAEA,SAAS,iBAAiB,QAAgC;AAExD,MAAI,GAAG,2BAA2B,MAAM,KAAK,OAAO,KAAK,SAAS,cAAc;AAC9E,WAAO;AAAA,EACT;AAEA,MAAI,GAAG,aAAa,MAAM,KAAK,OAAO,SAAS,cAAc;AAC3D,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,SAAS,WAAW,QAAgC;AAClD,MAAI,GAAG,2BAA2B,MAAM,KAAK,OAAO,KAAK,SAAS,QAAQ;AACxE,WAAO;AAAA,EACT;AACA,MAAI,GAAG,aAAa,MAAM,KAAK,OAAO,SAAS,QAAQ;AACrD,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,SAAS,cAAc,MAAwB;AAC7C,UACG,KAAK,QAAQ,GAAG,UAAU,iBAAiB,KAC5C,KAAK,UAAU,GAAG,UAAU;AAEhC;AAEA,SAAS,YAAY,UAA0B;AAC7C,SAAO,SAAS,QAAQ,OAAO,GAAG;AACpC;","names":["innerArg","typeStr"]}
@@ -2,7 +2,7 @@ import { createRequire as __banner_createRequire } from 'module'; const require
2
2
  import {
3
3
  BRAND,
4
4
  DEFAULTS
5
- } from "./chunk-OQO55NKV.js";
5
+ } from "./chunk-WFS63PCW.js";
6
6
 
7
7
  // src/service/browser-pool.ts
8
8
  import { chromium } from "playwright";
@@ -5937,7 +5937,7 @@ async function extractPropsFromFile(filePath, options = {}) {
5937
5937
  }
5938
5938
  function extractPropsFromSource(source, filePath, options = {}) {
5939
5939
  const { propsTypeName } = options;
5940
- const componentName = inferComponentName2(filePath);
5940
+ const componentName = options.componentName || inferComponentName2(filePath);
5941
5941
  const result = {
5942
5942
  filePath,
5943
5943
  componentName,
@@ -5975,19 +5975,26 @@ function extractPropsFromSource(source, filePath, options = {}) {
5975
5975
  (d) => d.name.endsWith("Props") || d.name.endsWith("Properties")
5976
5976
  );
5977
5977
  }
5978
- if (!propsDecl) {
5979
- result.warnings.push(
5980
- `No props type found for ${componentName}. Looked for: ${targetName}`
5981
- );
5978
+ if (propsDecl) {
5979
+ result.propsTypeName = propsDecl.name;
5980
+ if (ts.isInterfaceDeclaration(propsDecl.node)) {
5981
+ extractPropsFromInterface2(propsDecl.node, sourceFile, result);
5982
+ } else if (ts.isTypeAliasDeclaration(propsDecl.node)) {
5983
+ extractPropsFromTypeAlias2(propsDecl.node, sourceFile, result);
5984
+ }
5985
+ result.success = result.props.length > 0;
5982
5986
  return result;
5983
5987
  }
5984
- result.propsTypeName = propsDecl.name;
5985
- if (ts.isInterfaceDeclaration(propsDecl.node)) {
5986
- extractPropsFromInterface2(propsDecl.node, sourceFile, result);
5987
- } else if (ts.isTypeAliasDeclaration(propsDecl.node)) {
5988
- extractPropsFromTypeAlias2(propsDecl.node, sourceFile, result);
5988
+ const inlineProps = extractPropsFromInlineParams(componentName, sourceFile);
5989
+ if (inlineProps.length > 0) {
5990
+ result.props = inlineProps;
5991
+ result.propsTypeName = `${componentName}(inline)`;
5992
+ result.success = true;
5993
+ return result;
5989
5994
  }
5990
- result.success = result.props.length > 0;
5995
+ result.warnings.push(
5996
+ `No props type found for ${componentName}. Looked for: ${targetName}`
5997
+ );
5991
5998
  return result;
5992
5999
  }
5993
6000
  function extractPropsFromInterface2(node, sourceFile, result) {
@@ -6204,6 +6211,134 @@ function parseTypeNode(node, sourceFile) {
6204
6211
  propType: { type: "custom", typescript: node.getText(sourceFile) }
6205
6212
  };
6206
6213
  }
6214
+ function extractPropsFromInlineParams(componentName, sourceFile) {
6215
+ const props = [];
6216
+ const seen = /* @__PURE__ */ new Set();
6217
+ let targetFunc;
6218
+ ts.forEachChild(sourceFile, (node) => {
6219
+ if (ts.isFunctionDeclaration(node) && node.name?.text === componentName) {
6220
+ targetFunc = node;
6221
+ }
6222
+ if (ts.isVariableStatement(node)) {
6223
+ for (const decl of node.declarationList.declarations) {
6224
+ if (ts.isIdentifier(decl.name) && decl.name.text === componentName && decl.initializer && (ts.isArrowFunction(decl.initializer) || ts.isFunctionExpression(decl.initializer))) {
6225
+ targetFunc = decl.initializer;
6226
+ }
6227
+ }
6228
+ }
6229
+ });
6230
+ if (!targetFunc || targetFunc.parameters.length === 0) return props;
6231
+ const firstParam = targetFunc.parameters[0];
6232
+ if (ts.isObjectBindingPattern(firstParam.name)) {
6233
+ for (const element of firstParam.name.elements) {
6234
+ if (ts.isBindingElement(element) && ts.isIdentifier(element.name)) {
6235
+ const name = element.name.text;
6236
+ if (name === "props" || name === "rest" || name.startsWith("_")) continue;
6237
+ if (name === "className" || name === "children" || name === "ref") continue;
6238
+ if (seen.has(name)) continue;
6239
+ seen.add(name);
6240
+ const hasDefault = element.initializer !== void 0;
6241
+ let defaultValue = void 0;
6242
+ let enumValues;
6243
+ let propType = { type: "string" };
6244
+ if (element.initializer) {
6245
+ if (ts.isStringLiteral(element.initializer)) {
6246
+ defaultValue = element.initializer.text;
6247
+ } else if (element.initializer.kind === ts.SyntaxKind.TrueKeyword) {
6248
+ defaultValue = true;
6249
+ propType = { type: "boolean" };
6250
+ } else if (element.initializer.kind === ts.SyntaxKind.FalseKeyword) {
6251
+ defaultValue = false;
6252
+ propType = { type: "boolean" };
6253
+ } else if (ts.isNumericLiteral(element.initializer)) {
6254
+ defaultValue = Number(element.initializer.text);
6255
+ propType = { type: "number" };
6256
+ }
6257
+ }
6258
+ const prop = {
6259
+ name,
6260
+ type: propType.type,
6261
+ propType,
6262
+ description: "",
6263
+ required: !hasDefault && !element.dotDotDotToken
6264
+ };
6265
+ if (defaultValue !== void 0) prop.defaultValue = defaultValue;
6266
+ if (enumValues) prop.enumValues = enumValues;
6267
+ props.push(prop);
6268
+ }
6269
+ }
6270
+ }
6271
+ if (firstParam.type) {
6272
+ extractFromInlineType(firstParam.type, sourceFile, props, seen);
6273
+ }
6274
+ extractCvaVariants(sourceFile, props);
6275
+ return props;
6276
+ }
6277
+ function extractFromInlineType(typeNode, sourceFile, props, seen) {
6278
+ if (ts.isIntersectionTypeNode(typeNode)) {
6279
+ for (const type of typeNode.types) {
6280
+ extractFromInlineType(type, sourceFile, props, seen);
6281
+ }
6282
+ } else if (ts.isTypeLiteralNode(typeNode)) {
6283
+ for (const member of typeNode.members) {
6284
+ if (ts.isPropertySignature(member) && ts.isIdentifier(member.name)) {
6285
+ const name = member.name.text;
6286
+ if (seen.has(name) || name === "className" || name === "children") continue;
6287
+ seen.add(name);
6288
+ const prop = extractPropFromSignature(member, sourceFile);
6289
+ if (prop) props.push(prop);
6290
+ }
6291
+ }
6292
+ }
6293
+ }
6294
+ function extractCvaVariants(sourceFile, props) {
6295
+ const cvaVariants = /* @__PURE__ */ new Map();
6296
+ function visitCva(node) {
6297
+ if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === "cva" && node.arguments.length >= 2) {
6298
+ const configArg = node.arguments[1];
6299
+ if (ts.isObjectLiteralExpression(configArg)) {
6300
+ for (const prop of configArg.properties) {
6301
+ if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name) && prop.name.text === "variants" && ts.isObjectLiteralExpression(prop.initializer)) {
6302
+ for (const variantProp of prop.initializer.properties) {
6303
+ if (ts.isPropertyAssignment(variantProp) && ts.isIdentifier(variantProp.name) && ts.isObjectLiteralExpression(variantProp.initializer)) {
6304
+ const variantName = variantProp.name.text;
6305
+ const values = [];
6306
+ for (const valueProp of variantProp.initializer.properties) {
6307
+ if (ts.isPropertyAssignment(valueProp)) {
6308
+ const key = valueProp.name;
6309
+ if (ts.isIdentifier(key)) {
6310
+ values.push(key.text);
6311
+ } else if (ts.isStringLiteral(key)) {
6312
+ values.push(key.text);
6313
+ } else if (ts.isComputedPropertyName(key)) {
6314
+ const expr = key.expression;
6315
+ if (ts.isStringLiteral(expr)) {
6316
+ values.push(expr.text);
6317
+ }
6318
+ }
6319
+ }
6320
+ }
6321
+ if (values.length > 0) {
6322
+ cvaVariants.set(variantName, values);
6323
+ }
6324
+ }
6325
+ }
6326
+ }
6327
+ }
6328
+ }
6329
+ }
6330
+ ts.forEachChild(node, visitCva);
6331
+ }
6332
+ ts.forEachChild(sourceFile, visitCva);
6333
+ for (const prop of props) {
6334
+ const values = cvaVariants.get(prop.name);
6335
+ if (values && values.length > 0) {
6336
+ prop.enumValues = values;
6337
+ prop.propType = { type: "enum", values };
6338
+ prop.type = values.map((v) => `"${v}"`).join(" | ");
6339
+ }
6340
+ }
6341
+ }
6207
6342
  function inferComponentName2(filePath) {
6208
6343
  const fileName = basename4(filePath);
6209
6344
  let name = fileName.replace(/\.(tsx?|jsx?)$/, "");
@@ -6641,4 +6776,4 @@ export {
6641
6776
  getStorybookStoryIds,
6642
6777
  renderAllComponentVariants
6643
6778
  };
6644
- //# sourceMappingURL=chunk-D5PYOXEI.js.map
6779
+ //# sourceMappingURL=chunk-LVWFOLUZ.js.map