tokvista 1.11.2 → 1.12.1
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/bin/tokvista.js +7 -6
- package/package.json +1 -1
package/dist/bin/tokvista.js
CHANGED
|
@@ -1099,18 +1099,19 @@ function isTokenLike5(obj) {
|
|
|
1099
1099
|
}
|
|
1100
1100
|
function validateTokenStructure(tokens) {
|
|
1101
1101
|
const issues = [];
|
|
1102
|
-
function walk(node, path2 = [],
|
|
1102
|
+
function walk(node, path2 = [], category = "") {
|
|
1103
1103
|
if (!isRecord7(node)) return;
|
|
1104
1104
|
if (path2.length === 0 && Object.keys(node).some((k) => k.includes("/"))) {
|
|
1105
|
-
Object.
|
|
1105
|
+
Object.entries(node).forEach(([key, val]) => {
|
|
1106
|
+
const cat = key.toLowerCase().includes("semantic") ? "semantic" : key.toLowerCase().includes("component") ? "component" : "";
|
|
1107
|
+
walk(val, [], cat);
|
|
1108
|
+
});
|
|
1106
1109
|
return;
|
|
1107
1110
|
}
|
|
1108
1111
|
if (isTokenLike5(node)) {
|
|
1109
1112
|
const tokenPath = path2.join(".");
|
|
1110
1113
|
const value = String(node.value || "");
|
|
1111
|
-
const isSemanticToken =
|
|
1112
|
-
(p) => p.toLowerCase().includes("semantic") || p.toLowerCase().includes("component")
|
|
1113
|
-
);
|
|
1114
|
+
const isSemanticToken = category === "semantic" || category === "component";
|
|
1114
1115
|
if (isSemanticToken && !value.startsWith("{")) {
|
|
1115
1116
|
if (/#[0-9A-Fa-f]{3,8}/.test(value) || /rgba?\(/.test(value)) {
|
|
1116
1117
|
issues.push({
|
|
@@ -1130,7 +1131,7 @@ function validateTokenStructure(tokens) {
|
|
|
1130
1131
|
return;
|
|
1131
1132
|
}
|
|
1132
1133
|
Object.entries(node).forEach(([key, val]) => {
|
|
1133
|
-
walk(val, [...path2, key],
|
|
1134
|
+
walk(val, [...path2, key], category);
|
|
1134
1135
|
});
|
|
1135
1136
|
}
|
|
1136
1137
|
walk(tokens);
|