@immense/vue-pom-generator 1.0.79 → 1.0.80

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/dist/index.mjs CHANGED
@@ -1503,6 +1503,66 @@ function tryExtractSlotScopeVariableNames(expression) {
1503
1503
  }
1504
1504
  return names;
1505
1505
  }
1506
+ function unwrapToBareCallbackIdentifier(node) {
1507
+ if (!node) {
1508
+ return null;
1509
+ }
1510
+ if (isFile(node)) {
1511
+ const stmt = node.program.body[0];
1512
+ return isExpressionStatement(stmt) ? unwrapToBareCallbackIdentifier(stmt.expression) : null;
1513
+ }
1514
+ if (isProgram(node)) {
1515
+ const stmt = node.body[0];
1516
+ return isExpressionStatement(stmt) ? unwrapToBareCallbackIdentifier(stmt.expression) : null;
1517
+ }
1518
+ if (isExpressionStatement(node)) {
1519
+ return unwrapToBareCallbackIdentifier(node.expression);
1520
+ }
1521
+ if (isIdentifier(node)) {
1522
+ return node.name;
1523
+ }
1524
+ if (isCallExpression(node) || isOptionalCallExpression(node)) {
1525
+ const callee = node.callee;
1526
+ if (isIdentifier(callee) && (callee.name === "withModifiers" || callee.name === "_withModifiers")) {
1527
+ return unwrapToBareCallbackIdentifier(node.arguments[0]);
1528
+ }
1529
+ return null;
1530
+ }
1531
+ if (isArrowFunctionExpression(node)) {
1532
+ return isBlockStatement(node.body) ? null : unwrapToBareCallbackIdentifier(node.body);
1533
+ }
1534
+ return null;
1535
+ }
1536
+ function tryGetBareCallbackClickHandlerName(node) {
1537
+ const click = tryGetClickDirective(node);
1538
+ if (!click?.exp) {
1539
+ return null;
1540
+ }
1541
+ const source = getVueExpressionSource(click.exp, "content", "compiled");
1542
+ if (!source) {
1543
+ return null;
1544
+ }
1545
+ const parsed = tryParseBabelAstFromHandlerSource(source);
1546
+ if (!parsed) {
1547
+ return null;
1548
+ }
1549
+ return unwrapToBareCallbackIdentifier(parsed);
1550
+ }
1551
+ function isSlotScopeCallbackClickHandler(node, hierarchyMap2) {
1552
+ const handlerName = tryGetBareCallbackClickHandlerName(node);
1553
+ if (!handlerName) {
1554
+ return false;
1555
+ }
1556
+ const templateNode = getContainedInSlotTemplateNode(node, hierarchyMap2);
1557
+ if (!templateNode) {
1558
+ return false;
1559
+ }
1560
+ const scopeExpression = findTemplateSlotScopeExpression(templateNode);
1561
+ if (!scopeExpression) {
1562
+ return false;
1563
+ }
1564
+ return tryExtractSlotScopeVariableNames(scopeExpression).includes(handlerName);
1565
+ }
1506
1566
  function nodeHasToDirective(node) {
1507
1567
  const toDirective = findDirectiveByName(node, "bind", "to");
1508
1568
  if (toDirective?.exp) {
@@ -7461,6 +7521,9 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
7461
7521
  }
7462
7522
  const slotKeyInfo = getContainedInSlotDataKeyInfo(element, hierarchyMap);
7463
7523
  if (slotKeyInfo) {
7524
+ if (isSlotScopeCallbackClickHandler(element, hierarchyMap)) {
7525
+ return null;
7526
+ }
7464
7527
  return slotKeyInfo;
7465
7528
  }
7466
7529
  if (crossFileKeyRegistry) {