@nadicodeai/ui 12.1.2 → 12.1.3

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.
@@ -1,4 +1,5 @@
1
- import { readFileSync } from "node:fs";
1
+ import { createHash } from "node:crypto";
2
+ import { readdirSync, readFileSync } from "node:fs";
2
3
 
3
4
  import { menuCommandOwner } from "./rules/menu-command-owner.js";
4
5
  import { cardRowOwner } from "./rules/card-row-owner.js";
@@ -60,6 +61,31 @@ function readPublishedVersion() {
60
61
  );
61
62
  }
62
63
 
64
+ /**
65
+ * A digest of the plugin's own source. ESLint keys its lint cache on the resolved
66
+ * config, and a plugin enters that key only by name and version, which move on a
67
+ * release rather than on a rule edit. Configs carry this digest in `settings`, so
68
+ * a changed rule invalidates every cached result that ran under the old one.
69
+ */
70
+ export const rulesDigest = digestOf([
71
+ "index.js",
72
+ ...readdirSync(new URL("./rules/", import.meta.url))
73
+ .filter((name) => name.endsWith(".js") && !name.endsWith(".test.js"))
74
+ .sort()
75
+ .map((name) => `rules/${name}`),
76
+ ]);
77
+
78
+ function digestOf(paths) {
79
+ const hash = createHash("sha256");
80
+ for (const path of paths) {
81
+ hash
82
+ .update(path)
83
+ .update("\0")
84
+ .update(readFileSync(new URL(`./${path}`, import.meta.url)));
85
+ }
86
+ return hash.digest("hex").slice(0, 16);
87
+ }
88
+
63
89
  export const strictDesignSystemRules = {
64
90
  "nadicodeai/card-row-owner": "error",
65
91
  "nadicodeai/icon-control-accessible-name": "error",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nadicodeai/ui",
3
- "version": "12.1.2",
3
+ "version": "12.1.3",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -71,7 +71,7 @@
71
71
  "@assistant-ui/react": "0.15.21",
72
72
  "@assistant-ui/react-markdown": "0.14.16",
73
73
  "@base-ui/react": "^1.8.0",
74
- "@nadicodeai/design-system": "12.1.2",
74
+ "@nadicodeai/design-system": "12.1.3",
75
75
  "class-variance-authority": "^0.7.1",
76
76
  "clsx": "^2.1.1",
77
77
  "cmdk": "^1.1.1",