@nodii/dev 0.6.64 → 0.6.65

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/core.js CHANGED
@@ -4,7 +4,7 @@ import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
4
4
  import { homedir, platform } from "node:os";
5
5
  import { dirname, join } from "node:path";
6
6
 
7
- export const VERSION = "0.6.64";
7
+ export const VERSION = "0.6.65";
8
8
  export const configPath = () =>
9
9
  process.env.NODII_DEV_CONFIG_PATH ??
10
10
  join(homedir(), ".config/nodii-dev/config.json");
@@ -30,7 +30,7 @@
30
30
  // it until it returns [] (each round can reveal instances inside slot
31
31
  // content).
32
32
 
33
- export const VERSION = "1.0.10";
33
+ export const VERSION = "1.0.11";
34
34
 
35
35
  /** @typedef {{ nodeId: string, check: string, detail: string }} Finding */
36
36
  /**
@@ -628,6 +628,37 @@ export function checkConformance({
628
628
  for (const r of roles)
629
629
  for (const label of r.labels ?? [])
630
630
  labelRoles.set(label.trim().toLowerCase(), r);
631
+ // Labels that mark a role only inside named components: they win there.
632
+ const scopedLabels = new Map();
633
+ for (const r of roles)
634
+ for (const { labels, within } of r.labelsIn ?? [])
635
+ for (const label of labels) {
636
+ const key = label.trim().toLowerCase();
637
+ const scopes = scopedLabels.get(key) ?? [];
638
+ scopes.push({
639
+ role: r,
640
+ within: new Set(within.map((name) => name.trim().toLowerCase())),
641
+ });
642
+ scopedLabels.set(key, scopes);
643
+ }
644
+ const roleOfLabel = (a, n, label) => {
645
+ const scopes = scopedLabels.get(label);
646
+ if (scopes) {
647
+ const names = new Set();
648
+ for (const x of a.ancestors(n)) {
649
+ names.add(x.name?.toLowerCase());
650
+ const set = a.setOf({
651
+ componentId: x.type === "INSTANCE" ? x.componentId : x.id,
652
+ });
653
+ if (set?.name) names.add(set.name.toLowerCase());
654
+ }
655
+ const scoped = scopes.find((s) =>
656
+ [...s.within].some((name) => names.has(name))
657
+ );
658
+ if (scoped) return scoped.role;
659
+ }
660
+ return labelRoles.get(label);
661
+ };
631
662
  const librarySetNames = new Set();
632
663
  const usedRoles = new Set();
633
664
  const analyses = Object.values(nodes ?? {})
@@ -872,7 +903,7 @@ export function checkConformance({
872
903
  // (even one whose variant carries the label) and for a label it
873
904
  // overrode; a button a library block composes with its own label is
874
905
  // the library's (MW6-17).
875
- const role = labelRoles.get(text.toLowerCase());
906
+ const role = roleOfLabel(a, n, text.toLowerCase());
876
907
  if (role) {
877
908
  const up = a.ancestors(n);
878
909
  const holder = up
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/dev",
3
- "version": "0.6.64",
3
+ "version": "0.6.65",
4
4
  "description": "Agent CLI for Nodii Dev, reached through the platform edge",
5
5
  "type": "module",
6
6
  "bin": {