@immense/vue-pom-generator 1.0.82 → 1.0.84
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 +54 -54
- package/class-generation/playwright-types.ts +120 -2
- package/dist/class-generation/playwright-types.d.ts +256 -2
- package/dist/class-generation/playwright-types.d.ts.map +1 -1
- package/dist/compiler-metadata-utils.d.ts.map +1 -1
- package/dist/eslint.config.d.ts.map +1 -1
- package/dist/index.cjs +37 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +37 -41
- package/dist/index.mjs.map +1 -1
- package/dist/plugin/runtime/annotator/client.d.ts +13 -0
- package/dist/plugin/runtime/annotator/client.d.ts.map +1 -1
- package/dist/plugin/runtime/annotator/format.d.ts.map +1 -1
- package/dist/plugin/runtime/annotator/plugin.d.ts +16 -0
- package/dist/plugin/runtime/annotator/plugin.d.ts.map +1 -1
- package/dist/plugin/runtime/annotator/text-utils.d.ts +15 -0
- package/dist/plugin/runtime/annotator/text-utils.d.ts.map +1 -0
- package/dist/plugin/runtime/annotator/vue-detector.d.ts +49 -0
- package/dist/plugin/runtime/annotator/vue-detector.d.ts.map +1 -1
- package/dist/pom-discoverability.d.ts.map +1 -1
- package/dist/pom-patterns.d.ts +28 -4
- package/dist/pom-patterns.d.ts.map +1 -1
- package/dist/tests/annotator-runtime-helpers.test.d.ts +2 -0
- package/dist/tests/annotator-runtime-helpers.test.d.ts.map +1 -0
- package/dist/tests/broad/accessibility-audit-ts.test.d.ts +2 -0
- package/dist/tests/broad/accessibility-audit-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/class-generation-base-page-ts.test.d.ts +2 -0
- package/dist/tests/broad/class-generation-base-page-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/compiler-metadata-utils-ts.test.d.ts +2 -0
- package/dist/tests/broad/compiler-metadata-utils-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/helpers/fake-runtime.d.ts +162 -0
- package/dist/tests/broad/helpers/fake-runtime.d.ts.map +1 -0
- package/dist/tests/broad/manifest-generator-ts.test.d.ts +2 -0
- package/dist/tests/broad/manifest-generator-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/metadata-collector-ts.test.d.ts +2 -0
- package/dist/tests/broad/metadata-collector-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/plugin-logger-ts.test.d.ts +2 -0
- package/dist/tests/broad/plugin-logger-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/plugin-resolved-generation-options-ts.test.d.ts +2 -0
- package/dist/tests/broad/plugin-resolved-generation-options-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/plugin-runtime-annotator-format-ts.test.d.ts +2 -0
- package/dist/tests/broad/plugin-runtime-annotator-format-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/typescript-codegen-ts.test.d.ts +2 -0
- package/dist/tests/broad/typescript-codegen-ts.test.d.ts.map +1 -0
- package/dist/tests/helpers/typed-mocks.d.ts +58 -0
- package/dist/tests/helpers/typed-mocks.d.ts.map +1 -0
- package/dist/transform.d.ts +36 -5
- package/dist/transform.d.ts.map +1 -1
- package/dist/utils.d.ts +261 -2
- package/dist/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/plugin/runtime/annotator/client.ts +24 -12
- package/plugin/runtime/annotator/format.ts +5 -7
- package/plugin/runtime/annotator/plugin.ts +24 -6
- package/plugin/runtime/annotator/text-utils.ts +23 -0
- package/plugin/runtime/annotator/vue-detector.ts +56 -0
package/dist/index.mjs
CHANGED
|
@@ -431,25 +431,11 @@ function pomMethodSignatureEquals(left, right) {
|
|
|
431
431
|
function isParameterizedPomPattern(kind) {
|
|
432
432
|
return kind === "parameterized";
|
|
433
433
|
}
|
|
434
|
-
function
|
|
435
|
-
const out = [];
|
|
436
|
-
const seen = /* @__PURE__ */ new Set();
|
|
437
|
-
const matches = formatted.matchAll(/\$\{(\w+)\}/g);
|
|
438
|
-
for (const match of matches) {
|
|
439
|
-
const variableName = match[1];
|
|
440
|
-
if (seen.has(variableName)) {
|
|
441
|
-
continue;
|
|
442
|
-
}
|
|
443
|
-
seen.add(variableName);
|
|
444
|
-
out.push(variableName);
|
|
445
|
-
}
|
|
446
|
-
return out;
|
|
447
|
-
}
|
|
448
|
-
function createPomStringPattern(formatted, patternKind) {
|
|
434
|
+
function createPomStringPattern(formatted, patternKind, templateVariables) {
|
|
449
435
|
return {
|
|
450
436
|
formatted,
|
|
451
437
|
patternKind,
|
|
452
|
-
templateVariables:
|
|
438
|
+
templateVariables: [...templateVariables]
|
|
453
439
|
};
|
|
454
440
|
}
|
|
455
441
|
function getPomPatternVariables(patterns, options = {}) {
|
|
@@ -561,14 +547,14 @@ function uniquePomStringPatterns(primary, alternates) {
|
|
|
561
547
|
}
|
|
562
548
|
return out;
|
|
563
549
|
}
|
|
564
|
-
function
|
|
550
|
+
function splitWords(value) {
|
|
565
551
|
const normalized = value.replace(/ByKey/g, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/[._-]+/g, " ").trim();
|
|
566
552
|
if (!normalized) {
|
|
567
553
|
return [];
|
|
568
554
|
}
|
|
569
555
|
return normalized.split(/\s+/).map((word) => word.toLowerCase()).filter(Boolean);
|
|
570
556
|
}
|
|
571
|
-
function
|
|
557
|
+
function joinWords(words) {
|
|
572
558
|
return words.join(" ").replace(/\s+/g, " ").trim();
|
|
573
559
|
}
|
|
574
560
|
function toSentenceCase(value) {
|
|
@@ -600,7 +586,7 @@ function removeTrailingRoleWord(words, roleWord) {
|
|
|
600
586
|
return words.slice(0, -1);
|
|
601
587
|
}
|
|
602
588
|
function humanizePomMethodName(methodName) {
|
|
603
|
-
return
|
|
589
|
+
return joinWords(splitWords(methodName));
|
|
604
590
|
}
|
|
605
591
|
function stripPomActionPrefix(actionName) {
|
|
606
592
|
for (const prefix of ["click", "select", "type", "goTo"]) {
|
|
@@ -617,13 +603,13 @@ function normalizePomRoleLabel(nativeRole) {
|
|
|
617
603
|
return nativeRole || "element";
|
|
618
604
|
}
|
|
619
605
|
function buildPomLocatorDescription(args) {
|
|
620
|
-
const componentWords =
|
|
606
|
+
const componentWords = splitWords(args.componentName ? stripComponentKindSuffix(args.componentName) : "");
|
|
621
607
|
const roleWord = normalizePomRoleLabel(args.nativeRole).toLowerCase();
|
|
622
608
|
const semanticWords = removeLeadingWords(
|
|
623
|
-
removeTrailingRoleWord(
|
|
609
|
+
removeTrailingRoleWord(splitWords(args.methodName), roleWord),
|
|
624
610
|
componentWords
|
|
625
611
|
);
|
|
626
|
-
const phrase =
|
|
612
|
+
const phrase = joinWords([
|
|
627
613
|
...componentWords,
|
|
628
614
|
...semanticWords,
|
|
629
615
|
roleWord
|
|
@@ -1175,6 +1161,9 @@ function upperFirst(value) {
|
|
|
1175
1161
|
}
|
|
1176
1162
|
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
1177
1163
|
}
|
|
1164
|
+
function collapseWhitespace(value) {
|
|
1165
|
+
return value.replace(/\s+/g, " ").trim();
|
|
1166
|
+
}
|
|
1178
1167
|
function isAsciiUppercaseLetterCode(code) {
|
|
1179
1168
|
return code >= 65 && code <= 90;
|
|
1180
1169
|
}
|
|
@@ -2849,13 +2838,15 @@ function safeMethodNameFromParts(parts) {
|
|
|
2849
2838
|
function toPomKeyPattern(templateValue) {
|
|
2850
2839
|
const { templateLiteral } = templateValue.parsedTemplate;
|
|
2851
2840
|
let out = "";
|
|
2841
|
+
let hasExpression = false;
|
|
2852
2842
|
for (let i = 0; i < templateLiteral.quasis.length; i += 1) {
|
|
2853
2843
|
out += templateLiteral.quasis[i]?.value.raw ?? "";
|
|
2854
2844
|
if (templateLiteral.expressions[i]) {
|
|
2855
2845
|
out += "${key}";
|
|
2846
|
+
hasExpression = true;
|
|
2856
2847
|
}
|
|
2857
2848
|
}
|
|
2858
|
-
return out;
|
|
2849
|
+
return { formatted: out, templateVariables: hasExpression ? ["key"] : [] };
|
|
2859
2850
|
}
|
|
2860
2851
|
function applyResolvedDataTestId(args) {
|
|
2861
2852
|
const addHtmlAttribute = args.addHtmlAttribute ?? true;
|
|
@@ -2979,9 +2970,11 @@ Fix: either (1) include ${bestKeyPreservePlaceholder} in your :${attrLabel} temp
|
|
|
2979
2970
|
};
|
|
2980
2971
|
const normalizedRole = normalizeNativeRole(args.nativeRole) ?? "button";
|
|
2981
2972
|
const targetPageObjectModelClass = entryOverrides.targetPageObjectModelClass;
|
|
2982
|
-
const
|
|
2973
|
+
const pomKeyPattern = dataTestId.kind === "template" ? toPomKeyPattern(dataTestId) : null;
|
|
2974
|
+
const formattedDataTestIdForPom = dataTestId.kind === "template" ? pomKeyPattern.formatted : dataTestId.value;
|
|
2983
2975
|
const selectorPatternKind = dataTestId.kind === "template" ? "parameterized" : "static";
|
|
2984
|
-
const
|
|
2976
|
+
const selectorTemplateVariables = dataTestId.kind === "template" ? pomKeyPattern.templateVariables : [];
|
|
2977
|
+
const selectorPattern = createPomStringPattern(formattedDataTestIdForPom, selectorPatternKind, selectorTemplateVariables);
|
|
2985
2978
|
const selectorIsParameterized = selectorPatternKind === "parameterized";
|
|
2986
2979
|
const deriveBaseMethodNameFromHint = (hint) => {
|
|
2987
2980
|
const hintRaw = (hint ?? "").trim();
|
|
@@ -3259,7 +3252,8 @@ Fix: make the element identifiable (e.g. add id/name/inner text or use a more sp
|
|
|
3259
3252
|
const dataTestIdEntry = {
|
|
3260
3253
|
selectorValue: entryOverrides.selectorValue ?? createPomStringPattern(
|
|
3261
3254
|
getAttributeValueText(dataTestId),
|
|
3262
|
-
dataTestId.kind === "template" ? "parameterized" : "static"
|
|
3255
|
+
dataTestId.kind === "template" ? "parameterized" : "static",
|
|
3256
|
+
selectorTemplateVariables
|
|
3263
3257
|
),
|
|
3264
3258
|
templateLiteral: entryOverrides.templateLiteral,
|
|
3265
3259
|
targetPageObjectModelClass: entryOverrides.targetPageObjectModelClass
|
|
@@ -3486,8 +3480,8 @@ Fix: make the element identifiable (e.g. add id/name/inner text or use a more sp
|
|
|
3486
3480
|
name: generatedName2,
|
|
3487
3481
|
selector: {
|
|
3488
3482
|
kind: "withinTestIdByLabel",
|
|
3489
|
-
rootTestId: createPomStringPattern(wrapperTestId, selectorPatternKind),
|
|
3490
|
-
label: createPomStringPattern(label, "static"),
|
|
3483
|
+
rootTestId: createPomStringPattern(wrapperTestId, selectorPatternKind, selectorTemplateVariables),
|
|
3484
|
+
label: createPomStringPattern(label, "static", []),
|
|
3491
3485
|
exact: true
|
|
3492
3486
|
},
|
|
3493
3487
|
parameters: [createPomParameterSpec("annotationText", `string = ""`)]
|
|
@@ -3508,8 +3502,8 @@ Fix: make the element identifiable (e.g. add id/name/inner text or use a more sp
|
|
|
3508
3502
|
name: generatedName,
|
|
3509
3503
|
selector: {
|
|
3510
3504
|
kind: "withinTestIdByLabel",
|
|
3511
|
-
rootTestId: createPomStringPattern(wrapperTestId, selectorPatternKind),
|
|
3512
|
-
label: createPomStringPattern("${value}", "parameterized"),
|
|
3505
|
+
rootTestId: createPomStringPattern(wrapperTestId, selectorPatternKind, selectorTemplateVariables),
|
|
3506
|
+
label: createPomStringPattern("${value}", "parameterized", ["value"]),
|
|
3513
3507
|
exact: true
|
|
3514
3508
|
},
|
|
3515
3509
|
parameters: [
|
|
@@ -8866,8 +8860,11 @@ const DEFAULT_ENTRY_SUFFIXES = [
|
|
|
8866
8860
|
"/src/main.tsx",
|
|
8867
8861
|
"/src/main.jsx"
|
|
8868
8862
|
];
|
|
8863
|
+
function normalizePathSeparators(filePath) {
|
|
8864
|
+
return filePath.replace(/\\/g, "/");
|
|
8865
|
+
}
|
|
8869
8866
|
function toFsImportPath(filePath) {
|
|
8870
|
-
return `/@fs/${filePath
|
|
8867
|
+
return `/@fs/${normalizePathSeparators(filePath)}`;
|
|
8871
8868
|
}
|
|
8872
8869
|
function resolveAnnotatorClientPath() {
|
|
8873
8870
|
const candidates = [
|
|
@@ -8912,7 +8909,7 @@ function createAnnotatorUiPlugin(options) {
|
|
|
8912
8909
|
if (!options.enabled) {
|
|
8913
8910
|
return null;
|
|
8914
8911
|
}
|
|
8915
|
-
const normalizedId = id
|
|
8912
|
+
const normalizedId = normalizePathSeparators(id);
|
|
8916
8913
|
if (!DEFAULT_ENTRY_SUFFIXES.some((suffix) => normalizedId.endsWith(suffix))) {
|
|
8917
8914
|
return null;
|
|
8918
8915
|
}
|
|
@@ -9091,7 +9088,7 @@ function collectStaticTextContent(children) {
|
|
|
9091
9088
|
const visit = (nodes) => {
|
|
9092
9089
|
for (const node of nodes) {
|
|
9093
9090
|
if (node.type === NodeTypes.TEXT) {
|
|
9094
|
-
const text2 = node.content
|
|
9091
|
+
const text2 = collapseWhitespace(node.content);
|
|
9095
9092
|
if (text2) {
|
|
9096
9093
|
parts.push(text2);
|
|
9097
9094
|
}
|
|
@@ -9103,7 +9100,7 @@ function collectStaticTextContent(children) {
|
|
|
9103
9100
|
}
|
|
9104
9101
|
};
|
|
9105
9102
|
visit(children);
|
|
9106
|
-
const text = parts.join(" ")
|
|
9103
|
+
const text = collapseWhitespace(parts.join(" "));
|
|
9107
9104
|
return text || void 0;
|
|
9108
9105
|
}
|
|
9109
9106
|
function tryCreateElementMetadata(args) {
|
|
@@ -10458,10 +10455,6 @@ const SHORTCUT_LABELS = {
|
|
|
10458
10455
|
settings: ",",
|
|
10459
10456
|
cancel: "Esc"
|
|
10460
10457
|
};
|
|
10461
|
-
function normalizeText(value) {
|
|
10462
|
-
const normalized = value?.replace(/\s+/g, " ").trim();
|
|
10463
|
-
return normalized || void 0;
|
|
10464
|
-
}
|
|
10465
10458
|
function formatShortcutTitle(label, shortcut) {
|
|
10466
10459
|
return shortcut ? `${label} (${shortcut})` : label;
|
|
10467
10460
|
}
|
|
@@ -10502,11 +10495,11 @@ function getElementPath(element) {
|
|
|
10502
10495
|
return segments.join(" > ");
|
|
10503
10496
|
}
|
|
10504
10497
|
function getNearbyText(element) {
|
|
10505
|
-
const ownText =
|
|
10498
|
+
const ownText = normalizeInlineText(element.textContent || void 0);
|
|
10506
10499
|
if (ownText && ownText.length >= 2) {
|
|
10507
10500
|
return ownText.length > 160 ? `${ownText.slice(0, 160)}...` : ownText;
|
|
10508
10501
|
}
|
|
10509
|
-
const parentText =
|
|
10502
|
+
const parentText = normalizeInlineText(element.parentElement?.textContent || void 0);
|
|
10510
10503
|
if (parentText) {
|
|
10511
10504
|
return parentText.length > 160 ? `${parentText.slice(0, 160)}...` : parentText;
|
|
10512
10505
|
}
|
|
@@ -10529,6 +10522,9 @@ function createFloatingArrow() {
|
|
|
10529
10522
|
function toCssPixels(value) {
|
|
10530
10523
|
return `${Math.round(value)}px`;
|
|
10531
10524
|
}
|
|
10525
|
+
function placementPrimarySide(placement) {
|
|
10526
|
+
return placement.split("-")[0];
|
|
10527
|
+
}
|
|
10532
10528
|
function clamp(value, min, max) {
|
|
10533
10529
|
return Math.min(Math.max(value, min), max);
|
|
10534
10530
|
}
|
|
@@ -11017,7 +11013,7 @@ class AnnotatorRuntime {
|
|
|
11017
11013
|
panel.style.top = toCssPixels(result.y);
|
|
11018
11014
|
panel.style.visibility = "visible";
|
|
11019
11015
|
const arrowData = result.middlewareData.arrow;
|
|
11020
|
-
const side = result.placement
|
|
11016
|
+
const side = placementPrimarySide(result.placement);
|
|
11021
11017
|
const staticSide = side === "top" ? "bottom" : side === "bottom" ? "top" : side === "left" ? "right" : "left";
|
|
11022
11018
|
arrowEl.style.removeProperty("top");
|
|
11023
11019
|
arrowEl.style.removeProperty("right");
|