@immense/vue-pom-generator 1.0.76 → 1.0.78

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,63 +1,73 @@
1
- I'll verify which PRs actually fall in the stated merge window by checking their merge timestamps
2
- against the GitHub API, since the diff only shows one commit but many PRs are listed.
1
+ I'll verify which PRs actually fall within the release window by checking their merge timestamps via
2
+ the GitHub API.
3
3
 
4
- Let me try fetching PR data via the web_fetch tool.
4
+ Let me verify the v1.0.77 tag position relative to PR #36's merge.
5
5
 
6
- PR #35 merged at 22:02:36Z. The window in UTC is 21:58:43Z–22:02:36Z. Let me check the other PRs'
7
- merge times to see which actually fall in this window.
6
+ v1.0.77 points to #36's merge commit, confirming #36 belongs to the prior release. Only #37 (plus a
7
+ follow-up test commit) is in v1.0.78. Let me get the PR details and diff for accurate notes.
8
8
 
9
- Only PR #35 (22:02:36Z) and PR #34 (21:58:43Z) have merge times near the window (21:58:43Z–22:02:36Z
10
- UTC). All other PRs were merged days/weeks/months earlier. Let me check the git history to confirm
11
- what's actually between v1.0.75 and HEAD.
9
+ Let me check the plugin wiring changes to fully understand the feature.
12
10
 
13
- v1.0.75 points to the merge of PR #34. So v1.0.76 = v1.0.75 + PR #35 only. The long PR list includes
14
- all repo PRs, not just this release's. Let me read the actual changed files to write accurate
15
- notes.
11
+ I now have everything needed. Verification summary:
16
12
 
17
- I now have full context. v1.0.76 contains only PR #35 (the v1.0.75 tag is the merge of PR #34, so
18
- #34 and all earlier PRs belong to prior releases). Let me quickly check the test additions to
19
- accurately describe coverage.
13
+ - v1.0.77 tag = e5b00f4 (PR #36 merge), so #36 belongs to the prior release.
14
+ - Range v1.0.77..HEAD contains only #37's merge commit (03d66fa) plus a follow-up test fix
15
+ (d12efe7).
16
+ - The long PR list in the prompt spans months; only #37 falls in the release window and git range.
20
17
 
21
- I have everything I need. v1.0.76 contains exactly one PR (#35); all other listed PRs belong to
22
- prior releases (v1.0.75 tag = merge of #34). Here are the release notes:
18
+ -----------------------------------------------------------------------------------------------
23
19
 
24
20
  Highlights
25
21
 
26
- - New no-raw-playwright-apis ESLint rule — bans direct use of raw Playwright APIs in spec files,
27
- steering authors toward generated fixtures/POMs or custom POMs.
28
- - Flags raw locator query APIs (locator, getByRole, getByText, getByLabel) called anywhere in spec
29
- files.
30
- - Flags page-level selector/evaluation APIs (page.click, page.evaluate, page.waitForSelector,
31
- page.$eval, page.$$eval, page.isHidden, page.isVisible).
32
- - Detects legacy animateCursor* helper calls and reports them with a dedicated message.
33
- - Rule is scoped to spec files only (.spec.ts/.tsx, .spec.js/.jsx); non-spec files are unaffected.
34
- - Registered and exported from the ESLint plugin entry point alongside existing rules.
22
+ - Introduces a cross-file key registry so child components rendered inside keyed slot scopes (e.g.
23
+ <template #item="{ data, key }">) get automatically keyed testids
24
+ - Parent templates record which prop receives the slot-scope data; child components look up the
25
+ registry to key their internal testids (e.g. RolePermissionSubject-${subject.key ?? subject.id ??
26
+ …}-SelectAll-button)
27
+ - Relies on Rolldown's depth-first module processing to guarantee the parent is always compiled
28
+ before the child
29
+ - Threads the shared registry through both the build and dev plugin pipelines
30
+ - Adds new slot-scope variable extraction utilities plus positive/negative regression tests
35
31
 
36
32
  Changes
37
33
 
38
- ESLint rules
34
+ Cross-file key registry
39
35
 
40
- - Added eslint/no-raw-playwright-apis.ts — a new problem-type rule that reports raw Playwright API
41
- usage in spec files, encouraging generated POM methods instead.
42
- - Registered the rule as "no-raw-playwright-apis" in the plugin's rules map and exported
43
- noRawPlaywrightApisRule from eslint/index.ts.
36
+ - Added CrossFileKeyRegistry type (Map<string, string>) exported from transform.ts
37
+ - Parent transform records childComponentName → slotDataPropName when a component is rendered
38
+ inside a v-slot keyed scope
39
+ - Child transform consults the registry to build a keyed fallback expression when no in-file slot
40
+ key is found
44
41
 
45
- Tests
42
+ Plugin pipeline
43
+
44
+ - Threaded crossFileKeyRegistry through createVuePomGeneratorPlugins, createInternalPlugins, the
45
+ build processor, the dev processor, and the Vue plugin
46
+ - Build mode shares the registry across files; dev mode uses a provisional per-file key registry
47
+ - Added crossFileKeyRegistry to shared generator state
46
48
 
47
- - Added test coverage for the new rule in tests/eslint.test.ts, covering valid POM usage, non-spec
48
- file exemption, animateCursor detection, raw locator query APIs, and direct page selector APIs.
49
+ Utilities
49
50
 
50
- Breaking Changes
51
+ - New tryExtractSlotScopeVariableNames parses slot-scope bindings (simple identifiers, object
52
+ destructuring, aliases, rest elements)
53
+ - New getContainedInSlotTemplateNode walks the hierarchy map to the nearest enclosing scoped-slot
54
+ <template>
55
+ - Refactored getContainedInSlotDataKeyInfo to reuse getContainedInSlotTemplateNode
56
+ - Exported previously-internal helpers: findTemplateSlotScopeExpression,
57
+ buildSlotScopeFallbackKeyExpression, toResolvedKeyInfo, tryGetTemplateSlotScopeKeyInfo
58
+
59
+ Tests
51
60
 
52
- None. The new rule is opt-in and must be explicitly enabled in a consumer's ESLint config.
61
+ - Added transform tests for the cross-file key registry (keyed case and non-keyed negative case)
62
+ - Updated the vue-plugin-state test to include crossFileKeyRegistry in shared state
53
63
 
54
64
  Pull Requests Included
55
65
 
56
- - ]8;id=md-1gc948a;https://github.com/immense/vue-pom-generator/pull/35#35 — feat: add no-raw-playwright-apis ESLint rule]8;;]8;; (by @dkattan)]8;;
66
+ - #37 feat: cross-file key registry for child components in keyed slots — by @dkattan
67
+ (]8;id=md-1fs9wuc;https://github.com/immense/vue-pom-generator/pull/37https://github.com/immense/vue-pom-generator/pull/37]8;;]8;;)]8;;
57
68
 
58
69
  Testing
59
70
 
60
- New RuleTester cases were added for no-raw-playwright-apis covering valid generated-fixture usage,
61
- non-spec file exemption, legacy cursor helper detection, raw locator queries, and direct page
62
- selector APIs. No existing tests were modified beyond the import addition.
71
+ All 204 tests pass per PR #37, including new cross-file key registry regression tests covering both
72
+ the keyed and non-keyed cases.
63
73
 
package/dist/index.cjs CHANGED
@@ -1519,6 +1519,31 @@ function tryGetTemplateSlotScopeKeyInfo(expression) {
1519
1519
  const candidateExpression = bindingNode ? tryGetSlotScopeKeyCandidate(bindingNode)?.expression ?? null : null;
1520
1520
  return candidateExpression ? toResolvedKeyInfo(candidateExpression) : null;
1521
1521
  }
1522
+ function tryExtractSlotScopeVariableNames(expression) {
1523
+ const bindingNode = tryGetTemplateSlotScopeBindingNode(expression);
1524
+ if (!bindingNode) {
1525
+ return [];
1526
+ }
1527
+ if (types.isIdentifier(bindingNode)) {
1528
+ return [bindingNode.name];
1529
+ }
1530
+ if (!types.isObjectPattern(bindingNode)) {
1531
+ return [];
1532
+ }
1533
+ const names = [];
1534
+ for (const property of bindingNode.properties) {
1535
+ if (types.isRestElement(property)) {
1536
+ const argName = tryGetBindingIdentifierName(property.argument);
1537
+ if (argName) names.push(argName);
1538
+ } else if (types.isObjectProperty(property)) {
1539
+ const bindingName = tryGetBindingIdentifierName(property.value) ?? tryGetBindingIdentifierName(property.key);
1540
+ if (bindingName) {
1541
+ names.push(bindingName);
1542
+ }
1543
+ }
1544
+ }
1545
+ return names;
1546
+ }
1522
1547
  function nodeHasToDirective(node) {
1523
1548
  const toDirective = findDirectiveByName(node, "bind", "to");
1524
1549
  if (toDirective?.exp) {
@@ -1701,12 +1726,21 @@ function getStaticIdOrNameHint(node) {
1701
1726
  return identifier;
1702
1727
  }
1703
1728
  function getContainedInSlotDataKeyInfo(node, hierarchyMap2) {
1729
+ const templateNode = getContainedInSlotTemplateNode(node, hierarchyMap2);
1730
+ if (templateNode) {
1731
+ const slotScopeExpression = findTemplateSlotScopeExpression(templateNode);
1732
+ if (slotScopeExpression) {
1733
+ return tryGetTemplateSlotScopeKeyInfo(slotScopeExpression);
1734
+ }
1735
+ }
1736
+ return null;
1737
+ }
1738
+ function getContainedInSlotTemplateNode(node, hierarchyMap2) {
1704
1739
  let parent = getParent(hierarchyMap2, node);
1705
1740
  while (parent) {
1706
1741
  if (parent.type === compilerCore.NodeTypes.ELEMENT && parent.tag === "template") {
1707
- const slotScopeExpression = findTemplateSlotScopeExpression(parent);
1708
- if (slotScopeExpression) {
1709
- return tryGetTemplateSlotScopeKeyInfo(slotScopeExpression);
1742
+ if (findTemplateSlotScopeExpression(parent)) {
1743
+ return parent;
1710
1744
  }
1711
1745
  }
1712
1746
  parent = getParent(hierarchyMap2, parent);
@@ -7259,6 +7293,7 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
7259
7293
  const vueFilesPathMap = options.vueFilesPathMap;
7260
7294
  const wrapperSearchRoots = options.wrapperSearchRoots ?? [];
7261
7295
  const annotatorMetadata = options.annotatorMetadata ?? null;
7296
+ const crossFileKeyRegistry = options.crossFileKeyRegistry;
7262
7297
  const safeRealpath2 = (p) => {
7263
7298
  try {
7264
7299
  return fs.existsSync(p) ? fs.realpathSync(p) : p;
@@ -7357,7 +7392,8 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
7357
7392
  (p) => p.type === compilerCore.NodeTypes.DIRECTIVE && p.name === "bind" && p.arg?.type === compilerCore.NodeTypes.SIMPLE_EXPRESSION && p.arg.content === testIdAttribute && !!p.exp
7358
7393
  );
7359
7394
  }
7360
- const parentElement = !parentIsRoot && context?.parent?.type === compilerCore.NodeTypes.ELEMENT ? context.parent : null;
7395
+ const grandParent = context.grandParent;
7396
+ const parentElement = !parentIsRoot && context?.parent?.type === compilerCore.NodeTypes.ELEMENT ? context.parent : !parentIsRoot && grandParent?.type === compilerCore.NodeTypes.ELEMENT ? grandParent : null;
7361
7397
  hierarchyMap.set(element, parentElement);
7362
7398
  const normalizeFilePath = (filePath) => path.normalize(safeRealpath2(path.resolve(filePath)));
7363
7399
  const normalizedFilePath = normalizeFilePath(context.filename);
@@ -7387,6 +7423,31 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
7387
7423
  };
7388
7424
  if (isComponentLikeTag(element.tag)) {
7389
7425
  dependencies.usedComponentSet.add(element.tag);
7426
+ if (crossFileKeyRegistry && context.scopes.vSlot > 0) {
7427
+ const findSlotTemplate = () => {
7428
+ const gp = context.grandParent;
7429
+ if (gp?.type === compilerCore.NodeTypes.ELEMENT && gp.tag === "template") {
7430
+ return gp;
7431
+ }
7432
+ return getContainedInSlotTemplateNode(element, hierarchyMap);
7433
+ };
7434
+ const slotTemplate = findSlotTemplate();
7435
+ if (slotTemplate) {
7436
+ const slotScopeExpression = findTemplateSlotScopeExpression(slotTemplate);
7437
+ if (slotScopeExpression) {
7438
+ const slotVarNames = tryExtractSlotScopeVariableNames(slotScopeExpression);
7439
+ if (slotVarNames.length > 0) {
7440
+ for (const prop of element.props) {
7441
+ if (prop.type === compilerCore.NodeTypes.DIRECTIVE && prop.name === "bind" && prop.arg?.type === compilerCore.NodeTypes.SIMPLE_EXPRESSION && prop.exp?.type === compilerCore.NodeTypes.SIMPLE_EXPRESSION && slotVarNames.includes(prop.exp.content)) {
7442
+ const propName = prop.arg.content;
7443
+ crossFileKeyRegistry.set(element.tag, propName);
7444
+ break;
7445
+ }
7446
+ }
7447
+ }
7448
+ }
7449
+ }
7450
+ }
7390
7451
  }
7391
7452
  if (!nativeWrappers[element.tag]) {
7392
7453
  const inferred = tryInferNativeWrapperRoleFromSfc(element.tag, vueFilesPathMap, wrapperSearchRoots);
@@ -7405,7 +7466,18 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
7405
7466
  if (vForKeyInfo) {
7406
7467
  return vForKeyInfo;
7407
7468
  }
7408
- return getContainedInSlotDataKeyInfo(element, hierarchyMap);
7469
+ const slotKeyInfo = getContainedInSlotDataKeyInfo(element, hierarchyMap);
7470
+ if (slotKeyInfo) {
7471
+ return slotKeyInfo;
7472
+ }
7473
+ if (crossFileKeyRegistry) {
7474
+ const propName = crossFileKeyRegistry.get(componentName);
7475
+ if (propName) {
7476
+ const fallbackExpr = buildSlotScopeFallbackKeyExpression(propName);
7477
+ return toResolvedKeyInfo(fallbackExpr, fallbackExpr);
7478
+ }
7479
+ }
7480
+ return null;
7409
7481
  };
7410
7482
  const bestKeyInfo = getBestAvailableKeyInfo();
7411
7483
  const bestKeyPlaceholder = bestKeyInfo?.selectorFragment ?? null;
@@ -7753,6 +7825,7 @@ function isLessRich(candidate, previous) {
7753
7825
  function createBuildProcessorPlugin(options) {
7754
7826
  const {
7755
7827
  componentHierarchyMap,
7828
+ crossFileKeyRegistry,
7756
7829
  vueFilesPathMap,
7757
7830
  getPageDirs,
7758
7831
  getComponentDirs,
@@ -7895,7 +7968,8 @@ function createBuildProcessorPlugin(options) {
7895
7968
  missingSemanticNameBehavior,
7896
7969
  warn: (message) => loggerRef.current.warn(message),
7897
7970
  vueFilesPathMap,
7898
- wrapperSearchRoots: getWrapperSearchRoots()
7971
+ wrapperSearchRoots: getWrapperSearchRoots(),
7972
+ crossFileKeyRegistry
7899
7973
  }
7900
7974
  )
7901
7975
  ]
@@ -8218,6 +8292,7 @@ function createDevProcessorPlugin(options) {
8218
8292
  }
8219
8293
  const { bindings: bindingMetadata, isScriptSetup } = getScriptInfo(sfc, absolutePath);
8220
8294
  const provisionalHierarchy = /* @__PURE__ */ new Map();
8295
+ const provisionalKeyRegistry = /* @__PURE__ */ new Map();
8221
8296
  const provisionalVuePathMap = new Map(targetVuePathMap);
8222
8297
  provisionalVuePathMap.set(componentName, absolutePath);
8223
8298
  compilerDom__namespace.compile(template, {
@@ -8245,7 +8320,8 @@ function createDevProcessorPlugin(options) {
8245
8320
  testIdAttribute,
8246
8321
  warn: (message) => loggerRef.current.warn(message),
8247
8322
  vueFilesPathMap: provisionalVuePathMap,
8248
- wrapperSearchRoots: getWrapperSearchRoots()
8323
+ wrapperSearchRoots: getWrapperSearchRoots(),
8324
+ crossFileKeyRegistry: provisionalKeyRegistry
8249
8325
  }
8250
8326
  )
8251
8327
  ]
@@ -8769,6 +8845,7 @@ ${code}`,
8769
8845
  function createInternalPlugins(options) {
8770
8846
  const {
8771
8847
  componentHierarchyMap,
8848
+ crossFileKeyRegistry,
8772
8849
  elementMetadata,
8773
8850
  vueFilesPathMap,
8774
8851
  nativeWrappers,
@@ -8824,6 +8901,7 @@ function createInternalPlugins(options) {
8824
8901
  const normalizedBasePagePath = path.posix.normalize(basePageClassPath);
8825
8902
  const tsProcessor = createBuildProcessorPlugin({
8826
8903
  componentHierarchyMap,
8904
+ crossFileKeyRegistry,
8827
8905
  vueFilesPathMap,
8828
8906
  getPageDirs,
8829
8907
  getComponentDirs,
@@ -9049,6 +9127,7 @@ function createVuePluginWithTestIds(options) {
9049
9127
  elementMetadata,
9050
9128
  semanticNameMap,
9051
9129
  componentHierarchyMap,
9130
+ crossFileKeyRegistry,
9052
9131
  vueFilesPathMap,
9053
9132
  excludedComponents,
9054
9133
  getViewsDirAbs,
@@ -9118,7 +9197,8 @@ function createVuePluginWithTestIds(options) {
9118
9197
  warn: (message) => loggerRef.current.warn(message),
9119
9198
  vueFilesPathMap,
9120
9199
  wrapperSearchRoots: getWrapperSearchRoots(),
9121
- annotatorMetadata
9200
+ annotatorMetadata,
9201
+ crossFileKeyRegistry
9122
9202
  }
9123
9203
  )
9124
9204
  );
@@ -9174,7 +9254,8 @@ function createVuePluginWithTestIds(options) {
9174
9254
  warn: (message) => loggerRef.current.warn(message),
9175
9255
  vueFilesPathMap,
9176
9256
  wrapperSearchRoots: getWrapperSearchRoots(),
9177
- annotatorMetadata
9257
+ annotatorMetadata,
9258
+ crossFileKeyRegistry
9178
9259
  }
9179
9260
  );
9180
9261
  perFileTransform.set(componentName, transform);
@@ -9418,6 +9499,7 @@ function getSharedGeneratorState(key) {
9418
9499
  elementMetadata: /* @__PURE__ */ new Map(),
9419
9500
  semanticNameMap: /* @__PURE__ */ new Map(),
9420
9501
  componentHierarchyMap: /* @__PURE__ */ new Map(),
9502
+ crossFileKeyRegistry: /* @__PURE__ */ new Map(),
9421
9503
  vueFilesPathMap: /* @__PURE__ */ new Map()
9422
9504
  };
9423
9505
  sharedGeneratorStateRegistry.set(key, state);
@@ -9632,7 +9714,7 @@ function createVuePomGeneratorPlugins(options = {}) {
9632
9714
  };
9633
9715
  const getViewsDirAbs = () => resolveFromProjectRoot(projectRootRef.current, getViewsDir());
9634
9716
  const getWrapperSearchRootsAbs = () => getWrapperSearchRoots().map((root) => resolveFromProjectRoot(projectRootRef.current, root));
9635
- const { elementMetadata, semanticNameMap, componentHierarchyMap, vueFilesPathMap } = sharedState;
9717
+ const { elementMetadata, semanticNameMap, componentHierarchyMap, crossFileKeyRegistry, vueFilesPathMap } = sharedState;
9636
9718
  const { metadataCollectorPlugin, internalVuePlugin, templateCompilerOptions } = createVuePluginWithTestIds({
9637
9719
  vueOptions,
9638
9720
  existingIdBehavior: resolvedGenerationOptions.existingIdBehavior,
@@ -9642,6 +9724,7 @@ function createVuePomGeneratorPlugins(options = {}) {
9642
9724
  elementMetadata,
9643
9725
  semanticNameMap,
9644
9726
  componentHierarchyMap,
9727
+ crossFileKeyRegistry,
9645
9728
  vueFilesPathMap,
9646
9729
  excludedComponents,
9647
9730
  getViewsDirAbs,
@@ -9659,6 +9742,7 @@ function createVuePomGeneratorPlugins(options = {}) {
9659
9742
  templateCompilerOptionsForResolvedPlugin = templateCompilerOptions;
9660
9743
  const internalPlugins = createInternalPlugins({
9661
9744
  componentHierarchyMap,
9745
+ crossFileKeyRegistry,
9662
9746
  elementMetadata,
9663
9747
  vueFilesPathMap,
9664
9748
  nativeWrappers,