synthesisui 0.11.2 → 0.11.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.
- package/dist/commands/doctor.js +3 -1
- package/dist/doctor/scan.js +14 -12
- package/package.json +1 -1
package/dist/commands/doctor.js
CHANGED
|
@@ -266,7 +266,9 @@ export async function doctor(opts) {
|
|
|
266
266
|
for (const r of reports) {
|
|
267
267
|
if (!r.setAside)
|
|
268
268
|
continue;
|
|
269
|
-
|
|
269
|
+
for (const a of r.setAside) {
|
|
270
|
+
aside.set(a.reason, (aside.get(a.reason) ?? 0) + a.count);
|
|
271
|
+
}
|
|
270
272
|
}
|
|
271
273
|
for (const [reason, count] of aside) {
|
|
272
274
|
console.log(body(`set aside: ${count} value(s) in ${reason}`));
|
package/dist/doctor/scan.js
CHANGED
|
@@ -60,16 +60,21 @@ const IDIOM = new Set(["0", "0px", "1px", "9999px", "100%", "50%"]);
|
|
|
60
60
|
export function scanSource(file, source, table) {
|
|
61
61
|
const findings = [];
|
|
62
62
|
let tokenUses = 0;
|
|
63
|
-
|
|
63
|
+
// Reason by reason. Rolling two into "A or B" was the one place the report
|
|
64
|
+
// still lumped things it had told apart everywhere else.
|
|
65
|
+
const aside = new Map();
|
|
66
|
+
const setAside = (reason) => aside.set(reason, (aside.get(reason) ?? 0) + 1);
|
|
64
67
|
if (RENDERS_IMAGE.test(source)) {
|
|
65
68
|
return {
|
|
66
69
|
file,
|
|
67
70
|
findings: [],
|
|
68
71
|
tokenUses: 0,
|
|
69
|
-
setAside:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
setAside: [
|
|
73
|
+
{
|
|
74
|
+
reason: "renders to an image, where CSS variables do not exist",
|
|
75
|
+
count: (source.match(COLOR) ?? []).length,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
73
78
|
};
|
|
74
79
|
}
|
|
75
80
|
let svgDepth = 0;
|
|
@@ -101,7 +106,7 @@ export function scanSource(file, source, table) {
|
|
|
101
106
|
if (literal.includes("$") || literal.includes("{"))
|
|
102
107
|
return;
|
|
103
108
|
if (col >= 0 && inFallback(col)) {
|
|
104
|
-
|
|
109
|
+
setAside("a token's own fallback");
|
|
105
110
|
return;
|
|
106
111
|
}
|
|
107
112
|
const key = `${kind}:${literal}`;
|
|
@@ -123,7 +128,7 @@ export function scanSource(file, source, table) {
|
|
|
123
128
|
(before.match(/<\/svg>/g) ?? []).length;
|
|
124
129
|
// inside an <svg>, a colour on fill= or stroke= is paint, not surface
|
|
125
130
|
if (depthHere > 0 && SVG_PAINT.test(before)) {
|
|
126
|
-
|
|
131
|
+
setAside("SVG artwork");
|
|
127
132
|
continue;
|
|
128
133
|
}
|
|
129
134
|
push("color", m[0], m.index ?? -1);
|
|
@@ -150,12 +155,9 @@ export function scanSource(file, source, table) {
|
|
|
150
155
|
file,
|
|
151
156
|
findings,
|
|
152
157
|
tokenUses,
|
|
153
|
-
...(aside > 0
|
|
158
|
+
...(aside.size > 0
|
|
154
159
|
? {
|
|
155
|
-
setAside: {
|
|
156
|
-
reason: "SVG artwork or a token's own fallback",
|
|
157
|
-
count: aside,
|
|
158
|
-
},
|
|
160
|
+
setAside: [...aside].map(([reason, count]) => ({ reason, count })),
|
|
159
161
|
}
|
|
160
162
|
: null),
|
|
161
163
|
};
|
package/package.json
CHANGED