@immense/vue-pom-generator 1.0.62 → 1.0.63

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
@@ -5452,14 +5452,51 @@ function prepareViewObjectModelClass(componentName, dependencies, componentHiera
5452
5452
  customPomAttachments = [],
5453
5453
  testIdAttribute
5454
5454
  } = options;
5455
+ const normalizeTrackedComponentRef = (value) => {
5456
+ return value.endsWith(".vue") ? value.slice(0, -4) : value;
5457
+ };
5458
+ const resolveTrackedComponentRef = (value) => {
5459
+ const normalizedValue = normalizeTrackedComponentRef(value);
5460
+ if (componentHierarchyMap.has(value)) {
5461
+ return value;
5462
+ }
5463
+ if (componentHierarchyMap.has(normalizedValue)) {
5464
+ return normalizedValue;
5465
+ }
5466
+ let match = null;
5467
+ for (const [candidateName, candidateDeps] of componentHierarchyMap.entries()) {
5468
+ const normalizedCandidate = normalizeTrackedComponentRef(candidateName);
5469
+ const candidateBaseName = path.parse(candidateDeps.filePath).name;
5470
+ if (normalizedCandidate !== normalizedValue && candidateBaseName !== normalizedValue) {
5471
+ continue;
5472
+ }
5473
+ if (match && match !== candidateName) {
5474
+ return null;
5475
+ }
5476
+ match = candidateName;
5477
+ }
5478
+ return match;
5479
+ };
5480
+ const rawComponentRefsForInstances = isView ? usedComponentSet?.size ? usedComponentSet : childrenComponentSet : childrenComponentSet;
5481
+ const componentRefsForInstances = /* @__PURE__ */ new Set();
5482
+ for (const ref of rawComponentRefsForInstances) {
5483
+ componentRefsForInstances.add(resolveTrackedComponentRef(ref) ?? normalizeTrackedComponentRef(ref));
5484
+ }
5455
5485
  const hasChildComponent = (needle) => {
5456
- const haystack = usedComponentSet?.size ? usedComponentSet : childrenComponentSet;
5457
- for (const child of haystack) {
5458
- if (child === needle)
5486
+ const normalizedNeedle = normalizeTrackedComponentRef(needle);
5487
+ for (const child of rawComponentRefsForInstances) {
5488
+ const resolvedChild = resolveTrackedComponentRef(child);
5489
+ if (normalizeTrackedComponentRef(child) === normalizedNeedle)
5459
5490
  return true;
5460
- if (child === `${needle}.vue`)
5491
+ if (resolvedChild && normalizeTrackedComponentRef(resolvedChild) === normalizedNeedle)
5461
5492
  return true;
5462
- if (child.endsWith(".vue") && child.slice(0, -4) === needle)
5493
+ if (resolvedChild) {
5494
+ const resolvedDeps = componentHierarchyMap.get(resolvedChild);
5495
+ if (resolvedDeps && path.parse(resolvedDeps.filePath).name === normalizedNeedle) {
5496
+ return true;
5497
+ }
5498
+ }
5499
+ if (child === `${needle}.vue`)
5463
5500
  return true;
5464
5501
  }
5465
5502
  return false;
@@ -5483,7 +5520,6 @@ function prepareViewObjectModelClass(componentName, dependencies, componentHiera
5483
5520
  methodSignatures: a.flatten ? customPomMethodSignaturesByClass.get(a.className) ?? /* @__PURE__ */ new Map() : /* @__PURE__ */ new Map()
5484
5521
  }));
5485
5522
  const widgetInstances = isView ? getWidgetInstancesForView(componentName, dependencies.dataTestIdSet, customPomAvailableClassIdentifiers) : [];
5486
- const componentRefsForInstances = isView ? usedComponentSet?.size ? usedComponentSet : childrenComponentSet : childrenComponentSet;
5487
5523
  const className = toPascalCaseLocal(componentName);
5488
5524
  const childInstancePropertyNames = Array.from(componentRefsForInstances).filter((child) => componentHierarchyMap.has(child) && componentHierarchyMap.get(child)?.dataTestIdSet.size).map((child) => child.split(".vue")[0]);
5489
5525
  const blockedViewPassthroughMethodNames = new Set(