diff --git a/src/utils/entities.ts b/src/utils/entities.ts index f113bf8..d4b77ab 100644 --- a/src/utils/entities.ts +++ b/src/utils/entities.ts @@ -240,7 +240,7 @@ export const analyzeOakAppDomain = async ( entityDictCache[key] = entityDict[key]; }); - console.log('从缓存加载成功'); + console.log('从缓存加载成功,文件路径:', cacheFile); return; } catch (e) { console.error('尝试从缓存读取失败', e); diff --git a/src/utils/ts-utils.ts b/src/utils/ts-utils.ts index 8e84c7b..62d0c1e 100644 --- a/src/utils/ts-utils.ts +++ b/src/utils/ts-utils.ts @@ -387,9 +387,9 @@ export const getWebComponentPropsData = ( if (!ts.isLiteralTypeNode(args![1])) { return undefined; } - + const nameRawTextNode = args![1].literal; - + const nameRawText = args![1].literal.getText(); entityName = { value: nameRawText.substring(1, nameRawText.length - 1), @@ -862,7 +862,20 @@ function evaluateExpression(expr: ts.Expression): any { return null; } else if (ts.isIdentifier(expr)) { return expr.text; // 返回标识符名(例如引用类型或枚举名) + } else if (ts.isPropertyAccessExpression(expr)) { + // const left = evaluateExpression(expr.expression); + // const right = expr.name.text; + + // if (typeof left === "string") { + // return `${left}.${right}`; + // } else if (left && typeof left === "object" && right in left) { + // return left[right]; + // } else { + // return `${left}.${right}`; + // } + return `unresolved`; } else { + console.log("发现不支持的表达式类型:", ts.SyntaxKind[expr.kind], "在文件", expr.getSourceFile().fileName, "位置", expr.getStart(), "-", expr.getEnd()); throw new Error(`Unsupported expression kind: ${ts.SyntaxKind[expr.kind]}`); } } \ No newline at end of file