@immense/vue-pom-generator 1.0.63 → 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/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
@@ -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,
@@ -7035,6 +7036,7 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
7035
7036
  const existingIdBehavior = options.existingIdBehavior ?? "error";
7036
7037
  const testIdAttribute = (options.testIdAttribute || "data-testid").trim() || "data-testid";
7037
7038
  const nameCollisionBehavior = options.nameCollisionBehavior ?? "error";
7039
+ const missingSemanticNameBehavior = options.missingSemanticNameBehavior ?? "error";
7038
7040
  const warn = options.warn;
7039
7041
  const vueFilesPathMap = options.vueFilesPathMap;
7040
7042
  const wrapperSearchRoots = options.wrapperSearchRoots ?? [];
@@ -7478,13 +7480,16 @@ Fix: remove the explicit ${attrLabel}, or change existingIdBehavior to "overwrit
7478
7480
  }
7479
7481
  const isSubmit = element.props.find((p) => p.type === NodeTypes.ATTRIBUTE && p.name === "type")?.value?.content === "submit";
7480
7482
  if (isSubmit) {
7481
- const identifier = getStaticIdOrNameHint(element) || innerText;
7483
+ let identifier = getStaticIdOrNameHint(element) || innerText;
7482
7484
  if (!identifier) {
7483
- const loc = element.loc?.start;
7484
- const locationHint = loc ? `${loc.line}:${loc.column}` : "unknown";
7485
- throw new Error(
7486
- `[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`
7487
- );
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";
7488
7493
  }
7489
7494
  const testId = getSubmitDataTestId(identifier);
7490
7495
  applyResolvedDataTestIdForElement({
@@ -7551,6 +7556,7 @@ function createBuildProcessorPlugin(options) {
7551
7556
  customPomImportNameCollisionBehavior,
7552
7557
  testIdAttribute,
7553
7558
  nameCollisionBehavior,
7559
+ missingSemanticNameBehavior,
7554
7560
  existingIdBehavior,
7555
7561
  routerAwarePoms,
7556
7562
  routerType,
@@ -7646,6 +7652,9 @@ function createBuildProcessorPlugin(options) {
7646
7652
  prefixIdentifiers: true,
7647
7653
  inline: isScriptSetup,
7648
7654
  bindingMetadata,
7655
+ // See dev-plugin.ts — same rationale: enable TS in template
7656
+ // expressions so `(row: RowType) => ...` handlers parse.
7657
+ expressionPlugins: ["typescript"],
7649
7658
  nodeTransforms: [
7650
7659
  createTestIdTransform(
7651
7660
  componentName,
@@ -7657,6 +7666,7 @@ function createBuildProcessorPlugin(options) {
7657
7666
  existingIdBehavior: existingIdBehavior ?? "error",
7658
7667
  testIdAttribute,
7659
7668
  nameCollisionBehavior,
7669
+ missingSemanticNameBehavior,
7660
7670
  warn: (message) => loggerRef.current.warn(message),
7661
7671
  vueFilesPathMap,
7662
7672
  wrapperSearchRoots: getWrapperSearchRoots()
@@ -7804,6 +7814,7 @@ function createDevProcessorPlugin(options) {
7804
7814
  customPomImportAliases,
7805
7815
  customPomImportNameCollisionBehavior,
7806
7816
  nameCollisionBehavior,
7817
+ missingSemanticNameBehavior,
7807
7818
  existingIdBehavior,
7808
7819
  testIdAttribute,
7809
7820
  routerAwarePoms,
@@ -7988,6 +7999,12 @@ function createDevProcessorPlugin(options) {
7988
7999
  prefixIdentifiers: true,
7989
8000
  inline: isScriptSetup,
7990
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"],
7991
8008
  nodeTransforms: [
7992
8009
  createTestIdTransform(
7993
8010
  componentName,
@@ -7998,6 +8015,7 @@ function createDevProcessorPlugin(options) {
7998
8015
  {
7999
8016
  existingIdBehavior: existingIdBehavior ?? "error",
8000
8017
  nameCollisionBehavior,
8018
+ missingSemanticNameBehavior,
8001
8019
  testIdAttribute,
8002
8020
  warn: (message) => loggerRef.current.warn(message),
8003
8021
  vueFilesPathMap: provisionalVuePathMap,
@@ -8745,6 +8763,7 @@ function createVuePluginWithTestIds(options) {
8745
8763
  vueOptions,
8746
8764
  existingIdBehavior,
8747
8765
  nameCollisionBehavior,
8766
+ missingSemanticNameBehavior = "error",
8748
8767
  nativeWrappers,
8749
8768
  elementMetadata,
8750
8769
  semanticNameMap,
@@ -8825,6 +8844,7 @@ function createVuePluginWithTestIds(options) {
8825
8844
  existingIdBehavior,
8826
8845
  testIdAttribute,
8827
8846
  nameCollisionBehavior,
8847
+ missingSemanticNameBehavior,
8828
8848
  warn: (message) => loggerRef.current.warn(message),
8829
8849
  vueFilesPathMap,
8830
8850
  wrapperSearchRoots: getWrapperSearchRoots()
@@ -8879,6 +8899,7 @@ function createVuePluginWithTestIds(options) {
8879
8899
  existingIdBehavior,
8880
8900
  testIdAttribute,
8881
8901
  nameCollisionBehavior,
8902
+ missingSemanticNameBehavior,
8882
8903
  warn: (message) => loggerRef.current.warn(message),
8883
8904
  vueFilesPathMap,
8884
8905
  wrapperSearchRoots: getWrapperSearchRoots()
@@ -8926,9 +8947,16 @@ function createVuePluginWithTestIds(options) {
8926
8947
  const compile = compilerDom2.compile;
8927
8948
  const { descriptor } = parse2(code, { filename: cleanPath });
8928
8949
  if (descriptor.template) {
8950
+ const mergedExpressionPlugins = Array.from(
8951
+ /* @__PURE__ */ new Set([
8952
+ "typescript",
8953
+ ...userCompilerOptions.expressionPlugins ?? []
8954
+ ])
8955
+ );
8929
8956
  compile(descriptor.template.content, {
8930
8957
  ...userCompilerOptions,
8931
8958
  filename: cleanPath,
8959
+ expressionPlugins: mergedExpressionPlugins,
8932
8960
  nodeTransforms: getNodeTransforms(cleanPath, componentName)
8933
8961
  });
8934
8962
  loggerRef.current.debug(`Metadata collected for ${cleanPath}`);
@@ -9225,6 +9253,7 @@ function createVuePomGeneratorPlugins(options = {}) {
9225
9253
  customPomImportAliases: resolvedCustomPomImportAliases,
9226
9254
  customPomImportNameCollisionBehavior: customPoms?.importNameCollisionBehavior,
9227
9255
  nameCollisionBehavior: generationOptions?.nameCollisionBehavior,
9256
+ missingSemanticNameBehavior: generationOptions?.missingSemanticNameBehavior,
9228
9257
  existingIdBehavior: resolvedInjectionOptions.existingIdBehavior,
9229
9258
  testIdAttribute,
9230
9259
  accessibilityAudit: generationOptions?.accessibilityAudit,
@@ -9313,6 +9342,7 @@ function createVuePomGeneratorPlugins(options = {}) {
9313
9342
  vueOptions,
9314
9343
  existingIdBehavior: resolvedGenerationOptions.existingIdBehavior,
9315
9344
  nameCollisionBehavior: resolvedGenerationOptions.nameCollisionBehavior,
9345
+ missingSemanticNameBehavior: resolvedGenerationOptions.missingSemanticNameBehavior,
9316
9346
  nativeWrappers,
9317
9347
  elementMetadata,
9318
9348
  semanticNameMap,