@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/RELEASE_NOTES.md +13 -22
- package/class-generation/index.ts +49 -11
- package/dist/class-generation/index.d.ts.map +1 -1
- package/dist/index.cjs +42 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +42 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
|
-
●
|
|
2
|
-
|
|
3
|
-
● Based on the commit details, here are the release notes for v1.0.62:
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
1
|
+
● ```markdown
|
|
7
2
|
## Highlights
|
|
8
3
|
|
|
9
|
-
- Fixed
|
|
10
|
-
-
|
|
11
|
-
- Enhanced test coverage for handler attribute parsing edge cases
|
|
4
|
+
- Fixed nested component POMs not being properly attached to their parent views
|
|
5
|
+
- Added comprehensive test coverage for nested component POM attachment
|
|
12
6
|
|
|
13
7
|
## Changes
|
|
14
8
|
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- Add fallback expression parsing to handle cases where Vue's transformation breaks Babel AST
|
|
20
|
-
parsing
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
- Resolved issue where nested component POMs were not correctly associated with view classes
|
|
11
|
+
during generation
|
|
12
|
+
- Improved POM attachment logic in class generation module
|
|
21
13
|
|
|
22
|
-
|
|
23
|
-
- Added
|
|
24
|
-
- Improved coverage for `utils.ts` edge cases with 36 additional tests
|
|
25
|
-
- Fixed missing `SimpleExpressionNode` import in test files
|
|
14
|
+
### Testing
|
|
15
|
+
- Added 54 lines of test coverage for class generation including nested component scenarios
|
|
26
16
|
|
|
27
17
|
## Breaking Changes
|
|
28
18
|
|
|
@@ -30,10 +20,11 @@
|
|
|
30
20
|
|
|
31
21
|
## Pull Requests Included
|
|
32
22
|
|
|
33
|
-
None (direct
|
|
23
|
+
None (direct commit to main)
|
|
34
24
|
|
|
35
25
|
## Testing
|
|
36
26
|
|
|
37
|
-
|
|
38
|
-
|
|
27
|
+
Tests added to validate nested component POM attachment behavior. Run test suite with `npm
|
|
28
|
+
test`.
|
|
29
|
+
```
|
|
39
30
|
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
isParameterizedPomPattern,
|
|
25
25
|
orderPomPatternParameters,
|
|
26
26
|
toCSharpPomPatternExpression,
|
|
27
|
-
toTypeScriptPomPatternExpression,
|
|
28
27
|
uniquePomStringPatterns,
|
|
29
28
|
type PomStringPattern,
|
|
30
29
|
} from "../pom-patterns";
|
|
@@ -1604,14 +1603,57 @@ function prepareViewObjectModelClass(
|
|
|
1604
1603
|
testIdAttribute,
|
|
1605
1604
|
} = options;
|
|
1606
1605
|
|
|
1606
|
+
const normalizeTrackedComponentRef = (value: string): string => {
|
|
1607
|
+
return value.endsWith(".vue") ? value.slice(0, -4) : value;
|
|
1608
|
+
};
|
|
1609
|
+
|
|
1610
|
+
const resolveTrackedComponentRef = (value: string): string | null => {
|
|
1611
|
+
const normalizedValue = normalizeTrackedComponentRef(value);
|
|
1612
|
+
if (componentHierarchyMap.has(value)) {
|
|
1613
|
+
return value;
|
|
1614
|
+
}
|
|
1615
|
+
if (componentHierarchyMap.has(normalizedValue)) {
|
|
1616
|
+
return normalizedValue;
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
let match: string | null = null;
|
|
1620
|
+
for (const [candidateName, candidateDeps] of componentHierarchyMap.entries()) {
|
|
1621
|
+
const normalizedCandidate = normalizeTrackedComponentRef(candidateName);
|
|
1622
|
+
const candidateBaseName = path.parse(candidateDeps.filePath).name;
|
|
1623
|
+
if (normalizedCandidate !== normalizedValue && candidateBaseName !== normalizedValue) {
|
|
1624
|
+
continue;
|
|
1625
|
+
}
|
|
1626
|
+
if (match && match !== candidateName) {
|
|
1627
|
+
return null;
|
|
1628
|
+
}
|
|
1629
|
+
match = candidateName;
|
|
1630
|
+
}
|
|
1631
|
+
return match;
|
|
1632
|
+
};
|
|
1633
|
+
|
|
1634
|
+
const rawComponentRefsForInstances = isView
|
|
1635
|
+
? (usedComponentSet?.size ? usedComponentSet : childrenComponentSet)
|
|
1636
|
+
: childrenComponentSet;
|
|
1637
|
+
const componentRefsForInstances = new Set<string>();
|
|
1638
|
+
for (const ref of rawComponentRefsForInstances) {
|
|
1639
|
+
componentRefsForInstances.add(resolveTrackedComponentRef(ref) ?? normalizeTrackedComponentRef(ref));
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1607
1642
|
const hasChildComponent = (needle: string) => {
|
|
1608
|
-
const
|
|
1609
|
-
for (const child of
|
|
1610
|
-
|
|
1643
|
+
const normalizedNeedle = normalizeTrackedComponentRef(needle);
|
|
1644
|
+
for (const child of rawComponentRefsForInstances) {
|
|
1645
|
+
const resolvedChild = resolveTrackedComponentRef(child);
|
|
1646
|
+
if (normalizeTrackedComponentRef(child) === normalizedNeedle)
|
|
1611
1647
|
return true;
|
|
1612
|
-
if (
|
|
1648
|
+
if (resolvedChild && normalizeTrackedComponentRef(resolvedChild) === normalizedNeedle)
|
|
1613
1649
|
return true;
|
|
1614
|
-
if (
|
|
1650
|
+
if (resolvedChild) {
|
|
1651
|
+
const resolvedDeps = componentHierarchyMap.get(resolvedChild);
|
|
1652
|
+
if (resolvedDeps && path.parse(resolvedDeps.filePath).name === normalizedNeedle) {
|
|
1653
|
+
return true;
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
if (child === `${needle}.vue`)
|
|
1615
1657
|
return true;
|
|
1616
1658
|
}
|
|
1617
1659
|
return false;
|
|
@@ -1648,10 +1690,6 @@ function prepareViewObjectModelClass(
|
|
|
1648
1690
|
? getWidgetInstancesForView(componentName, dependencies.dataTestIdSet, customPomAvailableClassIdentifiers)
|
|
1649
1691
|
: [];
|
|
1650
1692
|
|
|
1651
|
-
const componentRefsForInstances = isView
|
|
1652
|
-
? (usedComponentSet?.size ? usedComponentSet : childrenComponentSet)
|
|
1653
|
-
: childrenComponentSet;
|
|
1654
|
-
|
|
1655
1693
|
const className = toPascalCaseLocal(componentName);
|
|
1656
1694
|
const childInstancePropertyNames = Array.from(componentRefsForInstances)
|
|
1657
1695
|
.filter(child => componentHierarchyMap.has(child) && componentHierarchyMap.get(child)?.dataTestIdSet.size)
|
|
@@ -1964,7 +2002,7 @@ function sliceNodeSource(source: string, node: { start?: number | null; end?: nu
|
|
|
1964
2002
|
|
|
1965
2003
|
function getTypeAnnotationSource(
|
|
1966
2004
|
source: string,
|
|
1967
|
-
node: { typeAnnotation?:
|
|
2005
|
+
node: { typeAnnotation?: object | null },
|
|
1968
2006
|
): string | undefined {
|
|
1969
2007
|
const rawTypeAnnotation = node.typeAnnotation;
|
|
1970
2008
|
if (!rawTypeAnnotation || typeof rawTypeAnnotation !== "object" || !("type" in rawTypeAnnotation) || rawTypeAnnotation.type !== "TSTypeAnnotation" || !("typeAnnotation" in rawTypeAnnotation)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../class-generation/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAkC,oCAAoC,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../class-generation/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAkC,oCAAoC,EAAE,MAAM,sBAAsB,CAAC;AAwC5G,OAAO,EACL,sBAAsB,EAOvB,MAAM,UAAU,CAAC;AAQlB,OAAO,EAAE,oCAAoC,EAAE,CAAC;AA2ChD,UAAU,SAAS;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAID,UAAU,mBAAmB;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,wBAAwB,EAAE,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,GA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E,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CAClD;AAsCD,wBAAsB,aAAa,CACjC,qBAAqB,EAAE,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,EAC1D,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,iBAAiB,EAAE,MAAM,EACzB,OAAO,GAAE,oBAAyB,iBAoGnC"}
|
package/dist/index.cjs
CHANGED
|
@@ -5493,14 +5493,51 @@ function prepareViewObjectModelClass(componentName, dependencies, componentHiera
|
|
|
5493
5493
|
customPomAttachments = [],
|
|
5494
5494
|
testIdAttribute
|
|
5495
5495
|
} = options;
|
|
5496
|
+
const normalizeTrackedComponentRef = (value) => {
|
|
5497
|
+
return value.endsWith(".vue") ? value.slice(0, -4) : value;
|
|
5498
|
+
};
|
|
5499
|
+
const resolveTrackedComponentRef = (value) => {
|
|
5500
|
+
const normalizedValue = normalizeTrackedComponentRef(value);
|
|
5501
|
+
if (componentHierarchyMap.has(value)) {
|
|
5502
|
+
return value;
|
|
5503
|
+
}
|
|
5504
|
+
if (componentHierarchyMap.has(normalizedValue)) {
|
|
5505
|
+
return normalizedValue;
|
|
5506
|
+
}
|
|
5507
|
+
let match = null;
|
|
5508
|
+
for (const [candidateName, candidateDeps] of componentHierarchyMap.entries()) {
|
|
5509
|
+
const normalizedCandidate = normalizeTrackedComponentRef(candidateName);
|
|
5510
|
+
const candidateBaseName = path.parse(candidateDeps.filePath).name;
|
|
5511
|
+
if (normalizedCandidate !== normalizedValue && candidateBaseName !== normalizedValue) {
|
|
5512
|
+
continue;
|
|
5513
|
+
}
|
|
5514
|
+
if (match && match !== candidateName) {
|
|
5515
|
+
return null;
|
|
5516
|
+
}
|
|
5517
|
+
match = candidateName;
|
|
5518
|
+
}
|
|
5519
|
+
return match;
|
|
5520
|
+
};
|
|
5521
|
+
const rawComponentRefsForInstances = isView ? usedComponentSet?.size ? usedComponentSet : childrenComponentSet : childrenComponentSet;
|
|
5522
|
+
const componentRefsForInstances = /* @__PURE__ */ new Set();
|
|
5523
|
+
for (const ref of rawComponentRefsForInstances) {
|
|
5524
|
+
componentRefsForInstances.add(resolveTrackedComponentRef(ref) ?? normalizeTrackedComponentRef(ref));
|
|
5525
|
+
}
|
|
5496
5526
|
const hasChildComponent = (needle) => {
|
|
5497
|
-
const
|
|
5498
|
-
for (const child of
|
|
5499
|
-
|
|
5527
|
+
const normalizedNeedle = normalizeTrackedComponentRef(needle);
|
|
5528
|
+
for (const child of rawComponentRefsForInstances) {
|
|
5529
|
+
const resolvedChild = resolveTrackedComponentRef(child);
|
|
5530
|
+
if (normalizeTrackedComponentRef(child) === normalizedNeedle)
|
|
5500
5531
|
return true;
|
|
5501
|
-
if (
|
|
5532
|
+
if (resolvedChild && normalizeTrackedComponentRef(resolvedChild) === normalizedNeedle)
|
|
5502
5533
|
return true;
|
|
5503
|
-
if (
|
|
5534
|
+
if (resolvedChild) {
|
|
5535
|
+
const resolvedDeps = componentHierarchyMap.get(resolvedChild);
|
|
5536
|
+
if (resolvedDeps && path.parse(resolvedDeps.filePath).name === normalizedNeedle) {
|
|
5537
|
+
return true;
|
|
5538
|
+
}
|
|
5539
|
+
}
|
|
5540
|
+
if (child === `${needle}.vue`)
|
|
5504
5541
|
return true;
|
|
5505
5542
|
}
|
|
5506
5543
|
return false;
|
|
@@ -5524,7 +5561,6 @@ function prepareViewObjectModelClass(componentName, dependencies, componentHiera
|
|
|
5524
5561
|
methodSignatures: a.flatten ? customPomMethodSignaturesByClass.get(a.className) ?? /* @__PURE__ */ new Map() : /* @__PURE__ */ new Map()
|
|
5525
5562
|
}));
|
|
5526
5563
|
const widgetInstances = isView ? getWidgetInstancesForView(componentName, dependencies.dataTestIdSet, customPomAvailableClassIdentifiers) : [];
|
|
5527
|
-
const componentRefsForInstances = isView ? usedComponentSet?.size ? usedComponentSet : childrenComponentSet : childrenComponentSet;
|
|
5528
5564
|
const className = toPascalCaseLocal(componentName);
|
|
5529
5565
|
const childInstancePropertyNames = Array.from(componentRefsForInstances).filter((child) => componentHierarchyMap.has(child) && componentHierarchyMap.get(child)?.dataTestIdSet.size).map((child) => child.split(".vue")[0]);
|
|
5530
5566
|
const blockedViewPassthroughMethodNames = new Set(
|