@immense/vue-pom-generator 1.0.82 → 1.0.83

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 CHANGED
@@ -1,72 +1,50 @@
1
- I'll verify the actual commits in the release range and check PR merge times to accurately identify
2
- what's included in v1.0.82.
3
-
4
- Now I understand the timeline. v1.0.81 = commit c74f482 (#44, merged 06:21:57 CDT), and HEAD =
5
- 7641d3f (#43, merged 08:15:13 CDT). So only PR #43 is in this release. Let me examine the actual
6
- diff to write accurate notes.
7
-
8
- Now I have a complete picture. Only PR #43 is in the v1.0.81..HEAD range. Let me write the release
9
- notes.
1
+ Only PR #45 falls in the git range v1.0.82..HEAD (confirmed by git log), with no release-bump commit
2
+ to exclude. The long PR list spans prior releases; the 9-minute window and the diffstat both point
3
+ to #45 alone. Here are the release notes:
10
4
 
11
5
  Highlights
12
6
 
13
- - New link native role for anchor-rendering wrappers — components that render <a> (with href) or
14
- RouterLink are now classified as link, producing ...Link accessors and -link test-id suffixes
15
- - role is now optional on nativeWrappers config — when omitted, the generator infers it from the
16
- wrapper's rendered template, recursing through nested wrapper components
17
- - Fail-fast on unresolvable roles — if role is omitted and no native role can be inferred from the
18
- template, the generator throws an actionable error instead of silently defaulting
19
- - Correct ARIA semantics — a bare <a> without href is not treated as link (no implicit ARIA role),
20
- preventing misclassification of anchor placeholders or anchor-styled buttons
7
+ - Pure refactor, no behavior changes — consolidates annotator display-text helpers and normalizes
8
+ the export surface.
9
+ - Extracts shared display-text normalization into a new annotator/text-utils.ts, eliminating two
10
+ duplicate inline copies.
11
+ - Exposes pure annotator string helpers via an __internal export to enable direct unit testing.
12
+ - Renames splitDiscoverabilityWords/joinDiscoverabilityWords to the shorter splitWords/joinWords
13
+ with @example TSDoc.
14
+ - Adds @example TSDoc to annotator helper functions for improved discoverability.
21
15
 
22
16
  Changes
23
17
 
24
- Role inference & link support
25
-
26
- - Added link to the NativeRole union type (utils.ts)
27
- - NativeWrappersMap[...].role is now optional; the transform infers it from the component's
28
- rendered template when omitted (utils.ts, transform.ts)
29
- - tryInferNativeWrapperRoleFromSfc now recognizes <a>/<ua> with an href (static or :href bind) and
30
- RouterLink as link, recursing through nested wrapper components (transform.ts)
31
- - formatTagName, getNativeWrapperTransformInfo, applyResolvedDataTestId, and
32
- STANDALONE_WRAPPER_FALLBACK_ROLES updated to handle the link role (utils.ts)
33
- - When a declared wrapper omits role and inference fails, the transform throws with a precise error
34
- including file/line context (transform.ts)
35
- - getNativeWrapperTransformInfo and formatTagName fail fast if called directly with an unresolved
36
- (role-less) config (utils.ts)
37
-
38
- Cleanup & maintenance
18
+ Annotator runtime (plugin/runtime/annotator/)
39
19
 
40
- - Removed unused destructured options from createInternalPlugins (plugin/internal-plugins.ts)
41
- - Removed unused requireEvent parameter from BasePage click-event evaluation
42
- (class-generation/base-page.ts)
43
- - Narrowed writeConstJson parameter type in manifest generator (manifest-generator.ts)
44
- - Replaced .some(c => x === c) with .includes(x) in applyResolvedDataTestId (utils.ts)
45
- - Added no-restricted-syntax ESLint disable/enable annotations for regex usage on non-source-code
46
- strings (UI text, paths, CSS tokens) across compiler-metadata-utils.ts, pom-discoverability.ts,
47
- pom-patterns.ts, and the annotator runtime (client.ts, format.ts, plugin.ts, vue-detector.ts)
48
- - Removed dead :data-testid directive capture block in createTestIdTransform (transform.ts)
20
+ - Added text-utils.ts housing normalizeInlineText, now shared by client.ts and format.ts (replaces
21
+ duplicated inline copies).
22
+ - Added normalizePathSeparators to the annotator plugin.
23
+ - Exposed pure helpers — placementPrimarySide, stripSourcePosition, inferNameFromFile,
24
+ isComponentLikeSourceTag, formatSourceLabel, ignoredComponentNamePattern — via a __internal export
25
+ for unit tests.
26
+ - Added @example TSDoc to stripSourcePosition, inferNameFromFile, isComponentLikeSourceTag,
27
+ formatSourceLabel, and ignoredComponentNamePattern in vue-detector.ts.
49
28
 
50
- Documentation
29
+ POM discoverability (pom-discoverability.ts)
51
30
 
52
- - Updated README to document the link role, optional/inferred role behavior, and expanded inference
53
- list (README.md)
31
+ - Renamed splitDiscoverabilityWords → splitWords and joinDiscoverabilityWords → joinWords; updated
32
+ all internal call sites (humanizePomMethodName, humanizePomComponentName,
33
+ buildPomLocatorDescription).
34
+ - Added @example TSDoc to both renamed functions.
54
35
 
55
36
  Breaking Changes
56
37
 
57
- - nativeWrappers[...].role is now optional — previously required. Existing configs that declare
58
- role are unaffected. Configs that omit role will now trigger inference (or a fail-fast error if no
59
- role can be inferred) instead of a type error.
38
+ None. This is a pure refactor with no behavior changes; renamed helpers were internal-only with no
39
+ external callers.
60
40
 
61
41
  Pull Requests Included
62
42
 
63
- - ]8;id=md-f68cdn;https://github.com/immense/vue-pom-generator/pull/43#43 feat: infer link role for anchor-rendering wrappers]8;;]8;; (by @dkattan)]8;;
43
+ - ]8;id=md-gu5yjh;https://github.com/immense/vue-pom-generator/pull/45#45 — refactor: consolidate annotator display-text helpers and normalize export surface]8;;]8;; ]8;;
44
+ (@dkattan)
64
45
 
65
46
  Testing
66
47
 
67
- - Added 4 tests in tests/transform.test.ts: link role inference from a rendered <a> with :href,
68
- inference through nested wrapper components via RouterLink, refusal to infer link from a bare <a>
69
- without href (throws), and fail-fast when role can't be inferred from a non-native element (<div>)
70
- - Added 1 test in tests/utils-coverage.test.ts verifying getNativeWrapperTransformInfo throws on
71
- unresolved role-less configs
48
+ No new tests added. As a pure refactor preserving existing behavior, the unchanged functionality
49
+ remains covered by the existing test suite.
72
50
 
package/dist/index.cjs CHANGED
@@ -602,14 +602,14 @@ function uniquePomStringPatterns(primary, alternates) {
602
602
  }
603
603
  return out;
604
604
  }
605
- function splitDiscoverabilityWords(value) {
605
+ function splitWords(value) {
606
606
  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();
607
607
  if (!normalized) {
608
608
  return [];
609
609
  }
610
610
  return normalized.split(/\s+/).map((word) => word.toLowerCase()).filter(Boolean);
611
611
  }
612
- function joinDiscoverabilityWords(words) {
612
+ function joinWords(words) {
613
613
  return words.join(" ").replace(/\s+/g, " ").trim();
614
614
  }
615
615
  function toSentenceCase(value) {
@@ -641,7 +641,7 @@ function removeTrailingRoleWord(words, roleWord) {
641
641
  return words.slice(0, -1);
642
642
  }
643
643
  function humanizePomMethodName(methodName) {
644
- return joinDiscoverabilityWords(splitDiscoverabilityWords(methodName));
644
+ return joinWords(splitWords(methodName));
645
645
  }
646
646
  function stripPomActionPrefix(actionName) {
647
647
  for (const prefix of ["click", "select", "type", "goTo"]) {
@@ -658,13 +658,13 @@ function normalizePomRoleLabel(nativeRole) {
658
658
  return nativeRole || "element";
659
659
  }
660
660
  function buildPomLocatorDescription(args) {
661
- const componentWords = splitDiscoverabilityWords(args.componentName ? stripComponentKindSuffix(args.componentName) : "");
661
+ const componentWords = splitWords(args.componentName ? stripComponentKindSuffix(args.componentName) : "");
662
662
  const roleWord = normalizePomRoleLabel(args.nativeRole).toLowerCase();
663
663
  const semanticWords = removeLeadingWords(
664
- removeTrailingRoleWord(splitDiscoverabilityWords(args.methodName), roleWord),
664
+ removeTrailingRoleWord(splitWords(args.methodName), roleWord),
665
665
  componentWords
666
666
  );
667
- const phrase = joinDiscoverabilityWords([
667
+ const phrase = joinWords([
668
668
  ...componentWords,
669
669
  ...semanticWords,
670
670
  roleWord
@@ -8907,8 +8907,11 @@ const DEFAULT_ENTRY_SUFFIXES = [
8907
8907
  "/src/main.tsx",
8908
8908
  "/src/main.jsx"
8909
8909
  ];
8910
+ function normalizePathSeparators(filePath) {
8911
+ return filePath.replace(/\\/g, "/");
8912
+ }
8910
8913
  function toFsImportPath(filePath) {
8911
- return `/@fs/${filePath.replace(/\\/g, "/")}`;
8914
+ return `/@fs/${normalizePathSeparators(filePath)}`;
8912
8915
  }
8913
8916
  function resolveAnnotatorClientPath() {
8914
8917
  const candidates = [
@@ -8953,7 +8956,7 @@ function createAnnotatorUiPlugin(options) {
8953
8956
  if (!options.enabled) {
8954
8957
  return null;
8955
8958
  }
8956
- const normalizedId = id.replace(/\\/g, "/");
8959
+ const normalizedId = normalizePathSeparators(id);
8957
8960
  if (!DEFAULT_ENTRY_SUFFIXES.some((suffix) => normalizedId.endsWith(suffix))) {
8958
8961
  return null;
8959
8962
  }
@@ -10499,10 +10502,6 @@ const SHORTCUT_LABELS = {
10499
10502
  settings: ",",
10500
10503
  cancel: "Esc"
10501
10504
  };
10502
- function normalizeText(value) {
10503
- const normalized = value?.replace(/\s+/g, " ").trim();
10504
- return normalized || void 0;
10505
- }
10506
10505
  function formatShortcutTitle(label, shortcut) {
10507
10506
  return shortcut ? `${label} (${shortcut})` : label;
10508
10507
  }
@@ -10543,11 +10542,11 @@ function getElementPath(element) {
10543
10542
  return segments.join(" > ");
10544
10543
  }
10545
10544
  function getNearbyText(element) {
10546
- const ownText = normalizeText(element.textContent || void 0);
10545
+ const ownText = normalizeInlineText(element.textContent || void 0);
10547
10546
  if (ownText && ownText.length >= 2) {
10548
10547
  return ownText.length > 160 ? `${ownText.slice(0, 160)}...` : ownText;
10549
10548
  }
10550
- const parentText = normalizeText(element.parentElement?.textContent || void 0);
10549
+ const parentText = normalizeInlineText(element.parentElement?.textContent || void 0);
10551
10550
  if (parentText) {
10552
10551
  return parentText.length > 160 ? `${parentText.slice(0, 160)}...` : parentText;
10553
10552
  }
@@ -10570,6 +10569,9 @@ function createFloatingArrow() {
10570
10569
  function toCssPixels(value) {
10571
10570
  return `${Math.round(value)}px`;
10572
10571
  }
10572
+ function placementPrimarySide(placement) {
10573
+ return placement.split("-")[0];
10574
+ }
10573
10575
  function clamp(value, min, max) {
10574
10576
  return Math.min(Math.max(value, min), max);
10575
10577
  }
@@ -11058,7 +11060,7 @@ class AnnotatorRuntime {
11058
11060
  panel.style.top = toCssPixels(result.y);
11059
11061
  panel.style.visibility = "visible";
11060
11062
  const arrowData = result.middlewareData.arrow;
11061
- const side = result.placement.split("-")[0];
11063
+ const side = placementPrimarySide(result.placement);
11062
11064
  const staticSide = side === "top" ? "bottom" : side === "bottom" ? "top" : side === "left" ? "right" : "left";
11063
11065
  arrowEl.style.removeProperty("top");
11064
11066
  arrowEl.style.removeProperty("right");