@immense/vue-pom-generator 1.0.109 → 1.0.110
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 +19 -32
- package/dist/compiler/babel-guards.d.ts +85 -0
- package/dist/compiler/babel-guards.d.ts.map +1 -0
- package/dist/index.cjs +110 -155
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +110 -155
- package/dist/index.mjs.map +1 -1
- package/dist/routing/to-directive.d.ts.map +1 -1
- package/dist/tests/helpers/ast-queries.d.ts +10 -0
- package/dist/tests/helpers/ast-queries.d.ts.map +1 -0
- package/dist/tests/helpers/component-deps.d.ts +3 -0
- package/dist/tests/helpers/component-deps.d.ts.map +1 -0
- package/dist/transform.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,47 +1,34 @@
|
|
|
1
|
-
Git access is blocked, so I'll verify the change content by reading the affected files directly.
|
|
2
|
-
|
|
3
|
-
v1.0.109
|
|
4
|
-
|
|
5
1
|
Highlights
|
|
6
2
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
- Readable preview popout — sized wide with a tall monospace textarea so the full feedback text can
|
|
13
|
-
be read in one view.
|
|
14
|
-
- New regression tests lock in the keyboard policy and preview behavior.
|
|
3
|
+
- Added a CI duplication gate ("deslop") that fails builds when duplicated code is reintroduced.
|
|
4
|
+
- Extracted shared Babel AST guard logic into a new compiler/babel-guards.ts module, removing
|
|
5
|
+
repeated inline guards across the compiler.
|
|
6
|
+
- Deduplicated the test suite with new shared helpers — net ~250 lines removed (596 insertions, 850
|
|
7
|
+
deletions).
|
|
15
8
|
|
|
16
9
|
Changes
|
|
17
10
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- Removed all window-level keyboard shortcuts (s, p, c, x, ,, Escape); the annotator no longer
|
|
21
|
-
binds any keydown listener at mount and is fully inert to keyboard input.
|
|
22
|
-
- Switched the inspect shield to a crosshair cursor.
|
|
23
|
-
- Added a count badge (N annotation(s)) to the toolbar.
|
|
24
|
-
- Enlarged the preview panel (720–940px wide) with a taller, vertically resizable monospace
|
|
25
|
-
textarea so copied/previewed feedback is readable together.
|
|
26
|
-
|
|
27
|
-
Tests
|
|
11
|
+
CI / tooling
|
|
28
12
|
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
- Added annotator-preview.test.ts: verifies the preview panel opens and contains all seeded
|
|
32
|
-
feedback items.
|
|
13
|
+
- New .github/workflows/deslop.yml with a .deslop.toml config enforcing the duplication gate (#76).
|
|
14
|
+
- Added deslop artifacts to .gitignore.
|
|
33
15
|
|
|
34
|
-
|
|
16
|
+
Refactoring
|
|
35
17
|
|
|
36
|
-
-
|
|
18
|
+
- New compiler/babel-guards.ts centralizes Babel node-guard predicates; transform.ts,
|
|
19
|
+
routing/to-directive.ts, and utils.ts now consume them, substantially shrinking utils.ts.
|
|
20
|
+
- New shared test helpers: tests/helpers/ast-queries.ts and tests/helpers/component-deps.ts.
|
|
21
|
+
- Slimmed tests/transform.test.ts, tests/utils-coverage.test.ts,
|
|
22
|
+
tests/class-generation-coverage.test.ts, tests/generated-tsc.test.ts, and
|
|
23
|
+
tests/wrapper-contract.test.ts to use the shared helpers.
|
|
37
24
|
|
|
38
25
|
Pull Requests Included
|
|
39
26
|
|
|
40
|
-
-
|
|
41
|
-
]8;id=md-co8rmx;https://github.com/immense/vue-pom-generator/pull/74https://github.com/immense/vue-pom-generator/pull/74]8;;]8;; (@dkattan)]8;;
|
|
27
|
+
- ]8;id=md-c49k8z;https://github.com/immense/vue-pom-generator/pull/76#76]8;;]8;; — ci: Deslop duplication gate + test-suite deslop wave 1 (@dkattan)]8;;
|
|
42
28
|
|
|
43
29
|
Testing
|
|
44
30
|
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
- No new runtime features; existing transform, utils-coverage, class-generation, generated-tsc, and
|
|
32
|
+
wrapper-contract suites were consolidated onto the new helpers and pass as part of the release
|
|
33
|
+
validation.
|
|
47
34
|
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export declare const isNodeType: (node: object | null, type: string) => node is {
|
|
2
|
+
type: string;
|
|
3
|
+
};
|
|
4
|
+
export declare const isIdentifierNode: (node: object | null) => node is {
|
|
5
|
+
type: "Identifier";
|
|
6
|
+
name: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const isStringLiteralNode: (node: object | null) => node is {
|
|
9
|
+
type: "StringLiteral";
|
|
10
|
+
value: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const isBooleanLiteralNode: (node: object | null) => node is {
|
|
13
|
+
type: "BooleanLiteral";
|
|
14
|
+
value: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare const isNumericLiteralNode: (node: object | null) => node is {
|
|
17
|
+
type: "NumericLiteral";
|
|
18
|
+
value: number;
|
|
19
|
+
};
|
|
20
|
+
export declare const isNullLiteralNode: (node: object | null) => node is {
|
|
21
|
+
type: "NullLiteral";
|
|
22
|
+
};
|
|
23
|
+
export declare const isMemberExpressionNode: (node: object | null) => node is {
|
|
24
|
+
type: "MemberExpression";
|
|
25
|
+
computed: boolean;
|
|
26
|
+
object: object;
|
|
27
|
+
property: object;
|
|
28
|
+
};
|
|
29
|
+
export declare const isCallExpressionNode: (node: object | null) => node is {
|
|
30
|
+
type: "CallExpression";
|
|
31
|
+
callee: object;
|
|
32
|
+
arguments: object[];
|
|
33
|
+
};
|
|
34
|
+
export declare const isAwaitExpressionNode: (node: object | null) => node is {
|
|
35
|
+
type: "AwaitExpression";
|
|
36
|
+
argument: object;
|
|
37
|
+
};
|
|
38
|
+
export declare const isAssignmentExpressionNode: (node: object | null) => node is {
|
|
39
|
+
type: "AssignmentExpression";
|
|
40
|
+
left: object;
|
|
41
|
+
right: object;
|
|
42
|
+
};
|
|
43
|
+
export declare const isArrowFunctionExpressionNode: (node: object | null) => node is {
|
|
44
|
+
type: "ArrowFunctionExpression";
|
|
45
|
+
body: object;
|
|
46
|
+
};
|
|
47
|
+
export declare const isBlockStatementNode: (node: object | null) => node is {
|
|
48
|
+
type: "BlockStatement";
|
|
49
|
+
body: object[];
|
|
50
|
+
};
|
|
51
|
+
export declare const isExpressionStatementNode: (node: object | null) => node is {
|
|
52
|
+
type: "ExpressionStatement";
|
|
53
|
+
expression: object;
|
|
54
|
+
};
|
|
55
|
+
export declare const isReturnStatementNode: (node: object | null) => node is {
|
|
56
|
+
type: "ReturnStatement";
|
|
57
|
+
argument: object | null;
|
|
58
|
+
};
|
|
59
|
+
export declare const isObjectExpressionNode: (node: object | null) => node is {
|
|
60
|
+
type: "ObjectExpression";
|
|
61
|
+
properties: object[];
|
|
62
|
+
};
|
|
63
|
+
export declare const isObjectPropertyNode: (node: object | null) => node is {
|
|
64
|
+
type: "ObjectProperty";
|
|
65
|
+
computed: boolean;
|
|
66
|
+
key: object;
|
|
67
|
+
value: object;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Same shape test without the `computed` field check — matches the guard
|
|
71
|
+
* previously inlined in utils.ts's to-directive metadata reader and in
|
|
72
|
+
* routing/to-directive.ts.
|
|
73
|
+
*/
|
|
74
|
+
export declare const isObjectPropertyNodeShallow: (node: object | null) => node is {
|
|
75
|
+
type: "ObjectProperty";
|
|
76
|
+
key: object;
|
|
77
|
+
value: object;
|
|
78
|
+
};
|
|
79
|
+
export declare const isLogicalExpressionNode: (node: object | null) => node is {
|
|
80
|
+
type: "LogicalExpression";
|
|
81
|
+
operator: string;
|
|
82
|
+
left: object;
|
|
83
|
+
right: object;
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=babel-guards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"babel-guards.d.ts","sourceRoot":"","sources":["../../compiler/babel-guards.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,GAAG,IAAI,EAAE,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E,MAAM,CAAA;CAOzI,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,GAAI,MAAM,MAAM,GAAG,IAAI,KAAG,IAAI,IAAI;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAK7H,CAAC;AACF,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,GAAG,IAAI,KAAG,IAAI,IAAI;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAO/I,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1099,6 +1099,96 @@ function collectAccessibilityReviewWarnings(manifest) {
|
|
|
1099
1099
|
}
|
|
1100
1100
|
return warnings;
|
|
1101
1101
|
}
|
|
1102
|
+
const isNodeType = (node, type) => {
|
|
1103
|
+
return node !== null && node.type === type;
|
|
1104
|
+
};
|
|
1105
|
+
const isIdentifierNode = (node) => {
|
|
1106
|
+
return isNodeType(node, "Identifier") && typeof node.name === "string";
|
|
1107
|
+
};
|
|
1108
|
+
const isStringLiteralNode = (node) => {
|
|
1109
|
+
return isNodeType(node, "StringLiteral") && typeof node.value === "string";
|
|
1110
|
+
};
|
|
1111
|
+
const isBooleanLiteralNode = (node) => {
|
|
1112
|
+
return isNodeType(node, "BooleanLiteral") && typeof node.value === "boolean";
|
|
1113
|
+
};
|
|
1114
|
+
const isNumericLiteralNode = (node) => {
|
|
1115
|
+
return isNodeType(node, "NumericLiteral") && typeof node.value === "number";
|
|
1116
|
+
};
|
|
1117
|
+
const isNullLiteralNode = (node) => {
|
|
1118
|
+
return isNodeType(node, "NullLiteral");
|
|
1119
|
+
};
|
|
1120
|
+
const isMemberExpressionNode = (node) => {
|
|
1121
|
+
if (!isNodeType(node, "MemberExpression"))
|
|
1122
|
+
return false;
|
|
1123
|
+
const n = node;
|
|
1124
|
+
return typeof n.computed === "boolean" && typeof n.object === "object" && n.object !== null && typeof n.property === "object" && n.property !== null;
|
|
1125
|
+
};
|
|
1126
|
+
const isCallExpressionNode = (node) => {
|
|
1127
|
+
if (!isNodeType(node, "CallExpression"))
|
|
1128
|
+
return false;
|
|
1129
|
+
const n = node;
|
|
1130
|
+
return typeof n.callee === "object" && n.callee !== null && Array.isArray(n.arguments);
|
|
1131
|
+
};
|
|
1132
|
+
const isAwaitExpressionNode = (node) => {
|
|
1133
|
+
if (!isNodeType(node, "AwaitExpression"))
|
|
1134
|
+
return false;
|
|
1135
|
+
const n = node;
|
|
1136
|
+
return typeof n.argument === "object" && n.argument !== null;
|
|
1137
|
+
};
|
|
1138
|
+
const isAssignmentExpressionNode = (node) => {
|
|
1139
|
+
if (!isNodeType(node, "AssignmentExpression"))
|
|
1140
|
+
return false;
|
|
1141
|
+
const n = node;
|
|
1142
|
+
return typeof n.left === "object" && n.left !== null && typeof n.right === "object" && n.right !== null;
|
|
1143
|
+
};
|
|
1144
|
+
const isArrowFunctionExpressionNode = (node) => {
|
|
1145
|
+
if (!isNodeType(node, "ArrowFunctionExpression"))
|
|
1146
|
+
return false;
|
|
1147
|
+
const n = node;
|
|
1148
|
+
return typeof n.body === "object" && n.body !== null;
|
|
1149
|
+
};
|
|
1150
|
+
const isBlockStatementNode = (node) => {
|
|
1151
|
+
if (!isNodeType(node, "BlockStatement"))
|
|
1152
|
+
return false;
|
|
1153
|
+
const n = node;
|
|
1154
|
+
return Array.isArray(n.body);
|
|
1155
|
+
};
|
|
1156
|
+
const isExpressionStatementNode = (node) => {
|
|
1157
|
+
if (!isNodeType(node, "ExpressionStatement"))
|
|
1158
|
+
return false;
|
|
1159
|
+
const n = node;
|
|
1160
|
+
return typeof n.expression === "object" && n.expression !== null;
|
|
1161
|
+
};
|
|
1162
|
+
const isReturnStatementNode = (node) => {
|
|
1163
|
+
if (!isNodeType(node, "ReturnStatement"))
|
|
1164
|
+
return false;
|
|
1165
|
+
const n = node;
|
|
1166
|
+
return typeof n.argument === "object" || n.argument === null;
|
|
1167
|
+
};
|
|
1168
|
+
const isObjectExpressionNode = (node) => {
|
|
1169
|
+
if (!isNodeType(node, "ObjectExpression"))
|
|
1170
|
+
return false;
|
|
1171
|
+
const n = node;
|
|
1172
|
+
return Array.isArray(n.properties);
|
|
1173
|
+
};
|
|
1174
|
+
const isObjectPropertyNode = (node) => {
|
|
1175
|
+
if (!isNodeType(node, "ObjectProperty"))
|
|
1176
|
+
return false;
|
|
1177
|
+
const n = node;
|
|
1178
|
+
return typeof n.computed === "boolean" && typeof n.key === "object" && n.key !== null && typeof n.value === "object" && n.value !== null;
|
|
1179
|
+
};
|
|
1180
|
+
const isObjectPropertyNodeShallow = (node) => {
|
|
1181
|
+
if (!isNodeType(node, "ObjectProperty"))
|
|
1182
|
+
return false;
|
|
1183
|
+
const n = node;
|
|
1184
|
+
return typeof n.key === "object" && n.key !== null && typeof n.value === "object" && n.value !== null;
|
|
1185
|
+
};
|
|
1186
|
+
const isLogicalExpressionNode = (node) => {
|
|
1187
|
+
if (!isNodeType(node, "LogicalExpression"))
|
|
1188
|
+
return false;
|
|
1189
|
+
const n = node;
|
|
1190
|
+
return typeof n.operator === "string" && typeof n.left === "object" && n.left !== null && typeof n.right === "object" && n.right !== null;
|
|
1191
|
+
};
|
|
1102
1192
|
function isSimpleExpressionNode(value) {
|
|
1103
1193
|
return value !== null && "type" in value && value.type === compilerCore.NodeTypes.SIMPLE_EXPRESSION;
|
|
1104
1194
|
}
|
|
@@ -1137,27 +1227,6 @@ function buildPlaceholderParams(keys) {
|
|
|
1137
1227
|
params[k] = "__placeholder__";
|
|
1138
1228
|
return params;
|
|
1139
1229
|
}
|
|
1140
|
-
const isNodeType = (node, type) => {
|
|
1141
|
-
return node !== null && node.type === type;
|
|
1142
|
-
};
|
|
1143
|
-
const isStringLiteralNode = (node) => {
|
|
1144
|
-
return isNodeType(node, "StringLiteral") && typeof node.value === "string";
|
|
1145
|
-
};
|
|
1146
|
-
const isIdentifierNode = (node) => {
|
|
1147
|
-
return isNodeType(node, "Identifier") && typeof node.name === "string";
|
|
1148
|
-
};
|
|
1149
|
-
const isObjectPropertyNode = (node) => {
|
|
1150
|
-
if (!isNodeType(node, "ObjectProperty"))
|
|
1151
|
-
return false;
|
|
1152
|
-
const n = node;
|
|
1153
|
-
return typeof n.key === "object" && n.key !== null && typeof n.value === "object" && n.value !== null;
|
|
1154
|
-
};
|
|
1155
|
-
const isObjectExpressionNode = (node) => {
|
|
1156
|
-
if (!isNodeType(node, "ObjectExpression"))
|
|
1157
|
-
return false;
|
|
1158
|
-
const n = node;
|
|
1159
|
-
return Array.isArray(n.properties);
|
|
1160
|
-
};
|
|
1161
1230
|
function materializeResolvedRouteTarget(target, paramKeys) {
|
|
1162
1231
|
if (typeof target === "string")
|
|
1163
1232
|
return target;
|
|
@@ -2170,103 +2239,19 @@ function nodeHandlerAttributeInfo(node) {
|
|
|
2170
2239
|
preferExistingAst: false
|
|
2171
2240
|
});
|
|
2172
2241
|
const fallbackExpr = transformedSource !== authorSource ? tryParseBabelExpressionFromSource(authorSource, ["typescript", "jsx"]) : null;
|
|
2173
|
-
const isNodeType2 = (node2, type) => {
|
|
2174
|
-
return node2 !== null && node2.type === type;
|
|
2175
|
-
};
|
|
2176
|
-
const isIdentifierNode2 = (node2) => {
|
|
2177
|
-
return isNodeType2(node2, "Identifier") && typeof node2.name === "string";
|
|
2178
|
-
};
|
|
2179
|
-
const isStringLiteralNode2 = (node2) => {
|
|
2180
|
-
return isNodeType2(node2, "StringLiteral") && typeof node2.value === "string";
|
|
2181
|
-
};
|
|
2182
|
-
const isBooleanLiteralNode = (node2) => {
|
|
2183
|
-
return isNodeType2(node2, "BooleanLiteral") && typeof node2.value === "boolean";
|
|
2184
|
-
};
|
|
2185
|
-
const isNumericLiteralNode = (node2) => {
|
|
2186
|
-
return isNodeType2(node2, "NumericLiteral") && typeof node2.value === "number";
|
|
2187
|
-
};
|
|
2188
|
-
const isNullLiteralNode = (node2) => {
|
|
2189
|
-
return isNodeType2(node2, "NullLiteral");
|
|
2190
|
-
};
|
|
2191
|
-
const isMemberExpressionNode = (node2) => {
|
|
2192
|
-
if (!isNodeType2(node2, "MemberExpression"))
|
|
2193
|
-
return false;
|
|
2194
|
-
const n = node2;
|
|
2195
|
-
return typeof n.computed === "boolean" && typeof n.object === "object" && n.object !== null && typeof n.property === "object" && n.property !== null;
|
|
2196
|
-
};
|
|
2197
|
-
const isCallExpressionNode = (node2) => {
|
|
2198
|
-
if (!isNodeType2(node2, "CallExpression"))
|
|
2199
|
-
return false;
|
|
2200
|
-
const n = node2;
|
|
2201
|
-
return typeof n.callee === "object" && n.callee !== null && Array.isArray(n.arguments);
|
|
2202
|
-
};
|
|
2203
|
-
const isAwaitExpressionNode = (node2) => {
|
|
2204
|
-
if (!isNodeType2(node2, "AwaitExpression"))
|
|
2205
|
-
return false;
|
|
2206
|
-
const n = node2;
|
|
2207
|
-
return typeof n.argument === "object" && n.argument !== null;
|
|
2208
|
-
};
|
|
2209
|
-
const isAssignmentExpressionNode = (node2) => {
|
|
2210
|
-
if (!isNodeType2(node2, "AssignmentExpression"))
|
|
2211
|
-
return false;
|
|
2212
|
-
const n = node2;
|
|
2213
|
-
return typeof n.left === "object" && n.left !== null && typeof n.right === "object" && n.right !== null;
|
|
2214
|
-
};
|
|
2215
|
-
const isArrowFunctionExpressionNode = (node2) => {
|
|
2216
|
-
if (!isNodeType2(node2, "ArrowFunctionExpression"))
|
|
2217
|
-
return false;
|
|
2218
|
-
const n = node2;
|
|
2219
|
-
return typeof n.body === "object" && n.body !== null;
|
|
2220
|
-
};
|
|
2221
|
-
const isBlockStatementNode = (node2) => {
|
|
2222
|
-
if (!isNodeType2(node2, "BlockStatement"))
|
|
2223
|
-
return false;
|
|
2224
|
-
const n = node2;
|
|
2225
|
-
return Array.isArray(n.body);
|
|
2226
|
-
};
|
|
2227
|
-
const isExpressionStatementNode = (node2) => {
|
|
2228
|
-
if (!isNodeType2(node2, "ExpressionStatement"))
|
|
2229
|
-
return false;
|
|
2230
|
-
const n = node2;
|
|
2231
|
-
return typeof n.expression === "object" && n.expression !== null;
|
|
2232
|
-
};
|
|
2233
|
-
const isReturnStatementNode = (node2) => {
|
|
2234
|
-
if (!isNodeType2(node2, "ReturnStatement"))
|
|
2235
|
-
return false;
|
|
2236
|
-
const n = node2;
|
|
2237
|
-
return typeof n.argument === "object" || n.argument === null;
|
|
2238
|
-
};
|
|
2239
|
-
const isObjectExpressionNode2 = (node2) => {
|
|
2240
|
-
if (!isNodeType2(node2, "ObjectExpression"))
|
|
2241
|
-
return false;
|
|
2242
|
-
const n = node2;
|
|
2243
|
-
return Array.isArray(n.properties);
|
|
2244
|
-
};
|
|
2245
|
-
const isObjectPropertyNode2 = (node2) => {
|
|
2246
|
-
if (!isNodeType2(node2, "ObjectProperty"))
|
|
2247
|
-
return false;
|
|
2248
|
-
const n = node2;
|
|
2249
|
-
return typeof n.computed === "boolean" && typeof n.key === "object" && n.key !== null && typeof n.value === "object" && n.value !== null;
|
|
2250
|
-
};
|
|
2251
|
-
const isLogicalExpressionNode = (node2) => {
|
|
2252
|
-
if (!isNodeType2(node2, "LogicalExpression"))
|
|
2253
|
-
return false;
|
|
2254
|
-
const n = node2;
|
|
2255
|
-
return typeof n.operator === "string" && typeof n.left === "object" && n.left !== null && typeof n.right === "object" && n.right !== null;
|
|
2256
|
-
};
|
|
2257
2242
|
const getLastIdentifierFromMemberChain = (node2) => {
|
|
2258
2243
|
if (!node2)
|
|
2259
2244
|
return null;
|
|
2260
|
-
if (
|
|
2245
|
+
if (isIdentifierNode(node2))
|
|
2261
2246
|
return node2.name;
|
|
2262
2247
|
if (isMemberExpressionNode(node2)) {
|
|
2263
2248
|
const prop = node2.property;
|
|
2264
2249
|
if (node2.computed === false) {
|
|
2265
|
-
if (
|
|
2250
|
+
if (isIdentifierNode(prop))
|
|
2266
2251
|
return prop.name;
|
|
2267
2252
|
}
|
|
2268
2253
|
if (node2.computed === true) {
|
|
2269
|
-
if (
|
|
2254
|
+
if (isStringLiteralNode(prop))
|
|
2270
2255
|
return prop.value;
|
|
2271
2256
|
}
|
|
2272
2257
|
}
|
|
@@ -2276,7 +2261,7 @@ function nodeHandlerAttributeInfo(node) {
|
|
|
2276
2261
|
if (!node2) {
|
|
2277
2262
|
return null;
|
|
2278
2263
|
}
|
|
2279
|
-
if (
|
|
2264
|
+
if (isIdentifierNode(node2)) {
|
|
2280
2265
|
return node2.name;
|
|
2281
2266
|
}
|
|
2282
2267
|
if (isMemberExpressionNode(node2)) {
|
|
@@ -2288,11 +2273,11 @@ function nodeHandlerAttributeInfo(node) {
|
|
|
2288
2273
|
if (!lhs) {
|
|
2289
2274
|
return null;
|
|
2290
2275
|
}
|
|
2291
|
-
if (
|
|
2276
|
+
if (isIdentifierNode(lhs)) {
|
|
2292
2277
|
return lhs.name;
|
|
2293
2278
|
}
|
|
2294
2279
|
if (isMemberExpressionNode(lhs)) {
|
|
2295
|
-
if (lhs.computed === false &&
|
|
2280
|
+
if (lhs.computed === false && isIdentifierNode(lhs.property) && lhs.property.name === "value") {
|
|
2296
2281
|
return getLastIdentifierFromMemberChain(lhs.object);
|
|
2297
2282
|
}
|
|
2298
2283
|
return getLastIdentifierFromMemberChain(lhs);
|
|
@@ -2300,7 +2285,7 @@ function nodeHandlerAttributeInfo(node) {
|
|
|
2300
2285
|
return null;
|
|
2301
2286
|
};
|
|
2302
2287
|
const isTemplateLiteralNode = (node2) => {
|
|
2303
|
-
if (!
|
|
2288
|
+
if (!isNodeType(node2, "TemplateLiteral")) {
|
|
2304
2289
|
return false;
|
|
2305
2290
|
}
|
|
2306
2291
|
const n = node2;
|
|
@@ -2319,7 +2304,7 @@ function nodeHandlerAttributeInfo(node) {
|
|
|
2319
2304
|
if (isNullLiteralNode(arg)) {
|
|
2320
2305
|
return "Null";
|
|
2321
2306
|
}
|
|
2322
|
-
if (
|
|
2307
|
+
if (isStringLiteralNode(arg)) {
|
|
2323
2308
|
const cleaned = (arg.value ?? "").trim();
|
|
2324
2309
|
if (!cleaned) {
|
|
2325
2310
|
return null;
|
|
@@ -2345,7 +2330,7 @@ function nodeHandlerAttributeInfo(node) {
|
|
|
2345
2330
|
return toPascalCase(stableName.slice(0, 24));
|
|
2346
2331
|
}
|
|
2347
2332
|
}
|
|
2348
|
-
if (
|
|
2333
|
+
if (isIdentifierNode(arg)) {
|
|
2349
2334
|
const firstChar = arg.name.charAt(0);
|
|
2350
2335
|
const isUpperAlpha = firstChar !== "" && firstChar === firstChar.toUpperCase() && firstChar !== firstChar.toLowerCase();
|
|
2351
2336
|
if (isUpperAlpha) {
|
|
@@ -2357,7 +2342,7 @@ function nodeHandlerAttributeInfo(node) {
|
|
|
2357
2342
|
const getStableSuffixFromCall = (call) => {
|
|
2358
2343
|
const args = call.arguments ?? [];
|
|
2359
2344
|
const first = args.length > 0 ? args[0] : null;
|
|
2360
|
-
if (!
|
|
2345
|
+
if (!isObjectExpressionNode(first)) {
|
|
2361
2346
|
const parts2 = [];
|
|
2362
2347
|
for (const arg of args.slice(0, 4)) {
|
|
2363
2348
|
const w = stableWordFromValue(arg ?? null);
|
|
@@ -2376,20 +2361,20 @@ function nodeHandlerAttributeInfo(node) {
|
|
|
2376
2361
|
}
|
|
2377
2362
|
const parts = [];
|
|
2378
2363
|
for (const prop of first.properties ?? []) {
|
|
2379
|
-
if (!
|
|
2364
|
+
if (!isObjectPropertyNode(prop)) {
|
|
2380
2365
|
continue;
|
|
2381
2366
|
}
|
|
2382
2367
|
if (prop.computed) {
|
|
2383
2368
|
continue;
|
|
2384
2369
|
}
|
|
2385
|
-
const keyName =
|
|
2370
|
+
const keyName = isIdentifierNode(prop.key) ? prop.key.name : isStringLiteralNode(prop.key) ? prop.key.value : null;
|
|
2386
2371
|
if (!keyName) {
|
|
2387
2372
|
continue;
|
|
2388
2373
|
}
|
|
2389
2374
|
let valueWord = null;
|
|
2390
2375
|
if (isBooleanLiteralNode(prop.value)) {
|
|
2391
2376
|
valueWord = prop.value.value ? "True" : "False";
|
|
2392
|
-
} else if (
|
|
2377
|
+
} else if (isStringLiteralNode(prop.value)) {
|
|
2393
2378
|
const cleaned = (prop.value.value ?? "").trim();
|
|
2394
2379
|
if (cleaned) {
|
|
2395
2380
|
valueWord = toPascalCase(cleaned.slice(0, 24));
|
|
@@ -2489,7 +2474,7 @@ function nodeHandlerAttributeInfo(node) {
|
|
|
2489
2474
|
return null;
|
|
2490
2475
|
};
|
|
2491
2476
|
const isVueRefValueAccess = (candidate) => {
|
|
2492
|
-
return isMemberExpressionNode(candidate) && candidate.computed === false &&
|
|
2477
|
+
return isMemberExpressionNode(candidate) && candidate.computed === false && isIdentifierNode(candidate.property) && candidate.property.name === "value";
|
|
2493
2478
|
};
|
|
2494
2479
|
const transformedSemanticName = resolveSemanticName(expr);
|
|
2495
2480
|
const fallbackSemanticName = resolveSemanticName(fallbackExpr);
|
|
@@ -2625,36 +2610,15 @@ function toDirectiveObjectFieldNameValue(node) {
|
|
|
2625
2610
|
if (!expr) {
|
|
2626
2611
|
return null;
|
|
2627
2612
|
}
|
|
2628
|
-
|
|
2629
|
-
return n !== null && n.type === type;
|
|
2630
|
-
};
|
|
2631
|
-
const isStringLiteralNode2 = (n) => {
|
|
2632
|
-
return isNodeType2(n, "StringLiteral") && typeof n.value === "string";
|
|
2633
|
-
};
|
|
2634
|
-
const isIdentifierNode2 = (n) => {
|
|
2635
|
-
return isNodeType2(n, "Identifier") && typeof n.name === "string";
|
|
2636
|
-
};
|
|
2637
|
-
const isObjectPropertyNode2 = (n) => {
|
|
2638
|
-
if (!isNodeType2(n, "ObjectProperty"))
|
|
2639
|
-
return false;
|
|
2640
|
-
const nn = n;
|
|
2641
|
-
return typeof nn.key === "object" && nn.key !== null && typeof nn.value === "object" && nn.value !== null;
|
|
2642
|
-
};
|
|
2643
|
-
const isObjectExpressionNode2 = (n) => {
|
|
2644
|
-
if (!isNodeType2(n, "ObjectExpression"))
|
|
2645
|
-
return false;
|
|
2646
|
-
const nn = n;
|
|
2647
|
-
return Array.isArray(nn.properties);
|
|
2648
|
-
};
|
|
2649
|
-
if (!isObjectExpressionNode2(expr))
|
|
2613
|
+
if (!isObjectExpressionNode(expr))
|
|
2650
2614
|
return null;
|
|
2651
2615
|
const nameProp = expr.properties.find((p) => {
|
|
2652
|
-
if (!
|
|
2616
|
+
if (!isObjectPropertyNodeShallow(p))
|
|
2653
2617
|
return false;
|
|
2654
2618
|
const key = p.key;
|
|
2655
|
-
return
|
|
2619
|
+
return isIdentifierNode(key) && key.name === "name" || isStringLiteralNode(key) && key.value === "name";
|
|
2656
2620
|
});
|
|
2657
|
-
if (!nameProp || !
|
|
2621
|
+
if (!nameProp || !isObjectPropertyNodeShallow(nameProp) || !isStringLiteralNode(nameProp.value))
|
|
2658
2622
|
return null;
|
|
2659
2623
|
return toPascalCase(nameProp.value.value);
|
|
2660
2624
|
}
|
|
@@ -9347,26 +9311,17 @@ function tryExtractStableHintFromConditionalExpressionSource(source) {
|
|
|
9347
9311
|
};
|
|
9348
9312
|
try {
|
|
9349
9313
|
const expr = parser.parseExpression(src, { plugins: ["typescript"] });
|
|
9350
|
-
const isNodeType2 = (n, type) => {
|
|
9351
|
-
return n !== null && n.type === type;
|
|
9352
|
-
};
|
|
9353
|
-
const isStringLiteralNode2 = (n) => {
|
|
9354
|
-
return isNodeType2(n, "StringLiteral") && typeof n.value === "string";
|
|
9355
|
-
};
|
|
9356
|
-
const isIdentifierNode2 = (n) => {
|
|
9357
|
-
return isNodeType2(n, "Identifier") && typeof n.name === "string";
|
|
9358
|
-
};
|
|
9359
9314
|
const results = [];
|
|
9360
9315
|
const walk = (n) => {
|
|
9361
9316
|
if (!n)
|
|
9362
9317
|
return;
|
|
9363
|
-
if (
|
|
9318
|
+
if (isStringLiteralNode(n)) {
|
|
9364
9319
|
const v = (n.value ?? "").trim();
|
|
9365
9320
|
if (isIdentifierish(v)) {
|
|
9366
9321
|
results.push(v);
|
|
9367
9322
|
}
|
|
9368
9323
|
}
|
|
9369
|
-
if (
|
|
9324
|
+
if (isIdentifierNode(n)) {
|
|
9370
9325
|
const v = (n.name ?? "").trim();
|
|
9371
9326
|
if (isIdentifierish(v)) {
|
|
9372
9327
|
results.push(v);
|