@immense/vue-pom-generator 1.0.64 → 1.0.65
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.
- package/RELEASE_NOTES.md +20 -37
- package/dist/index.cjs +39 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +39 -15
- package/dist/index.mjs.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1854,6 +1854,12 @@ function nodeHandlerAttributeInfo(node) {
|
|
|
1854
1854
|
const n = node2;
|
|
1855
1855
|
return typeof n.computed === "boolean" && typeof n.key === "object" && n.key !== null && typeof n.value === "object" && n.value !== null;
|
|
1856
1856
|
};
|
|
1857
|
+
const isLogicalExpressionNode = (node2) => {
|
|
1858
|
+
if (!isNodeType2(node2, "LogicalExpression"))
|
|
1859
|
+
return false;
|
|
1860
|
+
const n = node2;
|
|
1861
|
+
return typeof n.operator === "string" && typeof n.left === "object" && n.left !== null && typeof n.right === "object" && n.right !== null;
|
|
1862
|
+
};
|
|
1857
1863
|
const getLastIdentifierFromMemberChain = (node2) => {
|
|
1858
1864
|
if (!node2)
|
|
1859
1865
|
return null;
|
|
@@ -2024,48 +2030,66 @@ function nodeHandlerAttributeInfo(node) {
|
|
|
2024
2030
|
const semanticNameHint2 = suffix ? `${toPascalCase(name)}${suffix}` : toPascalCase(name);
|
|
2025
2031
|
return semanticNameHint2;
|
|
2026
2032
|
};
|
|
2033
|
+
const unwrapSemanticHelperCall = (candidateExpr) => {
|
|
2034
|
+
if (!isCallExpressionNode(candidateExpr)) {
|
|
2035
|
+
return null;
|
|
2036
|
+
}
|
|
2037
|
+
const calleeName = getLastIdentifierFromMemberChain(candidateExpr.callee);
|
|
2038
|
+
if (calleeName !== "_unref" && calleeName !== "unref" && calleeName !== "_withModifiers" && calleeName !== "withModifiers") {
|
|
2039
|
+
return null;
|
|
2040
|
+
}
|
|
2041
|
+
const firstArg = candidateExpr.arguments[0];
|
|
2042
|
+
return typeof firstArg === "object" && firstArg !== null ? firstArg : null;
|
|
2043
|
+
};
|
|
2027
2044
|
const resolveSemanticName = (candidateExpr) => {
|
|
2028
2045
|
if (!candidateExpr) {
|
|
2029
2046
|
return null;
|
|
2030
2047
|
}
|
|
2048
|
+
const unwrappedHelperCandidate = unwrapSemanticHelperCall(candidateExpr);
|
|
2049
|
+
if (unwrappedHelperCandidate) {
|
|
2050
|
+
return resolveSemanticName(unwrappedHelperCandidate);
|
|
2051
|
+
}
|
|
2031
2052
|
const direct = getLastIdentifierFromMemberChain(candidateExpr);
|
|
2032
2053
|
if (direct) {
|
|
2033
2054
|
return toPascalCase(direct);
|
|
2034
2055
|
}
|
|
2056
|
+
const directCall = tryFromCallExpression(candidateExpr);
|
|
2057
|
+
if (directCall) {
|
|
2058
|
+
return directCall;
|
|
2059
|
+
}
|
|
2060
|
+
if (isAssignmentExpressionNode(candidateExpr)) {
|
|
2061
|
+
const lhs = getAssignmentTargetName(candidateExpr.left);
|
|
2062
|
+
if (lhs) {
|
|
2063
|
+
const rhs = stableWordFromValue(candidateExpr.right);
|
|
2064
|
+
return `Set${toPascalCase(lhs)}${rhs ?? ""}`;
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
if (isLogicalExpressionNode(candidateExpr) && candidateExpr.operator === "&&") {
|
|
2068
|
+
return resolveSemanticName(candidateExpr.right);
|
|
2069
|
+
}
|
|
2035
2070
|
if (isArrowFunctionExpressionNode(candidateExpr)) {
|
|
2036
2071
|
const body = candidateExpr.body;
|
|
2037
|
-
const directCall = tryFromCallExpression(body);
|
|
2038
|
-
if (directCall) {
|
|
2039
|
-
return directCall;
|
|
2040
|
-
}
|
|
2041
|
-
if (isAssignmentExpressionNode(body)) {
|
|
2042
|
-
const lhs = getAssignmentTargetName(body.left);
|
|
2043
|
-
if (lhs) {
|
|
2044
|
-
const rhs = stableWordFromValue(body.right);
|
|
2045
|
-
return `Set${toPascalCase(lhs)}${rhs ?? ""}`;
|
|
2046
|
-
}
|
|
2047
|
-
}
|
|
2048
2072
|
if (isBlockStatementNode(body)) {
|
|
2049
2073
|
const stmts = body.body ?? [];
|
|
2050
2074
|
if (stmts.length > 0) {
|
|
2051
2075
|
const firstStmt = stmts[0];
|
|
2052
2076
|
if (isReturnStatementNode(firstStmt)) {
|
|
2053
|
-
const fromReturn =
|
|
2077
|
+
const fromReturn = resolveSemanticName(firstStmt.argument ?? null);
|
|
2054
2078
|
if (fromReturn) {
|
|
2055
2079
|
return fromReturn;
|
|
2056
2080
|
}
|
|
2057
2081
|
}
|
|
2058
2082
|
if (isExpressionStatementNode(firstStmt)) {
|
|
2059
|
-
const fromExpr =
|
|
2083
|
+
const fromExpr = resolveSemanticName(firstStmt.expression ?? null);
|
|
2060
2084
|
if (fromExpr) {
|
|
2061
2085
|
return fromExpr;
|
|
2062
2086
|
}
|
|
2063
2087
|
}
|
|
2064
2088
|
}
|
|
2065
2089
|
}
|
|
2066
|
-
const bodyName =
|
|
2090
|
+
const bodyName = resolveSemanticName(body);
|
|
2067
2091
|
if (bodyName) {
|
|
2068
|
-
return
|
|
2092
|
+
return bodyName;
|
|
2069
2093
|
}
|
|
2070
2094
|
}
|
|
2071
2095
|
return null;
|