@immense/vue-pom-generator 1.0.114 → 1.0.116
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 +17 -30
- package/dist/index.cjs +22 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +23 -23
- package/dist/index.mjs.map +1 -1
- package/dist/plugin/path-utils.d.ts +1 -0
- package/dist/plugin/path-utils.d.ts.map +1 -1
- package/dist/plugin/vue-plugin.d.ts.map +1 -1
- package/dist/transform.d.ts.map +1 -1
- package/dist/wrapper-contract.d.ts +12 -6
- package/dist/wrapper-contract.d.ts.map +1 -1
- package/package.json +1 -1
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,47 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
The range contains exactly one commit (#79). Let me review its diff to describe the feature
|
|
4
|
-
accurately.
|
|
1
|
+
v1.0.116
|
|
5
2
|
|
|
6
3
|
Highlights
|
|
7
4
|
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
5
|
+
- Wrapper targeting fixed: a component's own fallthrough target is now matched by element, not by
|
|
6
|
+
offset in the wrapper contract (#83) — wrappers no longer bind to the wrong node when sibling
|
|
7
|
+
structure shifts.
|
|
8
|
+
- Corrected the corresponding logic in transform.ts so generated wrappers stay consistent with the
|
|
9
|
+
new element-based matching.
|
|
10
|
+
- Added regression coverage in tests/transform.test.ts and trimmed the offset-based assumptions in
|
|
11
|
+
tests/wrapper-contract.test.ts.
|
|
14
12
|
|
|
15
13
|
Changes
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
Fixed
|
|
18
16
|
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
BasePagePage interface (]8;id=md-14v2psc;https://github.com/immense/vue-pom-generator/blob/main/class-generation/playwright-types.tsplaywright-types.ts]8;;]8;;).]8;;
|
|
23
|
-
- Extended fluent-chain handling so screenshot joins getObjectId/getObjectIdAsInt as a
|
|
24
|
-
value-returning method, returning the awaited image buffer.
|
|
17
|
+
- wrapper-contract: match a component's own fallthrough target by element rather than by positional
|
|
18
|
+
offset (#83).
|
|
19
|
+
- transform: updated transform behavior to align with element-based fallthrough matching.
|
|
25
20
|
|
|
26
21
|
Tests
|
|
27
22
|
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
pattern of screenshotting an awaited fluent destination POM.
|
|
31
|
-
- Extended broad unit coverage for base-page.ts and updated the fake-runtime test helper to support
|
|
32
|
-
the new seam.
|
|
33
|
-
|
|
34
|
-
Breaking Changes
|
|
35
|
-
|
|
36
|
-
None.
|
|
23
|
+
- tests/transform.test.ts: new cases covering element-based fallthrough target matching.
|
|
24
|
+
- tests/wrapper-contract.test.ts: updated expectations for the corrected matching behavior.
|
|
37
25
|
|
|
38
26
|
Pull Requests Included
|
|
39
27
|
|
|
40
|
-
-
|
|
28
|
+
- #83 — fix(wrappers): match a component's own fallthrough target by element, not offset —
|
|
29
|
+
]8;id=md-1cfqef3;https://github.com/immense/vue-pom-generator/pull/83@darrenator[bot]]8;;
|
|
41
30
|
|
|
42
31
|
Testing
|
|
43
32
|
|
|
44
|
-
- Unit tests for
|
|
45
|
-
tests/broad/class-generation-base-page-ts.test.ts.
|
|
46
|
-
- New Playwright end-to-end spec validates buffer content, PNG magic bytes, and file-write parity.
|
|
33
|
+
- Unit tests added/updated for transform and wrapper-contract matching behavior.
|
|
47
34
|
|
package/dist/index.cjs
CHANGED
|
@@ -4168,6 +4168,14 @@ function writeGeneratedOutputs(outDir, files, sharedFiles, projectRoot = path.di
|
|
|
4168
4168
|
writeFile(manifestPath, `${JSON.stringify(next, null, 2)}
|
|
4169
4169
|
`);
|
|
4170
4170
|
}
|
|
4171
|
+
function toPosixSlashes(value) {
|
|
4172
|
+
let out = "";
|
|
4173
|
+
for (let i = 0; i < value.length; i++) {
|
|
4174
|
+
const ch = value[i];
|
|
4175
|
+
out += ch === "\\" ? "/" : ch;
|
|
4176
|
+
}
|
|
4177
|
+
return out;
|
|
4178
|
+
}
|
|
4171
4179
|
function safeRealpath(value) {
|
|
4172
4180
|
try {
|
|
4173
4181
|
if (fs.existsSync(value)) {
|
|
@@ -4203,18 +4211,18 @@ function resolveComponentNameFromPath(options) {
|
|
|
4203
4211
|
const { projectRoot, viewsDirAbs, sourceDirs, extraRoots = [] } = options;
|
|
4204
4212
|
const cleanFilename = options.filename.includes("?") ? options.filename.substring(0, options.filename.indexOf("?")) : options.filename;
|
|
4205
4213
|
const absFilename = path.isAbsolute(cleanFilename) ? cleanFilename : path.resolve(projectRoot, cleanFilename);
|
|
4206
|
-
const normalizedAbsFilename = path.normalize(safeRealpath(absFilename));
|
|
4214
|
+
const normalizedAbsFilename = toPosixSlashes(path.normalize(safeRealpath(absFilename)));
|
|
4207
4215
|
const rootBases = [projectRoot, ...extraRoots.filter((r) => r !== projectRoot)];
|
|
4208
4216
|
const roots = [
|
|
4209
4217
|
viewsDirAbs,
|
|
4210
4218
|
...sourceDirs.flatMap((dir) => path.isAbsolute(dir) ? [dir] : rootBases.map((base) => path.resolve(base, dir)))
|
|
4211
4219
|
];
|
|
4212
|
-
const potentialRoots = Array.from(new Set(roots.map((r) => path.normalize(safeRealpath(r))))).sort((a, b) => b.length - a.length);
|
|
4220
|
+
const potentialRoots = Array.from(new Set(roots.map((r) => toPosixSlashes(path.normalize(safeRealpath(r)))))).sort((a, b) => b.length - a.length);
|
|
4213
4221
|
for (const root of potentialRoots) {
|
|
4214
|
-
if (normalizedAbsFilename.startsWith(root
|
|
4215
|
-
const rel = path.relative(root, normalizedAbsFilename);
|
|
4216
|
-
const parsed = path.parse(rel);
|
|
4217
|
-
const segments = path.join(parsed.dir, parsed.name);
|
|
4222
|
+
if (normalizedAbsFilename.startsWith(`${root}/`) || normalizedAbsFilename === root) {
|
|
4223
|
+
const rel = path.posix.relative(root, normalizedAbsFilename);
|
|
4224
|
+
const parsed = path.posix.parse(rel);
|
|
4225
|
+
const segments = path.posix.join(parsed.dir, parsed.name);
|
|
4218
4226
|
return toPascalCase(segments);
|
|
4219
4227
|
}
|
|
4220
4228
|
}
|
|
@@ -9029,9 +9037,8 @@ function analyzeWrapperContractFromSfc(options) {
|
|
|
9029
9037
|
role: null,
|
|
9030
9038
|
targetRoles: [],
|
|
9031
9039
|
forwardedTestIdTargetOffsets: /* @__PURE__ */ new Set(),
|
|
9032
|
-
|
|
9033
|
-
|
|
9034
|
-
explicitlyForwardedTestIdTargetSfcOffsets: /* @__PURE__ */ new Set()
|
|
9040
|
+
attrsObjectNames: /* @__PURE__ */ new Set(),
|
|
9041
|
+
attrsFunctionNames: /* @__PURE__ */ new Set()
|
|
9035
9042
|
};
|
|
9036
9043
|
}
|
|
9037
9044
|
const scriptMetadata = analyzeScriptForwardingMetadata(
|
|
@@ -9040,7 +9047,6 @@ function analyzeWrapperContractFromSfc(options) {
|
|
|
9040
9047
|
);
|
|
9041
9048
|
const ast = compilerDom.parse(template, { comments: false });
|
|
9042
9049
|
const targets = /* @__PURE__ */ new Map();
|
|
9043
|
-
const explicitTargetOffsets = /* @__PURE__ */ new Set();
|
|
9044
9050
|
if (scriptMetadata.inheritAttrs) {
|
|
9045
9051
|
for (const element of getRenderedRootElements(ast)) {
|
|
9046
9052
|
targets.set(element.loc.start.offset, element);
|
|
@@ -9049,7 +9055,6 @@ function analyzeWrapperContractFromSfc(options) {
|
|
|
9049
9055
|
walkTemplate(ast, (element) => {
|
|
9050
9056
|
if (elementExplicitlyForwardsTestId(element, options.testIdAttribute, scriptMetadata)) {
|
|
9051
9057
|
targets.set(element.loc.start.offset, element);
|
|
9052
|
-
explicitTargetOffsets.add(element.loc.start.offset);
|
|
9053
9058
|
}
|
|
9054
9059
|
});
|
|
9055
9060
|
const targetRoles = [...targets.values()].map((element) => {
|
|
@@ -9064,17 +9069,12 @@ function analyzeWrapperContractFromSfc(options) {
|
|
|
9064
9069
|
});
|
|
9065
9070
|
const uniqueRoles = new Set(targetRoles);
|
|
9066
9071
|
const role = uniqueRoles.size === 1 && !uniqueRoles.has(null) ? targetRoles[0] ?? null : null;
|
|
9067
|
-
const templateContentStartOffset = descriptor.template?.loc.start.offset ?? 0;
|
|
9068
|
-
const toSfcOffsets = (offsets) => new Set(
|
|
9069
|
-
[...offsets].map((offset) => offset + templateContentStartOffset)
|
|
9070
|
-
);
|
|
9071
9072
|
return {
|
|
9072
9073
|
role,
|
|
9073
9074
|
targetRoles,
|
|
9074
9075
|
forwardedTestIdTargetOffsets: new Set(targets.keys()),
|
|
9075
|
-
|
|
9076
|
-
|
|
9077
|
-
explicitlyForwardedTestIdTargetSfcOffsets: toSfcOffsets(explicitTargetOffsets)
|
|
9076
|
+
attrsObjectNames: scriptMetadata.attrsObjectNames,
|
|
9077
|
+
attrsFunctionNames: scriptMetadata.attrsFunctionNames
|
|
9078
9078
|
};
|
|
9079
9079
|
}
|
|
9080
9080
|
function resolveWrapperContractForTag(options) {
|
|
@@ -9743,8 +9743,7 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
|
|
|
9743
9743
|
}
|
|
9744
9744
|
}
|
|
9745
9745
|
const ownWrapperContract = getWrapperContract(componentName);
|
|
9746
|
-
const
|
|
9747
|
-
const isExplicitFallthroughTarget = ownWrapperContract?.explicitlyForwardedTestIdTargetOffsets.has(elementStartOffset) || ownWrapperContract?.explicitlyForwardedTestIdTargetSfcOffsets.has(elementStartOffset);
|
|
9746
|
+
const isExplicitFallthroughTarget = !!ownWrapperContract && elementExplicitlyForwardsTestId(element, testIdAttribute, ownWrapperContract);
|
|
9748
9747
|
if (!dependencies.isView && isExplicitFallthroughTarget) {
|
|
9749
9748
|
return;
|
|
9750
9749
|
}
|
|
@@ -10580,7 +10579,8 @@ function createVuePluginWithTestIds(options) {
|
|
|
10580
10579
|
runtimeNodeTransform
|
|
10581
10580
|
]
|
|
10582
10581
|
};
|
|
10583
|
-
const collectSource = async (code,
|
|
10582
|
+
const collectSource = async (code, rawPath) => {
|
|
10583
|
+
const cleanPath = toPosixSlashes(rawPath);
|
|
10584
10584
|
const componentName = getComponentNameFromPath(cleanPath);
|
|
10585
10585
|
loggerRef.current.debug(`Collecting metadata for ${cleanPath} (component: ${componentName})`);
|
|
10586
10586
|
const compilerSfc2 = await import("@vue/compiler-sfc");
|
|
@@ -10813,7 +10813,7 @@ function createDevProcessorPlugin(options) {
|
|
|
10813
10813
|
const { descriptor } = compilerSfc.parse(source, { filename });
|
|
10814
10814
|
if (!descriptor.script && !descriptor.scriptSetup)
|
|
10815
10815
|
return { bindings: void 0, isScriptSetup: false };
|
|
10816
|
-
const scriptBlock = compilerSfc.compileScript(descriptor, { id: filename });
|
|
10816
|
+
const scriptBlock = compilerSfc.compileScript(descriptor, { id: toPosixSlashes(filename) });
|
|
10817
10817
|
return { bindings: scriptBlock.bindings, isScriptSetup: !!descriptor.scriptSetup };
|
|
10818
10818
|
} catch {
|
|
10819
10819
|
return { bindings: void 0, isScriptSetup: false };
|