@immense/vue-pom-generator 1.0.62 → 1.0.64
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 +31 -22
- package/class-generation/index.ts +49 -11
- package/dist/class-generation/index.d.ts.map +1 -1
- package/dist/index.cjs +78 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +78 -12
- package/dist/index.mjs.map +1 -1
- package/dist/plugin/create-vue-pom-generator-plugins.d.ts.map +1 -1
- package/dist/plugin/resolved-generation-options.d.ts +2 -1
- package/dist/plugin/resolved-generation-options.d.ts.map +1 -1
- package/dist/plugin/support/build-plugin.d.ts.map +1 -1
- package/dist/plugin/support/dev-plugin.d.ts.map +1 -1
- package/dist/plugin/types.d.ts +12 -1
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/plugin/vue-plugin.d.ts +2 -1
- package/dist/plugin/vue-plugin.d.ts.map +1 -1
- package/dist/transform.d.ts +1 -0
- package/dist/transform.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ export { createVuePomGeneratorPlugins as vuePomGenerator };
|
|
|
5
5
|
export default createVuePomGeneratorPlugins;
|
|
6
6
|
export declare function defineVuePomGeneratorConfig(options: VuePomGeneratorPluginOptions): VuePomGeneratorPluginOptions;
|
|
7
7
|
export declare function defineNuxtPomGeneratorConfig(options: NuxtPomGeneratorPluginOptions): NuxtPomGeneratorPluginOptions;
|
|
8
|
-
export type { ExistingIdBehavior, NuxtPomGeneratorPluginOptions, PomGeneratorPluginOptions, PomNameCollisionBehavior, VuePomGeneratorPluginOptions } from "./plugin/types";
|
|
8
|
+
export type { ExistingIdBehavior, MissingSemanticNameBehavior, NuxtPomGeneratorPluginOptions, PomGeneratorPluginOptions, PomNameCollisionBehavior, VuePomGeneratorPluginOptions } from "./plugin/types";
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,MAAM,2CAA2C,CAAC;AAErF,OAAO,KAAK,EAAE,6BAA6B,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAIlG,OAAO,EAAE,4BAA4B,EAAE,CAAC;AACxC,OAAO,EAAE,4BAA4B,IAAI,eAAe,EAAE,CAAC;AAC3D,eAAe,4BAA4B,CAAC;AAE5C,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,4BAA4B,GAAG,4BAA4B,CAE/G;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,6BAA6B,GAAG,6BAA6B,CAOlH;AAED,YAAY,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,MAAM,2CAA2C,CAAC;AAErF,OAAO,KAAK,EAAE,6BAA6B,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAIlG,OAAO,EAAE,4BAA4B,EAAE,CAAC;AACxC,OAAO,EAAE,4BAA4B,IAAI,eAAe,EAAE,CAAC;AAC3D,eAAe,4BAA4B,CAAC;AAE5C,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,4BAA4B,GAAG,4BAA4B,CAE/G;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,6BAA6B,GAAG,6BAA6B,CAOlH;AAED,YAAY,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -217,6 +217,7 @@ function resolveGenerationSupportOptions(options) {
|
|
|
217
217
|
customPomImportAliases: options.customPomImportAliases,
|
|
218
218
|
customPomImportNameCollisionBehavior: options.customPomImportNameCollisionBehavior ?? "error",
|
|
219
219
|
nameCollisionBehavior: options.nameCollisionBehavior ?? "error",
|
|
220
|
+
missingSemanticNameBehavior: options.missingSemanticNameBehavior ?? "error",
|
|
220
221
|
existingIdBehavior: options.existingIdBehavior ?? "error",
|
|
221
222
|
testIdAttribute: (options.testIdAttribute ?? "data-testid").trim() || "data-testid",
|
|
222
223
|
accessibilityAudit: options.accessibilityAudit ?? false,
|
|
@@ -5452,14 +5453,51 @@ function prepareViewObjectModelClass(componentName, dependencies, componentHiera
|
|
|
5452
5453
|
customPomAttachments = [],
|
|
5453
5454
|
testIdAttribute
|
|
5454
5455
|
} = options;
|
|
5456
|
+
const normalizeTrackedComponentRef = (value) => {
|
|
5457
|
+
return value.endsWith(".vue") ? value.slice(0, -4) : value;
|
|
5458
|
+
};
|
|
5459
|
+
const resolveTrackedComponentRef = (value) => {
|
|
5460
|
+
const normalizedValue = normalizeTrackedComponentRef(value);
|
|
5461
|
+
if (componentHierarchyMap.has(value)) {
|
|
5462
|
+
return value;
|
|
5463
|
+
}
|
|
5464
|
+
if (componentHierarchyMap.has(normalizedValue)) {
|
|
5465
|
+
return normalizedValue;
|
|
5466
|
+
}
|
|
5467
|
+
let match = null;
|
|
5468
|
+
for (const [candidateName, candidateDeps] of componentHierarchyMap.entries()) {
|
|
5469
|
+
const normalizedCandidate = normalizeTrackedComponentRef(candidateName);
|
|
5470
|
+
const candidateBaseName = path.parse(candidateDeps.filePath).name;
|
|
5471
|
+
if (normalizedCandidate !== normalizedValue && candidateBaseName !== normalizedValue) {
|
|
5472
|
+
continue;
|
|
5473
|
+
}
|
|
5474
|
+
if (match && match !== candidateName) {
|
|
5475
|
+
return null;
|
|
5476
|
+
}
|
|
5477
|
+
match = candidateName;
|
|
5478
|
+
}
|
|
5479
|
+
return match;
|
|
5480
|
+
};
|
|
5481
|
+
const rawComponentRefsForInstances = isView ? usedComponentSet?.size ? usedComponentSet : childrenComponentSet : childrenComponentSet;
|
|
5482
|
+
const componentRefsForInstances = /* @__PURE__ */ new Set();
|
|
5483
|
+
for (const ref of rawComponentRefsForInstances) {
|
|
5484
|
+
componentRefsForInstances.add(resolveTrackedComponentRef(ref) ?? normalizeTrackedComponentRef(ref));
|
|
5485
|
+
}
|
|
5455
5486
|
const hasChildComponent = (needle) => {
|
|
5456
|
-
const
|
|
5457
|
-
for (const child of
|
|
5458
|
-
|
|
5487
|
+
const normalizedNeedle = normalizeTrackedComponentRef(needle);
|
|
5488
|
+
for (const child of rawComponentRefsForInstances) {
|
|
5489
|
+
const resolvedChild = resolveTrackedComponentRef(child);
|
|
5490
|
+
if (normalizeTrackedComponentRef(child) === normalizedNeedle)
|
|
5459
5491
|
return true;
|
|
5460
|
-
if (
|
|
5492
|
+
if (resolvedChild && normalizeTrackedComponentRef(resolvedChild) === normalizedNeedle)
|
|
5461
5493
|
return true;
|
|
5462
|
-
if (
|
|
5494
|
+
if (resolvedChild) {
|
|
5495
|
+
const resolvedDeps = componentHierarchyMap.get(resolvedChild);
|
|
5496
|
+
if (resolvedDeps && path.parse(resolvedDeps.filePath).name === normalizedNeedle) {
|
|
5497
|
+
return true;
|
|
5498
|
+
}
|
|
5499
|
+
}
|
|
5500
|
+
if (child === `${needle}.vue`)
|
|
5463
5501
|
return true;
|
|
5464
5502
|
}
|
|
5465
5503
|
return false;
|
|
@@ -5483,7 +5521,6 @@ function prepareViewObjectModelClass(componentName, dependencies, componentHiera
|
|
|
5483
5521
|
methodSignatures: a.flatten ? customPomMethodSignaturesByClass.get(a.className) ?? /* @__PURE__ */ new Map() : /* @__PURE__ */ new Map()
|
|
5484
5522
|
}));
|
|
5485
5523
|
const widgetInstances = isView ? getWidgetInstancesForView(componentName, dependencies.dataTestIdSet, customPomAvailableClassIdentifiers) : [];
|
|
5486
|
-
const componentRefsForInstances = isView ? usedComponentSet?.size ? usedComponentSet : childrenComponentSet : childrenComponentSet;
|
|
5487
5524
|
const className = toPascalCaseLocal(componentName);
|
|
5488
5525
|
const childInstancePropertyNames = Array.from(componentRefsForInstances).filter((child) => componentHierarchyMap.has(child) && componentHierarchyMap.get(child)?.dataTestIdSet.size).map((child) => child.split(".vue")[0]);
|
|
5489
5526
|
const blockedViewPassthroughMethodNames = new Set(
|
|
@@ -6999,6 +7036,7 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
|
|
|
6999
7036
|
const existingIdBehavior = options.existingIdBehavior ?? "error";
|
|
7000
7037
|
const testIdAttribute = (options.testIdAttribute || "data-testid").trim() || "data-testid";
|
|
7001
7038
|
const nameCollisionBehavior = options.nameCollisionBehavior ?? "error";
|
|
7039
|
+
const missingSemanticNameBehavior = options.missingSemanticNameBehavior ?? "error";
|
|
7002
7040
|
const warn = options.warn;
|
|
7003
7041
|
const vueFilesPathMap = options.vueFilesPathMap;
|
|
7004
7042
|
const wrapperSearchRoots = options.wrapperSearchRoots ?? [];
|
|
@@ -7442,13 +7480,16 @@ Fix: remove the explicit ${attrLabel}, or change existingIdBehavior to "overwrit
|
|
|
7442
7480
|
}
|
|
7443
7481
|
const isSubmit = element.props.find((p) => p.type === NodeTypes.ATTRIBUTE && p.name === "type")?.value?.content === "submit";
|
|
7444
7482
|
if (isSubmit) {
|
|
7445
|
-
|
|
7483
|
+
let identifier = getStaticIdOrNameHint(element) || innerText;
|
|
7446
7484
|
if (!identifier) {
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7485
|
+
if (missingSemanticNameBehavior === "error") {
|
|
7486
|
+
const loc = element.loc?.start;
|
|
7487
|
+
const locationHint = loc ? `${loc.line}:${loc.column}` : "unknown";
|
|
7488
|
+
throw new Error(
|
|
7489
|
+
`[vue-pom-generator] submit button appears identifiable but no usable identity could be derived in ${componentName} (${context.filename ?? "unknown"}:${locationHint}) — id/name were missing/empty and innerText was also missing/invalid. Fix: give the button a static id/name, a static inner text, or set missingSemanticNameBehavior = "ignore" to fall back to the generic "submit" identifier.`
|
|
7490
|
+
);
|
|
7491
|
+
}
|
|
7492
|
+
identifier = "submit";
|
|
7452
7493
|
}
|
|
7453
7494
|
const testId = getSubmitDataTestId(identifier);
|
|
7454
7495
|
applyResolvedDataTestIdForElement({
|
|
@@ -7515,6 +7556,7 @@ function createBuildProcessorPlugin(options) {
|
|
|
7515
7556
|
customPomImportNameCollisionBehavior,
|
|
7516
7557
|
testIdAttribute,
|
|
7517
7558
|
nameCollisionBehavior,
|
|
7559
|
+
missingSemanticNameBehavior,
|
|
7518
7560
|
existingIdBehavior,
|
|
7519
7561
|
routerAwarePoms,
|
|
7520
7562
|
routerType,
|
|
@@ -7610,6 +7652,9 @@ function createBuildProcessorPlugin(options) {
|
|
|
7610
7652
|
prefixIdentifiers: true,
|
|
7611
7653
|
inline: isScriptSetup,
|
|
7612
7654
|
bindingMetadata,
|
|
7655
|
+
// See dev-plugin.ts — same rationale: enable TS in template
|
|
7656
|
+
// expressions so `(row: RowType) => ...` handlers parse.
|
|
7657
|
+
expressionPlugins: ["typescript"],
|
|
7613
7658
|
nodeTransforms: [
|
|
7614
7659
|
createTestIdTransform(
|
|
7615
7660
|
componentName,
|
|
@@ -7621,6 +7666,7 @@ function createBuildProcessorPlugin(options) {
|
|
|
7621
7666
|
existingIdBehavior: existingIdBehavior ?? "error",
|
|
7622
7667
|
testIdAttribute,
|
|
7623
7668
|
nameCollisionBehavior,
|
|
7669
|
+
missingSemanticNameBehavior,
|
|
7624
7670
|
warn: (message) => loggerRef.current.warn(message),
|
|
7625
7671
|
vueFilesPathMap,
|
|
7626
7672
|
wrapperSearchRoots: getWrapperSearchRoots()
|
|
@@ -7768,6 +7814,7 @@ function createDevProcessorPlugin(options) {
|
|
|
7768
7814
|
customPomImportAliases,
|
|
7769
7815
|
customPomImportNameCollisionBehavior,
|
|
7770
7816
|
nameCollisionBehavior,
|
|
7817
|
+
missingSemanticNameBehavior,
|
|
7771
7818
|
existingIdBehavior,
|
|
7772
7819
|
testIdAttribute,
|
|
7773
7820
|
routerAwarePoms,
|
|
@@ -7952,6 +7999,12 @@ function createDevProcessorPlugin(options) {
|
|
|
7952
7999
|
prefixIdentifiers: true,
|
|
7953
8000
|
inline: isScriptSetup,
|
|
7954
8001
|
bindingMetadata,
|
|
8002
|
+
// Vue templates may contain TypeScript type annotations in expressions
|
|
8003
|
+
// (e.g. `@row-click="(row: RowType) => navigateTo(...)"` in Nuxt + TS
|
|
8004
|
+
// apps). Without this flag, Vue's internal processExpression step
|
|
8005
|
+
// delegates to @babel/parser without the TS plugin and crashes on
|
|
8006
|
+
// "Unexpected token, expected ','".
|
|
8007
|
+
expressionPlugins: ["typescript"],
|
|
7955
8008
|
nodeTransforms: [
|
|
7956
8009
|
createTestIdTransform(
|
|
7957
8010
|
componentName,
|
|
@@ -7962,6 +8015,7 @@ function createDevProcessorPlugin(options) {
|
|
|
7962
8015
|
{
|
|
7963
8016
|
existingIdBehavior: existingIdBehavior ?? "error",
|
|
7964
8017
|
nameCollisionBehavior,
|
|
8018
|
+
missingSemanticNameBehavior,
|
|
7965
8019
|
testIdAttribute,
|
|
7966
8020
|
warn: (message) => loggerRef.current.warn(message),
|
|
7967
8021
|
vueFilesPathMap: provisionalVuePathMap,
|
|
@@ -8709,6 +8763,7 @@ function createVuePluginWithTestIds(options) {
|
|
|
8709
8763
|
vueOptions,
|
|
8710
8764
|
existingIdBehavior,
|
|
8711
8765
|
nameCollisionBehavior,
|
|
8766
|
+
missingSemanticNameBehavior = "error",
|
|
8712
8767
|
nativeWrappers,
|
|
8713
8768
|
elementMetadata,
|
|
8714
8769
|
semanticNameMap,
|
|
@@ -8789,6 +8844,7 @@ function createVuePluginWithTestIds(options) {
|
|
|
8789
8844
|
existingIdBehavior,
|
|
8790
8845
|
testIdAttribute,
|
|
8791
8846
|
nameCollisionBehavior,
|
|
8847
|
+
missingSemanticNameBehavior,
|
|
8792
8848
|
warn: (message) => loggerRef.current.warn(message),
|
|
8793
8849
|
vueFilesPathMap,
|
|
8794
8850
|
wrapperSearchRoots: getWrapperSearchRoots()
|
|
@@ -8843,6 +8899,7 @@ function createVuePluginWithTestIds(options) {
|
|
|
8843
8899
|
existingIdBehavior,
|
|
8844
8900
|
testIdAttribute,
|
|
8845
8901
|
nameCollisionBehavior,
|
|
8902
|
+
missingSemanticNameBehavior,
|
|
8846
8903
|
warn: (message) => loggerRef.current.warn(message),
|
|
8847
8904
|
vueFilesPathMap,
|
|
8848
8905
|
wrapperSearchRoots: getWrapperSearchRoots()
|
|
@@ -8890,9 +8947,16 @@ function createVuePluginWithTestIds(options) {
|
|
|
8890
8947
|
const compile = compilerDom2.compile;
|
|
8891
8948
|
const { descriptor } = parse2(code, { filename: cleanPath });
|
|
8892
8949
|
if (descriptor.template) {
|
|
8950
|
+
const mergedExpressionPlugins = Array.from(
|
|
8951
|
+
/* @__PURE__ */ new Set([
|
|
8952
|
+
"typescript",
|
|
8953
|
+
...userCompilerOptions.expressionPlugins ?? []
|
|
8954
|
+
])
|
|
8955
|
+
);
|
|
8893
8956
|
compile(descriptor.template.content, {
|
|
8894
8957
|
...userCompilerOptions,
|
|
8895
8958
|
filename: cleanPath,
|
|
8959
|
+
expressionPlugins: mergedExpressionPlugins,
|
|
8896
8960
|
nodeTransforms: getNodeTransforms(cleanPath, componentName)
|
|
8897
8961
|
});
|
|
8898
8962
|
loggerRef.current.debug(`Metadata collected for ${cleanPath}`);
|
|
@@ -9189,6 +9253,7 @@ function createVuePomGeneratorPlugins(options = {}) {
|
|
|
9189
9253
|
customPomImportAliases: resolvedCustomPomImportAliases,
|
|
9190
9254
|
customPomImportNameCollisionBehavior: customPoms?.importNameCollisionBehavior,
|
|
9191
9255
|
nameCollisionBehavior: generationOptions?.nameCollisionBehavior,
|
|
9256
|
+
missingSemanticNameBehavior: generationOptions?.missingSemanticNameBehavior,
|
|
9192
9257
|
existingIdBehavior: resolvedInjectionOptions.existingIdBehavior,
|
|
9193
9258
|
testIdAttribute,
|
|
9194
9259
|
accessibilityAudit: generationOptions?.accessibilityAudit,
|
|
@@ -9277,6 +9342,7 @@ function createVuePomGeneratorPlugins(options = {}) {
|
|
|
9277
9342
|
vueOptions,
|
|
9278
9343
|
existingIdBehavior: resolvedGenerationOptions.existingIdBehavior,
|
|
9279
9344
|
nameCollisionBehavior: resolvedGenerationOptions.nameCollisionBehavior,
|
|
9345
|
+
missingSemanticNameBehavior: resolvedGenerationOptions.missingSemanticNameBehavior,
|
|
9280
9346
|
nativeWrappers,
|
|
9281
9347
|
elementMetadata,
|
|
9282
9348
|
semanticNameMap,
|