@immense/vue-pom-generator 1.0.73 → 1.0.75
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 +59 -103
- package/class-generation/index.ts +2 -2
- package/dist/index.cjs +29 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +29 -5
- package/dist/index.mjs.map +1 -1
- package/dist/transform.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2616,10 +2616,28 @@ function tryGetExistingElementDataTestId(node, attributeName = "data-testid") {
|
|
|
2616
2616
|
}
|
|
2617
2617
|
const directive = existing;
|
|
2618
2618
|
const exp = directive.exp;
|
|
2619
|
-
if (!exp
|
|
2619
|
+
if (!exp) {
|
|
2620
|
+
return null;
|
|
2621
|
+
}
|
|
2622
|
+
let simpleExp;
|
|
2623
|
+
if (exp.type === NodeTypes.SIMPLE_EXPRESSION) {
|
|
2624
|
+
simpleExp = exp;
|
|
2625
|
+
} else if (exp.type === NodeTypes.COMPOUND_EXPRESSION) {
|
|
2626
|
+
const compoundExp = exp;
|
|
2627
|
+
const source = compoundExp.loc?.source;
|
|
2628
|
+
if (!source) {
|
|
2629
|
+
return null;
|
|
2630
|
+
}
|
|
2631
|
+
simpleExp = {
|
|
2632
|
+
type: NodeTypes.SIMPLE_EXPRESSION,
|
|
2633
|
+
content: source,
|
|
2634
|
+
isStatic: false,
|
|
2635
|
+
constType: 0,
|
|
2636
|
+
loc: compoundExp.loc
|
|
2637
|
+
};
|
|
2638
|
+
} else {
|
|
2620
2639
|
return null;
|
|
2621
2640
|
}
|
|
2622
|
-
const simpleExp = exp;
|
|
2623
2641
|
const ast = tryGetVueExpressionAst(simpleExp, {
|
|
2624
2642
|
preferredViews: ["content", "loc", "compiled"],
|
|
2625
2643
|
plugins: ["typescript"]
|
|
@@ -5632,7 +5650,7 @@ function prepareViewObjectModelClass(componentName, dependencies, componentHiera
|
|
|
5632
5650
|
}
|
|
5633
5651
|
return match;
|
|
5634
5652
|
};
|
|
5635
|
-
const rawComponentRefsForInstances =
|
|
5653
|
+
const rawComponentRefsForInstances = usedComponentSet?.size ? usedComponentSet : childrenComponentSet;
|
|
5636
5654
|
const componentRefsForInstances = /* @__PURE__ */ new Set();
|
|
5637
5655
|
for (const ref of rawComponentRefsForInstances) {
|
|
5638
5656
|
const resolvedRef = resolveTrackedComponentRef(ref) ?? normalizeTrackedComponentRef(ref);
|
|
@@ -7293,6 +7311,11 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
|
|
|
7293
7311
|
}
|
|
7294
7312
|
const element = node;
|
|
7295
7313
|
const parentIsRoot = context?.parent?.type === NodeTypes.ROOT;
|
|
7314
|
+
{
|
|
7315
|
+
element.props.find(
|
|
7316
|
+
(p) => p.type === NodeTypes.DIRECTIVE && p.name === "bind" && p.arg?.type === NodeTypes.SIMPLE_EXPRESSION && p.arg.content === testIdAttribute && !!p.exp
|
|
7317
|
+
);
|
|
7318
|
+
}
|
|
7296
7319
|
const parentElement = !parentIsRoot && context?.parent?.type === NodeTypes.ELEMENT ? context.parent : null;
|
|
7297
7320
|
hierarchyMap.set(element, parentElement);
|
|
7298
7321
|
const normalizeFilePath = (filePath) => path.normalize(safeRealpath2(path.resolve(filePath)));
|
|
@@ -7602,8 +7625,10 @@ Fix: remove the explicit ${attrLabel}, or change existingIdBehavior to "overwrit
|
|
|
7602
7625
|
});
|
|
7603
7626
|
return;
|
|
7604
7627
|
}
|
|
7628
|
+
const existingElementDataTestId = tryGetExistingElementDataTestId(element, testIdAttribute);
|
|
7629
|
+
const shouldPreserveExisting = existingElementDataTestId && existingIdBehavior === "preserve";
|
|
7605
7630
|
const clickDirective = tryGetClickDirective(element);
|
|
7606
|
-
if (clickDirective) {
|
|
7631
|
+
if (clickDirective && !shouldPreserveExisting) {
|
|
7607
7632
|
const clickSuffix = getComposedClickHandlerContent(element, context, innerText, clickDirective, {
|
|
7608
7633
|
contextFilename: context.filename
|
|
7609
7634
|
});
|
|
@@ -7624,7 +7649,6 @@ Fix: remove the explicit ${attrLabel}, or change existingIdBehavior to "overwrit
|
|
|
7624
7649
|
tryWrapClickDirectiveForTestEvents(element, testIdAttribute, resolvedDataTestId.runtimeValue);
|
|
7625
7650
|
return;
|
|
7626
7651
|
}
|
|
7627
|
-
const existingElementDataTestId = tryGetExistingElementDataTestId(element, testIdAttribute);
|
|
7628
7652
|
if (existingElementDataTestId) {
|
|
7629
7653
|
const inferredRole = getNativeRoleFromTagSuffix().toLowerCase();
|
|
7630
7654
|
const isRecognizedInteractiveRole = inferredRole === "button" || inferredRole === "input" || inferredRole === "select" || inferredRole === "vselect" || inferredRole === "checkbox" || inferredRole === "toggle" || inferredRole === "radio" || inferredRole === "grid" || isComponentLikeTag(element.tag);
|