@immense/vue-pom-generator 1.0.83 → 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 +52 -30
- 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 +20 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +20 -26
- package/dist/index.mjs.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/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 = {}) {
|
|
@@ -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: [
|
|
@@ -9094,7 +9088,7 @@ function collectStaticTextContent(children) {
|
|
|
9094
9088
|
const visit = (nodes) => {
|
|
9095
9089
|
for (const node of nodes) {
|
|
9096
9090
|
if (node.type === NodeTypes.TEXT) {
|
|
9097
|
-
const text2 = node.content
|
|
9091
|
+
const text2 = collapseWhitespace(node.content);
|
|
9098
9092
|
if (text2) {
|
|
9099
9093
|
parts.push(text2);
|
|
9100
9094
|
}
|
|
@@ -9106,7 +9100,7 @@ function collectStaticTextContent(children) {
|
|
|
9106
9100
|
}
|
|
9107
9101
|
};
|
|
9108
9102
|
visit(children);
|
|
9109
|
-
const text = parts.join(" ")
|
|
9103
|
+
const text = collapseWhitespace(parts.join(" "));
|
|
9110
9104
|
return text || void 0;
|
|
9111
9105
|
}
|
|
9112
9106
|
function tryCreateElementMetadata(args) {
|