@immense/vue-pom-generator 1.0.103 → 1.0.104
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 +14 -11
- package/class-generation/index.ts +20 -17
- package/dist/index.cjs +14 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +14 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
v1.0.103
|
|
1
|
+
The window query shows only #67 (and boundary case #66, which is already part of v1.0.103 since it's
|
|
2
|
+
absent from the compare range). Let me verify the previous tag/release to confirm.
|
|
2
3
|
|
|
3
4
|
Highlights
|
|
4
5
|
|
|
5
|
-
-
|
|
6
|
-
|
|
7
|
-
- Extended the packed-build smoke check to guard the fix
|
|
6
|
+
- Scoped leaf POMs are now constructible: generated classes for leaf components reached through
|
|
7
|
+
scoped slots can be instantiated without errors (#67)
|
|
8
8
|
|
|
9
9
|
Changes
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Fixed
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
- Made scoped leaf POM classes constructible during class generation, so instances of leaf
|
|
14
|
+
components under scoped slots can be created from generated code (#67)
|
|
15
|
+
|
|
16
|
+
Breaking Changes
|
|
17
|
+
|
|
18
|
+
None.
|
|
16
19
|
|
|
17
20
|
Pull Requests Included
|
|
18
21
|
|
|
19
|
-
- ]8;id=md-
|
|
22
|
+
- #67 — fix: make scoped leaf POMs constructible (]8;id=md-bu6t21;https://github.com/immense/vue-pom-generator/pull/67#67]8;;]8;;) by @dkattan]8;;
|
|
20
23
|
|
|
21
24
|
Testing
|
|
22
25
|
|
|
23
|
-
-
|
|
24
|
-
|
|
26
|
+
- Added a constructibility case to tests/semantic-component-instances.test.ts, alongside the fix in
|
|
27
|
+
class-generation/index.ts (2 files changed, +22/−17).
|
|
25
28
|
|
|
@@ -2553,12 +2553,20 @@ function prepareViewObjectModelClass(
|
|
|
2553
2553
|
const members: TypeScriptClassMember[] = [];
|
|
2554
2554
|
if (isView && (componentRefsForInstances.size > 0 || attachmentsForThisClass.length > 0 || widgetInstances.length > 0)) {
|
|
2555
2555
|
members.push(...getComponentInstances(directComponentInstances, projectedComponentInstances, attachmentsForThisClass, widgetInstances));
|
|
2556
|
-
members.push(getConstructor(directComponentInstances, attachmentsForThisClass, widgetInstances, { testIdAttribute }));
|
|
2557
2556
|
}
|
|
2558
2557
|
if (!isView && (componentRefsForInstances.size > 0 || attachmentsForThisClass.length > 0)) {
|
|
2559
2558
|
members.push(...getComponentInstances(directComponentInstances, projectedComponentInstances, attachmentsForThisClass));
|
|
2560
|
-
members.push(getConstructor(directComponentInstances, attachmentsForThisClass, [], { testIdAttribute }));
|
|
2561
2559
|
}
|
|
2560
|
+
// Every generated POM can be nested and therefore must accept the locator
|
|
2561
|
+
// passed by its parent's semantic component-instance accessor. Leaf POMs have
|
|
2562
|
+
// no child declarations, but omitting their constructor makes them inherit
|
|
2563
|
+
// BasePage's (page, BasePageOptions) signature and rejects (page, Locator).
|
|
2564
|
+
members.push(getConstructor(
|
|
2565
|
+
directComponentInstances,
|
|
2566
|
+
attachmentsForThisClass,
|
|
2567
|
+
isView ? widgetInstances : [],
|
|
2568
|
+
{ testIdAttribute },
|
|
2569
|
+
));
|
|
2562
2570
|
|
|
2563
2571
|
members.push(
|
|
2564
2572
|
...getAttachmentPassthroughMethods(componentName, dependencies, attachmentsForThisClass, reservedAttachmentPassthroughNames),
|
|
@@ -2618,15 +2626,12 @@ function generateViewObjectModelContent(
|
|
|
2618
2626
|
const basePageImport = path.relative(fromAbs, toAbs).replace(/\\/g, "/");
|
|
2619
2627
|
const basePageImportNoExt = stripExtension(basePageImport).replace(/\\/g, "/");
|
|
2620
2628
|
const basePageImportSpecifier = basePageImportNoExt.startsWith(".") ? basePageImportNoExt : `./${basePageImportNoExt}`;
|
|
2621
|
-
//
|
|
2629
|
+
// Every generated POM constructor takes Playwright's full `Page` (not the narrowed `PwPage`)
|
|
2630
|
+
// and an optional root locator so any POM, including a leaf, can be nested safely:
|
|
2622
2631
|
// `BasePage` widens `page` to the full `Page` for subclasses, so generated POMs construct
|
|
2623
2632
|
// each other with `new Child(this.page)` where `this.page` is `Page`. Importing the
|
|
2624
2633
|
// standard `Page` from `@playwright/test` keeps the narrowed types internal to the vendored
|
|
2625
2634
|
// runtime — they never surface in generated output.
|
|
2626
|
-
const needsPlaywrightPageImport = prepared.isView
|
|
2627
|
-
|| prepared.attachmentsForThisClass.length > 0
|
|
2628
|
-
|| prepared.componentRefsForInstances.size > 0
|
|
2629
|
-
|| prepared.widgetInstances.length > 0;
|
|
2630
2635
|
const customPomImportSpecifiersByClass = options.customPomImportSpecifiersByClass ?? {};
|
|
2631
2636
|
|
|
2632
2637
|
const customImports = Array.from(
|
|
@@ -2692,16 +2697,14 @@ function generateViewObjectModelContent(
|
|
|
2692
2697
|
|
|
2693
2698
|
const prefixText = `${buildFilePrefix({ eslintDisableSortImports: true })}${doc}\n`;
|
|
2694
2699
|
return renderSourceFile(`${prepared.className}.ts`, (sourceFile) => {
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
});
|
|
2704
|
-
}
|
|
2700
|
+
addNamedImport(sourceFile, {
|
|
2701
|
+
moduleSpecifier: "@playwright/test",
|
|
2702
|
+
isTypeOnly: true,
|
|
2703
|
+
namedImports: [
|
|
2704
|
+
{ name: "Locator", alias: "PwLocator" },
|
|
2705
|
+
{ name: "Page", alias: "PwPage" },
|
|
2706
|
+
],
|
|
2707
|
+
});
|
|
2705
2708
|
|
|
2706
2709
|
addNamedImport(sourceFile, {
|
|
2707
2710
|
moduleSpecifier: basePageImportSpecifier,
|
package/dist/index.cjs
CHANGED
|
@@ -6946,12 +6946,16 @@ Fix: give direct and slot-projected instances distinct accessible names or seman
|
|
|
6946
6946
|
const members = [];
|
|
6947
6947
|
if (isView && (componentRefsForInstances.size > 0 || attachmentsForThisClass.length > 0 || widgetInstances.length > 0)) {
|
|
6948
6948
|
members.push(...getComponentInstances(directComponentInstances, projectedComponentInstances, attachmentsForThisClass, widgetInstances));
|
|
6949
|
-
members.push(getConstructor(directComponentInstances, attachmentsForThisClass, widgetInstances, { testIdAttribute }));
|
|
6950
6949
|
}
|
|
6951
6950
|
if (!isView && (componentRefsForInstances.size > 0 || attachmentsForThisClass.length > 0)) {
|
|
6952
6951
|
members.push(...getComponentInstances(directComponentInstances, projectedComponentInstances, attachmentsForThisClass));
|
|
6953
|
-
members.push(getConstructor(directComponentInstances, attachmentsForThisClass, [], { testIdAttribute }));
|
|
6954
6952
|
}
|
|
6953
|
+
members.push(getConstructor(
|
|
6954
|
+
directComponentInstances,
|
|
6955
|
+
attachmentsForThisClass,
|
|
6956
|
+
isView ? widgetInstances : [],
|
|
6957
|
+
{ testIdAttribute }
|
|
6958
|
+
));
|
|
6955
6959
|
members.push(
|
|
6956
6960
|
...getAttachmentPassthroughMethods(componentName, dependencies, attachmentsForThisClass, reservedAttachmentPassthroughNames)
|
|
6957
6961
|
);
|
|
@@ -6996,7 +7000,6 @@ function generateViewObjectModelContent(componentName, dependencies, componentHi
|
|
|
6996
7000
|
const basePageImport = path.relative(fromAbs, toAbs).replace(/\\/g, "/");
|
|
6997
7001
|
const basePageImportNoExt = stripExtension(basePageImport).replace(/\\/g, "/");
|
|
6998
7002
|
const basePageImportSpecifier = basePageImportNoExt.startsWith(".") ? basePageImportNoExt : `./${basePageImportNoExt}`;
|
|
6999
|
-
const needsPlaywrightPageImport = prepared.isView || prepared.attachmentsForThisClass.length > 0 || prepared.componentRefsForInstances.size > 0 || prepared.widgetInstances.length > 0;
|
|
7000
7003
|
const customPomImportSpecifiersByClass = options.customPomImportSpecifiersByClass ?? {};
|
|
7001
7004
|
const customImports = Array.from(
|
|
7002
7005
|
/* @__PURE__ */ new Set([
|
|
@@ -7048,16 +7051,14 @@ function generateViewObjectModelContent(componentName, dependencies, componentHi
|
|
|
7048
7051
|
const prefixText = `${buildFilePrefix({ eslintDisableSortImports: true })}${doc}
|
|
7049
7052
|
`;
|
|
7050
7053
|
return renderSourceFile(`${prepared.className}.ts`, (sourceFile) => {
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
});
|
|
7060
|
-
}
|
|
7054
|
+
addNamedImport(sourceFile, {
|
|
7055
|
+
moduleSpecifier: "@playwright/test",
|
|
7056
|
+
isTypeOnly: true,
|
|
7057
|
+
namedImports: [
|
|
7058
|
+
{ name: "Locator", alias: "PwLocator" },
|
|
7059
|
+
{ name: "Page", alias: "PwPage" }
|
|
7060
|
+
]
|
|
7061
|
+
});
|
|
7061
7062
|
addNamedImport(sourceFile, {
|
|
7062
7063
|
moduleSpecifier: basePageImportSpecifier,
|
|
7063
7064
|
namedImports: ["BasePage", "Fluent"]
|