@projectwallace/css-analyzer 7.4.0 → 7.5.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/css-analyzer.js +310 -303
- package/dist/index.d.ts +15 -2
- package/package.json +1 -1
package/dist/css-analyzer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { calculateForAST as
|
|
4
|
-
function
|
|
1
|
+
import ei from "css-tree/parser";
|
|
2
|
+
import v from "css-tree/walker";
|
|
3
|
+
import { calculateForAST as ti } from "@bramus/specificity/core";
|
|
4
|
+
function He(r, t) {
|
|
5
5
|
return t >= 65 && t <= 90 && (t = t | 32), r === t;
|
|
6
6
|
}
|
|
7
7
|
function S(r, t) {
|
|
@@ -9,47 +9,47 @@ function S(r, t) {
|
|
|
9
9
|
let s = r.length;
|
|
10
10
|
if (s !== t.length) return !1;
|
|
11
11
|
for (let e = 0; e < s; e++)
|
|
12
|
-
if (
|
|
12
|
+
if (He(r.charCodeAt(e), t.charCodeAt(e)) === !1)
|
|
13
13
|
return !1;
|
|
14
14
|
return !0;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function O(r, t) {
|
|
17
17
|
if (r === t) return !0;
|
|
18
18
|
let s = t.length, e = s - r.length;
|
|
19
19
|
if (e < 0)
|
|
20
20
|
return !1;
|
|
21
21
|
for (let n = s - 1; n >= e; n--)
|
|
22
|
-
if (
|
|
22
|
+
if (He(r.charCodeAt(n - e), t.charCodeAt(n)) === !1)
|
|
23
23
|
return !1;
|
|
24
24
|
return !0;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function We(r, t) {
|
|
27
27
|
if (r === t) return !0;
|
|
28
28
|
let s = r.length;
|
|
29
29
|
if (t.length < s) return !1;
|
|
30
30
|
for (let e = 0; e < s; e++)
|
|
31
|
-
if (
|
|
31
|
+
if (He(r.charCodeAt(e), t.charCodeAt(e)) === !1)
|
|
32
32
|
return !1;
|
|
33
33
|
return !0;
|
|
34
34
|
}
|
|
35
|
-
const
|
|
36
|
-
function
|
|
35
|
+
const Te = "Atrule", ii = "MediaQuery", Me = "Rule", Ke = "Selector", Nt = "TypeSelector", G = "PseudoClassSelector", jt = "AttributeSelector", Bt = "PseudoElementSelector", Ve = "Declaration", ri = "Value", R = "Identifier", si = "Nth", li = "Combinator", Yt = "Number", Ne = "Dimension", W = "Operator", ni = "Hash", ai = "Url", je = "Function";
|
|
36
|
+
function Ut(r, t, s) {
|
|
37
37
|
let e = r.value.children.first;
|
|
38
|
-
return S(t, r.property) && e.type ===
|
|
38
|
+
return S(t, r.property) && e.type === R && S(s, e.name);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function oi(r) {
|
|
41
41
|
let t = !1;
|
|
42
|
-
return
|
|
43
|
-
if (s.type ===
|
|
42
|
+
return v(r, function(s) {
|
|
43
|
+
if (s.type === Ve && (Ut(s, "-webkit-appearance", "none") || Ut(s, "-moz-appearance", "meterbar")))
|
|
44
44
|
return t = !0, this.break;
|
|
45
45
|
}), t;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function ui(r) {
|
|
48
48
|
let t = !1;
|
|
49
|
-
return
|
|
49
|
+
return v(r, function(s) {
|
|
50
50
|
let e = s.name, n = s.value;
|
|
51
|
-
if (s.type ===
|
|
52
|
-
if (
|
|
51
|
+
if (s.type === ii && s.mediaType !== null) {
|
|
52
|
+
if (We("\\0", s.mediaType) || O("\\9 ", s.mediaType))
|
|
53
53
|
return t = !0, this.break;
|
|
54
54
|
} else if (s.type === "Feature" && s.kind === "media") {
|
|
55
55
|
if (n && n.unit && n.unit === "\\0")
|
|
@@ -63,9 +63,9 @@ function ai(r) {
|
|
|
63
63
|
}
|
|
64
64
|
}), t;
|
|
65
65
|
}
|
|
66
|
-
const
|
|
67
|
-
function
|
|
68
|
-
return r.charCodeAt(0) ===
|
|
66
|
+
const Vt = 45;
|
|
67
|
+
function E(r) {
|
|
68
|
+
return r.charCodeAt(0) === Vt && r.charCodeAt(1) !== Vt && r.indexOf("-", 2) !== -1;
|
|
69
69
|
}
|
|
70
70
|
class A {
|
|
71
71
|
/** @param {string[]} items */
|
|
@@ -77,16 +77,16 @@ class A {
|
|
|
77
77
|
return this.set.has(t.toLowerCase());
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function Gt(r, t) {
|
|
81
81
|
let s = [];
|
|
82
|
-
return
|
|
83
|
-
visit:
|
|
82
|
+
return v(r, {
|
|
83
|
+
visit: Ke,
|
|
84
84
|
enter: function(e) {
|
|
85
85
|
s.push(t(e));
|
|
86
86
|
}
|
|
87
87
|
}), s;
|
|
88
88
|
}
|
|
89
|
-
const
|
|
89
|
+
const Qt = new A([
|
|
90
90
|
"nth-child",
|
|
91
91
|
"where",
|
|
92
92
|
"not",
|
|
@@ -97,15 +97,15 @@ const Yt = new A([
|
|
|
97
97
|
"-webkit-any",
|
|
98
98
|
"-moz-any"
|
|
99
99
|
]);
|
|
100
|
-
function
|
|
100
|
+
function Zt(r) {
|
|
101
101
|
let t = !1;
|
|
102
|
-
return
|
|
103
|
-
if (s.type ===
|
|
102
|
+
return v(r, function(s) {
|
|
103
|
+
if (s.type === jt) {
|
|
104
104
|
let e = s.name.name;
|
|
105
|
-
if (S("role", e) ||
|
|
105
|
+
if (S("role", e) || We("aria-", e))
|
|
106
106
|
return t = !0, this.break;
|
|
107
|
-
} else if (s.type === G &&
|
|
108
|
-
let e =
|
|
107
|
+
} else if (s.type === G && Qt.has(s.name)) {
|
|
108
|
+
let e = Gt(s, Zt);
|
|
109
109
|
for (let n of e)
|
|
110
110
|
if (n === !0) {
|
|
111
111
|
t = !0;
|
|
@@ -115,29 +115,29 @@ function Gt(r) {
|
|
|
115
115
|
}
|
|
116
116
|
}), t;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function ci(r) {
|
|
119
119
|
let t = !1;
|
|
120
|
-
return
|
|
120
|
+
return v(r, function(s) {
|
|
121
121
|
let e = s.type;
|
|
122
|
-
if ((e ===
|
|
122
|
+
if ((e === Bt || e === Nt || e === G) && E(s.name))
|
|
123
123
|
return t = !0, this.break;
|
|
124
124
|
}), t;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function fi(r) {
|
|
127
127
|
let t = [];
|
|
128
|
-
return
|
|
128
|
+
return v(r, function(s) {
|
|
129
129
|
s.type === G && t.push(s.name);
|
|
130
130
|
}), t.length === 0 ? !1 : t;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function Jt(r) {
|
|
133
133
|
let t = 0;
|
|
134
|
-
return
|
|
134
|
+
return v(r, function(s) {
|
|
135
135
|
let e = s.type;
|
|
136
|
-
if (!(e ===
|
|
137
|
-
if (t++, (e ===
|
|
136
|
+
if (!(e === Ke || e === si)) {
|
|
137
|
+
if (t++, (e === Bt || e === Nt || e === G) && E(s.name) && t++, e === jt)
|
|
138
138
|
return s.value && t++, this.skip;
|
|
139
|
-
if (e === G &&
|
|
140
|
-
let n =
|
|
139
|
+
if (e === G && Qt.has(s.name)) {
|
|
140
|
+
let n = Gt(s, Jt);
|
|
141
141
|
if (n.length === 0) return;
|
|
142
142
|
for (let a of n)
|
|
143
143
|
t += a;
|
|
@@ -146,12 +146,12 @@ function Qt(r) {
|
|
|
146
146
|
}
|
|
147
147
|
}), t;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
|
|
151
|
-
if (s.type ===
|
|
149
|
+
function pi(r, t) {
|
|
150
|
+
v(r, function(s, e) {
|
|
151
|
+
if (s.type === li) {
|
|
152
152
|
let n = s.loc, a = s.name;
|
|
153
153
|
if (n === null) {
|
|
154
|
-
let y = e.prev.data.loc.end,
|
|
154
|
+
let y = e.prev.data.loc.end, b = {
|
|
155
155
|
offset: y.offset,
|
|
156
156
|
line: y.line,
|
|
157
157
|
column: y.column
|
|
@@ -159,11 +159,11 @@ function ci(r, t) {
|
|
|
159
159
|
t({
|
|
160
160
|
name: a,
|
|
161
161
|
loc: {
|
|
162
|
-
start:
|
|
162
|
+
start: b,
|
|
163
163
|
end: {
|
|
164
|
-
offset:
|
|
165
|
-
line:
|
|
166
|
-
column:
|
|
164
|
+
offset: b.offset + 1,
|
|
165
|
+
line: b.line,
|
|
166
|
+
column: b.column + 1
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
});
|
|
@@ -175,7 +175,7 @@ function ci(r, t) {
|
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
|
-
const
|
|
178
|
+
const hi = new A([
|
|
179
179
|
// CSS Named Colors
|
|
180
180
|
// Spec: https://drafts.csswg.org/css-color/#named-colors
|
|
181
181
|
// Heuristic: popular names first for quick finding in set.has()
|
|
@@ -328,7 +328,7 @@ const fi = new A([
|
|
|
328
328
|
"mediumorchid",
|
|
329
329
|
"darksalmon",
|
|
330
330
|
"mediumspringgreen"
|
|
331
|
-
]),
|
|
331
|
+
]), mi = new A([
|
|
332
332
|
// CSS System Colors
|
|
333
333
|
// Spec: https://drafts.csswg.org/css-color/#css-system-colors
|
|
334
334
|
"accentcolor",
|
|
@@ -350,7 +350,7 @@ const fi = new A([
|
|
|
350
350
|
"selecteditem",
|
|
351
351
|
"selecteditemtext",
|
|
352
352
|
"visitedtext"
|
|
353
|
-
]),
|
|
353
|
+
]), gi = new A([
|
|
354
354
|
"rgba",
|
|
355
355
|
"rgb",
|
|
356
356
|
"hsla",
|
|
@@ -361,7 +361,7 @@ const fi = new A([
|
|
|
361
361
|
"lch",
|
|
362
362
|
"lab",
|
|
363
363
|
"oklab"
|
|
364
|
-
]),
|
|
364
|
+
]), di = new A([
|
|
365
365
|
"transparent",
|
|
366
366
|
"currentcolor"
|
|
367
367
|
]), ie = new A([
|
|
@@ -378,25 +378,25 @@ function te(r) {
|
|
|
378
378
|
let t = r.children, s = t.size;
|
|
379
379
|
if (!t || s > 1 || s === 0) return !1;
|
|
380
380
|
let e = t.first;
|
|
381
|
-
return e.type ===
|
|
381
|
+
return e.type === R && ie.has(e.name);
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function Ht(r) {
|
|
384
384
|
return parseFloat(r) === 0;
|
|
385
385
|
}
|
|
386
|
-
function
|
|
386
|
+
function yi(r) {
|
|
387
387
|
for (let t of r.children.toArray())
|
|
388
|
-
if (!(t.type ===
|
|
388
|
+
if (!(t.type === Yt && Ht(t.value)) && !(t.type === Ne && Ht(t.value)))
|
|
389
389
|
return !1;
|
|
390
390
|
return !0;
|
|
391
391
|
}
|
|
392
|
-
const
|
|
392
|
+
const wi = new A([
|
|
393
393
|
"caption",
|
|
394
394
|
"icon",
|
|
395
395
|
"menu",
|
|
396
396
|
"message-box",
|
|
397
397
|
"small-caption",
|
|
398
398
|
"status-bar"
|
|
399
|
-
]),
|
|
399
|
+
]), ki = new A([
|
|
400
400
|
/* <absolute-size> values */
|
|
401
401
|
"xx-small",
|
|
402
402
|
"x-small",
|
|
@@ -409,39 +409,41 @@ const di = new A([
|
|
|
409
409
|
/* <relative-size> values */
|
|
410
410
|
"smaller",
|
|
411
411
|
"larger"
|
|
412
|
-
]),
|
|
413
|
-
function
|
|
412
|
+
]), bi = 44, Wt = 47;
|
|
413
|
+
function Ie(r) {
|
|
414
414
|
let t = r.children.first;
|
|
415
|
-
return t === null ? !1 : t.type ===
|
|
415
|
+
return t === null ? !1 : t.type === R && wi.has(t.name);
|
|
416
416
|
}
|
|
417
|
-
function
|
|
418
|
-
var
|
|
419
|
-
let e =
|
|
417
|
+
function xi(r, t, s) {
|
|
418
|
+
var b;
|
|
419
|
+
let e = [,], n, a;
|
|
420
|
+
if (r.children.first.type === "Function" && r.children.first.name.toLowerCase() === "var")
|
|
421
|
+
return null;
|
|
420
422
|
r.children.forEach(function(w, _) {
|
|
421
|
-
let
|
|
422
|
-
if (w.type ===
|
|
423
|
+
let k = _.prev ? _.prev.data : void 0, P = _.next ? _.next.data : void 0;
|
|
424
|
+
if (w.type === R && ie.has(w.name) && s({
|
|
423
425
|
type: "keyword",
|
|
424
426
|
value: w.name
|
|
425
|
-
}), P && P.type === W && P.value.charCodeAt(0) ===
|
|
427
|
+
}), P && P.type === W && P.value.charCodeAt(0) === Wt) {
|
|
426
428
|
n = t(w);
|
|
427
429
|
return;
|
|
428
430
|
}
|
|
429
|
-
if (
|
|
431
|
+
if (k && k.type === W && k.value.charCodeAt(0) === Wt) {
|
|
430
432
|
a = t(w);
|
|
431
433
|
return;
|
|
432
434
|
}
|
|
433
|
-
if (P && P.type === W && P.value.charCodeAt(0) ===
|
|
434
|
-
e[0] = w, !n &&
|
|
435
|
+
if (P && P.type === W && P.value.charCodeAt(0) === bi && !e[0]) {
|
|
436
|
+
e[0] = w, !n && k && (n = t(k));
|
|
435
437
|
return;
|
|
436
438
|
}
|
|
437
|
-
if (w.type !==
|
|
439
|
+
if (w.type !== Yt) {
|
|
438
440
|
if (_.next === null) {
|
|
439
|
-
e[1] = w, !n && !e[0] &&
|
|
441
|
+
e[1] = w, !n && !e[0] && k && (n = t(k));
|
|
440
442
|
return;
|
|
441
443
|
}
|
|
442
|
-
if (w.type ===
|
|
444
|
+
if (w.type === R) {
|
|
443
445
|
let D = w.name;
|
|
444
|
-
if (
|
|
446
|
+
if (ki.has(D)) {
|
|
445
447
|
n = D;
|
|
446
448
|
return;
|
|
447
449
|
}
|
|
@@ -456,7 +458,7 @@ function bi(r, t, s) {
|
|
|
456
458
|
end: {
|
|
457
459
|
// Either the node we detected as the last node, or the end of the whole value
|
|
458
460
|
// It's never 0 because the first node is always a font-size or font-style
|
|
459
|
-
offset: ((
|
|
461
|
+
offset: ((b = e[1]) == null ? void 0 : b.loc.end.offset) || r.loc.end.offset
|
|
460
462
|
}
|
|
461
463
|
}
|
|
462
464
|
}) : null;
|
|
@@ -466,7 +468,7 @@ function bi(r, t, s) {
|
|
|
466
468
|
font_family: y
|
|
467
469
|
};
|
|
468
470
|
}
|
|
469
|
-
const
|
|
471
|
+
const Ci = new A([
|
|
470
472
|
"linear",
|
|
471
473
|
"ease",
|
|
472
474
|
"ease-in",
|
|
@@ -474,36 +476,36 @@ const ki = new A([
|
|
|
474
476
|
"ease-in-out",
|
|
475
477
|
"step-start",
|
|
476
478
|
"step-end"
|
|
477
|
-
]),
|
|
479
|
+
]), zi = new A([
|
|
478
480
|
"cubic-bezier",
|
|
479
481
|
"steps"
|
|
480
482
|
]);
|
|
481
|
-
function
|
|
483
|
+
function Si(r, t) {
|
|
482
484
|
let s = !1;
|
|
483
485
|
for (let e of r) {
|
|
484
486
|
let n = e.type, a = e.name;
|
|
485
|
-
n === W ? s = !1 : n ===
|
|
487
|
+
n === W ? s = !1 : n === Ne && s === !1 ? (s = !0, t({
|
|
486
488
|
type: "duration",
|
|
487
489
|
value: e
|
|
488
|
-
})) : n ===
|
|
490
|
+
})) : n === R ? Ci.has(a) ? t({
|
|
489
491
|
type: "fn",
|
|
490
492
|
value: e
|
|
491
493
|
}) : ie.has(a) && t({
|
|
492
494
|
type: "keyword",
|
|
493
495
|
value: e
|
|
494
|
-
}) : n ===
|
|
496
|
+
}) : n === je && zi.has(a) && t({
|
|
495
497
|
type: "fn",
|
|
496
498
|
value: e
|
|
497
499
|
});
|
|
498
500
|
}
|
|
499
501
|
}
|
|
500
|
-
function
|
|
502
|
+
function Xt(r) {
|
|
501
503
|
let t = r.children;
|
|
502
504
|
if (!t)
|
|
503
505
|
return !1;
|
|
504
506
|
for (let s of t) {
|
|
505
507
|
let { type: e, name: n } = s;
|
|
506
|
-
if (e ===
|
|
508
|
+
if (e === R && E(n) || e === je && (E(n) || Xt(s)))
|
|
507
509
|
return !0;
|
|
508
510
|
}
|
|
509
511
|
return !1;
|
|
@@ -552,7 +554,7 @@ class o {
|
|
|
552
554
|
*/
|
|
553
555
|
c() {
|
|
554
556
|
let t = /* @__PURE__ */ new Map(), s = {}, e = this._useLocations, n = this._items, a = this._nodes, y = n.size;
|
|
555
|
-
n.forEach((_,
|
|
557
|
+
n.forEach((_, k) => {
|
|
556
558
|
if (e) {
|
|
557
559
|
let P = _.map(function(D) {
|
|
558
560
|
let T = D * 4;
|
|
@@ -563,20 +565,20 @@ class o {
|
|
|
563
565
|
length: a[T + 3]
|
|
564
566
|
};
|
|
565
567
|
});
|
|
566
|
-
t.set(
|
|
568
|
+
t.set(k, P);
|
|
567
569
|
} else
|
|
568
|
-
s[
|
|
570
|
+
s[k] = _.length;
|
|
569
571
|
});
|
|
570
|
-
let
|
|
571
|
-
total:
|
|
572
|
+
let b = this._total, w = {
|
|
573
|
+
total: b,
|
|
572
574
|
totalUnique: y,
|
|
573
575
|
unique: s,
|
|
574
|
-
uniquenessRatio:
|
|
576
|
+
uniquenessRatio: b === 0 ? 0 : y / b
|
|
575
577
|
};
|
|
576
578
|
return e && (w.uniqueWithLocations = Object.fromEntries(t)), w;
|
|
577
579
|
}
|
|
578
580
|
}
|
|
579
|
-
class
|
|
581
|
+
class Ue {
|
|
580
582
|
/** @param {boolean} useLocations */
|
|
581
583
|
constructor(t) {
|
|
582
584
|
this._list = new o(t), this._contexts = /* @__PURE__ */ new Map(), this._useLocations = t;
|
|
@@ -599,11 +601,11 @@ class Ve {
|
|
|
599
601
|
});
|
|
600
602
|
}
|
|
601
603
|
}
|
|
602
|
-
function
|
|
604
|
+
function _i(r) {
|
|
603
605
|
let t = /* @__PURE__ */ new Map(), s = -1, e = 0, n = 0, a = r.length;
|
|
604
606
|
for (let y = 0; y < a; y++) {
|
|
605
|
-
let
|
|
606
|
-
t.set(
|
|
607
|
+
let b = r[y], w = (t.get(b) || 0) + 1;
|
|
608
|
+
t.set(b, w), w > s && (s = w, e = 0, n = 0), w >= s && (e++, n += b);
|
|
607
609
|
}
|
|
608
610
|
return n / e;
|
|
609
611
|
}
|
|
@@ -632,7 +634,7 @@ class C {
|
|
|
632
634
|
range: 0,
|
|
633
635
|
sum: 0
|
|
634
636
|
};
|
|
635
|
-
let s = this._items.slice().sort((
|
|
637
|
+
let s = this._items.slice().sort((b, w) => b - w), e = s[0], n = s[t - 1], a = _i(s), y = this._sum;
|
|
636
638
|
return {
|
|
637
639
|
min: e,
|
|
638
640
|
max: n,
|
|
@@ -649,33 +651,33 @@ class C {
|
|
|
649
651
|
return this._items;
|
|
650
652
|
}
|
|
651
653
|
}
|
|
652
|
-
function
|
|
653
|
-
if (
|
|
654
|
+
function qi(r) {
|
|
655
|
+
if (Be(r) || E(r)) return !1;
|
|
654
656
|
let t = r.charCodeAt(0);
|
|
655
657
|
return t === 47 || t === 42 || t === 95 || t === 43 || t === 38 || t === 36 || t === 35;
|
|
656
658
|
}
|
|
657
|
-
function
|
|
659
|
+
function Be(r) {
|
|
658
660
|
return r.length < 3 ? !1 : r.charCodeAt(0) === 45 && r.charCodeAt(1) === 45;
|
|
659
661
|
}
|
|
660
662
|
function m(r, t) {
|
|
661
|
-
return
|
|
662
|
-
}
|
|
663
|
-
function _i(r) {
|
|
664
|
-
return F(r) ? r.slice(r.indexOf("-", 2) + 1) : r;
|
|
663
|
+
return Be(t) ? !1 : O(r, t);
|
|
665
664
|
}
|
|
666
665
|
function vi(r) {
|
|
666
|
+
return E(r) ? r.slice(r.indexOf("-", 2) + 1) : r;
|
|
667
|
+
}
|
|
668
|
+
function Ai(r) {
|
|
667
669
|
let t = 5, s = r.indexOf(";"), e = r.indexOf(",");
|
|
668
670
|
return s === -1 || e !== -1 && e < s ? r.substring(t, e) : r.substring(t, s);
|
|
669
671
|
}
|
|
670
|
-
function
|
|
672
|
+
function Pi(r) {
|
|
671
673
|
let t = r.children;
|
|
672
674
|
if (t) {
|
|
673
675
|
let s = t.last;
|
|
674
|
-
return s && s.type ===
|
|
676
|
+
return s && s.type === R && O("\\9", s.name);
|
|
675
677
|
}
|
|
676
678
|
return !1;
|
|
677
679
|
}
|
|
678
|
-
let
|
|
680
|
+
let Li = new A([
|
|
679
681
|
"border-radius",
|
|
680
682
|
"border-top-left-radius",
|
|
681
683
|
"border-top-right-radius",
|
|
@@ -689,11 +691,11 @@ let Ai = new A([
|
|
|
689
691
|
function z(r, t) {
|
|
690
692
|
return t === 0 ? 0 : r / t;
|
|
691
693
|
}
|
|
692
|
-
let
|
|
694
|
+
let Oi = {
|
|
693
695
|
useLocations: !1
|
|
694
696
|
};
|
|
695
|
-
function
|
|
696
|
-
let e = Object.assign({},
|
|
697
|
+
function Ei(r, t = {}) {
|
|
698
|
+
let e = Object.assign({}, Oi, t).useLocations === !0, n = Date.now();
|
|
697
699
|
function a(i) {
|
|
698
700
|
return y(i).trim();
|
|
699
701
|
}
|
|
@@ -701,49 +703,49 @@ function Di(r, t = {}) {
|
|
|
701
703
|
let Y = i.loc;
|
|
702
704
|
return r.substring(Y.start.offset, Y.end.offset);
|
|
703
705
|
}
|
|
704
|
-
let
|
|
706
|
+
let b = 0, w = 0, _ = 0, k = {
|
|
705
707
|
total: 0,
|
|
706
708
|
/** @type {Map<string, { size: number, count: number } & ({ uniqueWithLocations?: undefined } | ({ uniqueWithLocations: { offset: number, line: number, column: number, length: number }[] })) }>} */
|
|
707
709
|
unique: /* @__PURE__ */ new Map()
|
|
708
|
-
}, P = Date.now(), D =
|
|
710
|
+
}, P = Date.now(), D = ei(r, {
|
|
709
711
|
parseCustomProperty: !0,
|
|
710
712
|
// To find font-families, colors, etc.
|
|
711
713
|
positions: !0,
|
|
712
714
|
// So we can use stringifyNode()
|
|
713
715
|
/** @param {string} comment */
|
|
714
716
|
onComment: function(i) {
|
|
715
|
-
|
|
717
|
+
b++, w += i.length;
|
|
716
718
|
}
|
|
717
|
-
}), T = Date.now(),
|
|
718
|
-
|
|
719
|
+
}), T = Date.now(), $t = D.loc.end.line - D.loc.start.line + 1, Ye = new o(e), re = new C(), se = [], Ge = new o(e), le = new o(e), Qe = new o(e), Ze = new o(e), Je = new o(e), Xe = new o(e), $e = new o(e), ne = new o(e), et = new o(e), ae = new o(e), oe = new o(e), tt = new o(e), Q = new o(e), it = new o(e), ue = new C(), rt = new o(e), ce = 0, fe = 0, pe = new C(), he = new C(), me = new C(), st = new o(e), lt = new o(e), nt = new o(e), ge = new C(), at = new o(e), de = new o(e), ot = /* @__PURE__ */ new Set(), ye = new o(e), M, I, ut = new C(), ct = new C(), ft = new C(), pt = new o(e), Z = new C(), ht = new o(e), mt = [], we = new o(e), ke = new o(e), gt = new o(e), dt = new o(e), be = new C(), yt = new o(e), wt = /* @__PURE__ */ new Set(), K = 0, kt = new C(), J = 0, xe = 0, Ce = new o(e), ze = new C(), bt = new o(e), N = new o(e), Se = new o(e), _e = new o(e), X = new o(e), j = new C(), qe = new C(), xt = new o(e), ve = new o(e), Ct = new o(e), zt = new o(e), St = new o(e), Ae = new o(e), Pe = new o(e), Le = new o(e), $ = new o(e), ee = new o(e), U = new Ue(e), V = new o(e), Oe = new Ue(e), _t = new o(e), B = new o(e), qt = new Ue(e), vt = new o(e), L = 0;
|
|
720
|
+
v(D, {
|
|
719
721
|
enter(i) {
|
|
720
|
-
var Y,
|
|
722
|
+
var Y, Mt;
|
|
721
723
|
switch (i.type) {
|
|
722
|
-
case
|
|
723
|
-
|
|
724
|
+
case Te: {
|
|
725
|
+
Ye.p(i.name, i.loc), ue.push(L), rt.p(L, i.loc);
|
|
724
726
|
let p = i.name;
|
|
725
727
|
if (p === "font-face") {
|
|
726
728
|
let g = {};
|
|
727
729
|
e && Ge.p(i.loc.start.offset, i.loc), i.block.children.forEach((c) => {
|
|
728
|
-
c.type ===
|
|
729
|
-
}),
|
|
730
|
+
c.type === Ve && (g[c.property] = a(c.value));
|
|
731
|
+
}), se.push(g), re.push(1);
|
|
730
732
|
break;
|
|
731
733
|
}
|
|
732
734
|
let l = 1;
|
|
733
735
|
if (i.prelude !== null) {
|
|
734
736
|
let g = i.prelude, c = g && a(i.prelude), f = g.loc;
|
|
735
737
|
if (p === "media")
|
|
736
|
-
Ze.p(c, f),
|
|
738
|
+
Ze.p(c, f), ui(g) && (Je.p(c, f), l++);
|
|
737
739
|
else if (p === "supports")
|
|
738
|
-
|
|
739
|
-
else if (
|
|
740
|
+
ne.p(c, f), oi(g) && (et.p(c, f), l++);
|
|
741
|
+
else if (O("keyframes", p)) {
|
|
740
742
|
let u = "@" + p + " " + c;
|
|
741
|
-
|
|
743
|
+
E(p) && (oe.p(u, f), l++), ae.p(u, f);
|
|
742
744
|
} else if (p === "import")
|
|
743
|
-
|
|
745
|
+
v(i, function(u) {
|
|
744
746
|
if (u.type === "Condition" && u.kind === "supports") {
|
|
745
747
|
let h = a(u);
|
|
746
|
-
return
|
|
748
|
+
return ne.p(h, u.loc), this.break;
|
|
747
749
|
}
|
|
748
750
|
}), Qe.p(c, f);
|
|
749
751
|
else if (p === "charset")
|
|
@@ -755,49 +757,49 @@ function Di(r, t = {}) {
|
|
|
755
757
|
}
|
|
756
758
|
} else p === "property" && it.p(c, f);
|
|
757
759
|
} else
|
|
758
|
-
p === "layer" && (
|
|
759
|
-
|
|
760
|
+
p === "layer" && (le.p("<anonymous>", i.loc), l++);
|
|
761
|
+
re.push(l);
|
|
760
762
|
break;
|
|
761
763
|
}
|
|
762
764
|
case "Layer": {
|
|
763
|
-
i.name !== null &&
|
|
765
|
+
i.name !== null && le.p(i.name, i.loc);
|
|
764
766
|
break;
|
|
765
767
|
}
|
|
766
768
|
case "Feature": {
|
|
767
769
|
Xe.p(i.name, i.loc);
|
|
768
770
|
break;
|
|
769
771
|
}
|
|
770
|
-
case
|
|
772
|
+
case Me: {
|
|
771
773
|
let p = i.prelude, l = i.block, g = p.children, c = l.children, f = g ? g.size : 0, u = c ? c.size : 0;
|
|
772
|
-
|
|
774
|
+
pe.push(f + u), st.p(f + u, i.loc), he.push(f), lt.p(f, p.loc), me.push(u), nt.p(u, l.loc), ge.push(L), at.p(L, i.loc), ce++, u === 0 && fe++;
|
|
773
775
|
break;
|
|
774
776
|
}
|
|
775
|
-
case
|
|
777
|
+
case Ke: {
|
|
776
778
|
let p = a(i);
|
|
777
|
-
if (this.atrule &&
|
|
778
|
-
return
|
|
779
|
-
|
|
780
|
-
let l =
|
|
779
|
+
if (this.atrule && O("keyframes", this.atrule.name))
|
|
780
|
+
return de.p(p, i.loc), this.skip;
|
|
781
|
+
Zt(i) && ke.p(p, i.loc);
|
|
782
|
+
let l = fi(i);
|
|
781
783
|
if (l !== !1)
|
|
782
784
|
for (let x of l)
|
|
783
785
|
gt.p(x, i.loc);
|
|
784
|
-
let g =
|
|
785
|
-
|
|
786
|
-
let c =
|
|
787
|
-
return pt.p(c.toString(), i.loc), ut.push(f), ct.push(u), ft.push(h), M === void 0 && (M = c), I === void 0 && (I = c), I !== void 0 &&
|
|
788
|
-
dt.p(
|
|
786
|
+
let g = Jt(i);
|
|
787
|
+
ci(i) && ye.p(p, i.loc), ot.add(p), Z.push(g), ht.p(g, i.loc), be.push(L - 1), yt.p(L - 1, i.loc);
|
|
788
|
+
let c = ti(i).toArray(), [f, u, h] = c;
|
|
789
|
+
return pt.p(c.toString(), i.loc), ut.push(f), ct.push(u), ft.push(h), M === void 0 && (M = c), I === void 0 && (I = c), I !== void 0 && Kt(I, c) < 0 && (I = c), M !== void 0 && Kt(M, c) > 0 && (M = c), mt.push(c), f > 0 && we.p(p, i.loc), pi(i, function(q) {
|
|
790
|
+
dt.p(q.name, q.loc);
|
|
789
791
|
}), this.skip;
|
|
790
792
|
}
|
|
791
|
-
case
|
|
793
|
+
case Ne: {
|
|
792
794
|
if (!this.declaration)
|
|
793
795
|
break;
|
|
794
796
|
let p = i.unit;
|
|
795
|
-
return
|
|
797
|
+
return O("\\9", p) ? Oe.push(p.substring(0, p.length - 2), this.declaration.property, i.loc) : Oe.push(p, this.declaration.property, i.loc), this.skip;
|
|
796
798
|
}
|
|
797
|
-
case
|
|
798
|
-
if (
|
|
799
|
-
let p = i.value, l = p.length, g =
|
|
800
|
-
|
|
799
|
+
case ai: {
|
|
800
|
+
if (We("data:", i.value)) {
|
|
801
|
+
let p = i.value, l = p.length, g = Ai(p);
|
|
802
|
+
k.total++, _ += l;
|
|
801
803
|
let c = {
|
|
802
804
|
/** @type {number} */
|
|
803
805
|
line: i.loc.start.line,
|
|
@@ -808,49 +810,52 @@ function Di(r, t = {}) {
|
|
|
808
810
|
/** @type {number} */
|
|
809
811
|
length: i.loc.end.offset - i.loc.start.offset
|
|
810
812
|
};
|
|
811
|
-
if (
|
|
812
|
-
let f =
|
|
813
|
-
f.count++, f.size += l,
|
|
813
|
+
if (k.unique.has(g)) {
|
|
814
|
+
let f = k.unique.get(g);
|
|
815
|
+
f.count++, f.size += l, k.unique.set(g, f), e && f.uniqueWithLocations.push(c);
|
|
814
816
|
} else {
|
|
815
817
|
let f = {
|
|
816
818
|
count: 1,
|
|
817
819
|
size: l
|
|
818
820
|
};
|
|
819
|
-
e && (f.uniqueWithLocations = [c]),
|
|
821
|
+
e && (f.uniqueWithLocations = [c]), k.unique.set(g, f);
|
|
820
822
|
}
|
|
821
823
|
}
|
|
822
824
|
break;
|
|
823
825
|
}
|
|
824
|
-
case
|
|
826
|
+
case ri: {
|
|
825
827
|
if (te(i)) {
|
|
826
828
|
qe.push(1), B.p(a(i), i.loc);
|
|
827
829
|
break;
|
|
828
830
|
}
|
|
829
831
|
let p = this.declaration, { property: l, important: g } = p, c = 1;
|
|
830
|
-
|
|
832
|
+
Xt(i) && (xt.p(a(i), i.loc), c++), typeof g == "string" && (ve.p(y(i) + "!" + g, i.loc), c++), Pi(i) && (ve.p(a(i), i.loc), c++);
|
|
831
833
|
let f = i.children, u = i.loc;
|
|
832
834
|
if (qe.push(c), m("margin", l) || m("margin-block", l) || m("margin-inline", l) || m("margin-top", l) || m("margin-right", l) || m("margin-bottom", l) || m("margin-left", l) || m("padding", l) || m("padding-block", l) || m("padding-inline", l) || m("padding-top", l) || m("padding-right", l) || m("padding-bottom", l) || m("padding-left", l))
|
|
833
|
-
|
|
835
|
+
yi(i) && vt.p(l, p.loc);
|
|
834
836
|
else {
|
|
835
837
|
if (m("z-index", l))
|
|
836
838
|
return Ct.p(a(i), u), this.skip;
|
|
837
839
|
if (m("font", l)) {
|
|
838
|
-
if (
|
|
839
|
-
let
|
|
840
|
-
|
|
840
|
+
if (Ie(i)) return;
|
|
841
|
+
let h = xi(i, a, function(It) {
|
|
842
|
+
It.type === "keyword" && B.p(It.value, u);
|
|
841
843
|
});
|
|
842
|
-
|
|
844
|
+
if (!h)
|
|
845
|
+
return this.skip;
|
|
846
|
+
let { font_size: x, line_height: q, font_family: F } = h;
|
|
847
|
+
F && Ae.p(F, u), x && Pe.p(x, u), q && Le.p(q, u);
|
|
843
848
|
break;
|
|
844
849
|
} else if (m("font-size", l)) {
|
|
845
|
-
|
|
850
|
+
Ie(i) || Pe.p(a(i), u);
|
|
846
851
|
break;
|
|
847
852
|
} else if (m("font-family", l)) {
|
|
848
|
-
|
|
853
|
+
Ie(i) || Ae.p(a(i), u);
|
|
849
854
|
break;
|
|
850
855
|
} else if (m("line-height", l))
|
|
851
|
-
|
|
856
|
+
Le.p(a(i), u);
|
|
852
857
|
else if (m("transition", l) || m("animation", l)) {
|
|
853
|
-
|
|
858
|
+
Si(f, function(h) {
|
|
854
859
|
h.type === "fn" ? $.p(a(h.value), u) : h.type === "duration" ? ee.p(a(h.value), u) : h.type === "keyword" && B.p(a(h.value), u);
|
|
855
860
|
});
|
|
856
861
|
break;
|
|
@@ -867,49 +872,49 @@ function Di(r, t = {}) {
|
|
|
867
872
|
} else if (m("container-name", l))
|
|
868
873
|
Q.p(a(i), u);
|
|
869
874
|
else if (m("container", l))
|
|
870
|
-
((
|
|
871
|
-
else if (
|
|
872
|
-
te(i) ||
|
|
875
|
+
((Mt = f.first) == null ? void 0 : Mt.type) === "Identifier" && Q.p(f.first.name, u);
|
|
876
|
+
else if (Li.has(vi(l))) {
|
|
877
|
+
te(i) || qt.push(a(i), l, u);
|
|
873
878
|
break;
|
|
874
879
|
} else m("text-shadow", l) ? te(i) || zt.p(a(i), u) : m("box-shadow", l) && (te(i) || St.p(a(i), u));
|
|
875
880
|
}
|
|
876
|
-
|
|
881
|
+
v(i, function(h) {
|
|
877
882
|
let x = h.name;
|
|
878
883
|
switch (h.type) {
|
|
879
|
-
case
|
|
880
|
-
let
|
|
881
|
-
return
|
|
884
|
+
case ni: {
|
|
885
|
+
let q = h.value.length;
|
|
886
|
+
return O("\\9", h.value) && (q = q - 2), U.push("#" + h.value, l, u), V.p("hex" + q, u), this.skip;
|
|
882
887
|
}
|
|
883
|
-
case
|
|
888
|
+
case R: {
|
|
884
889
|
ie.has(x) && B.p(x, u);
|
|
885
|
-
let
|
|
886
|
-
if (
|
|
890
|
+
let q = x.length;
|
|
891
|
+
if (q > 20 || q < 3)
|
|
887
892
|
return this.skip;
|
|
888
|
-
if (
|
|
889
|
-
let
|
|
890
|
-
U.push(
|
|
893
|
+
if (di.has(x)) {
|
|
894
|
+
let F = a(h);
|
|
895
|
+
U.push(F, l, u), V.p(x.toLowerCase(), u);
|
|
891
896
|
return;
|
|
892
897
|
}
|
|
893
|
-
if (
|
|
894
|
-
let
|
|
895
|
-
U.push(
|
|
898
|
+
if (hi.has(x)) {
|
|
899
|
+
let F = a(h);
|
|
900
|
+
U.push(F, l, u), V.p("named", u);
|
|
896
901
|
return;
|
|
897
902
|
}
|
|
898
|
-
if (
|
|
899
|
-
let
|
|
900
|
-
U.push(
|
|
903
|
+
if (mi.has(x)) {
|
|
904
|
+
let F = a(h);
|
|
905
|
+
U.push(F, l, u), V.p("system", u);
|
|
901
906
|
return;
|
|
902
907
|
}
|
|
903
908
|
return this.skip;
|
|
904
909
|
}
|
|
905
|
-
case
|
|
910
|
+
case je: {
|
|
906
911
|
if (S("var", x))
|
|
907
912
|
return this.skip;
|
|
908
|
-
if (
|
|
913
|
+
if (gi.has(x)) {
|
|
909
914
|
U.push(a(h), l, h.loc), V.p(x.toLowerCase(), h.loc);
|
|
910
915
|
return;
|
|
911
916
|
}
|
|
912
|
-
if (
|
|
917
|
+
if (O("gradient", x)) {
|
|
913
918
|
_t.p(a(h), h.loc);
|
|
914
919
|
return;
|
|
915
920
|
}
|
|
@@ -918,12 +923,12 @@ function Di(r, t = {}) {
|
|
|
918
923
|
});
|
|
919
924
|
break;
|
|
920
925
|
}
|
|
921
|
-
case
|
|
926
|
+
case Ve: {
|
|
922
927
|
if (this.atrulePrelude !== null)
|
|
923
928
|
return this.skip;
|
|
924
929
|
K++;
|
|
925
930
|
let p = 1;
|
|
926
|
-
wt.add(a(i)),
|
|
931
|
+
wt.add(a(i)), ze.push(L - 1), bt.p(L - 1, i.loc), i.important === !0 && (J++, p++, this.atrule && O("keyframes", this.atrule.name) && (xe++, p++)), kt.push(p);
|
|
927
932
|
let { property: l, loc: { start: g } } = i, c = {
|
|
928
933
|
start: {
|
|
929
934
|
line: g.line,
|
|
@@ -934,25 +939,25 @@ function Di(r, t = {}) {
|
|
|
934
939
|
offset: g.offset + l.length
|
|
935
940
|
}
|
|
936
941
|
};
|
|
937
|
-
N.p(l, c),
|
|
942
|
+
N.p(l, c), E(l) ? (_e.p(l, c), j.push(2)) : qi(l) ? (Se.p(l, c), j.push(2)) : Be(l) ? (X.p(l, c), j.push(i.important ? 3 : 2), i.important === !0 && Ce.p(l, c)) : j.push(1);
|
|
938
943
|
break;
|
|
939
944
|
}
|
|
940
945
|
}
|
|
941
|
-
(i.type ===
|
|
946
|
+
(i.type === Me || i.type === Te) && L++;
|
|
942
947
|
},
|
|
943
948
|
leave(i) {
|
|
944
|
-
(i.type ===
|
|
949
|
+
(i.type === Me || i.type === Te) && L--;
|
|
945
950
|
}
|
|
946
951
|
});
|
|
947
|
-
let At = wt.size, H = Z.size(),
|
|
952
|
+
let At = wt.size, H = Z.size(), Re = ut.aggregate(), De = ct.aggregate(), Fe = ft.aggregate(), Pt = ot.size, d = Object.assign, Lt = r.length, Ee = se.length, Ot = re.aggregate(), Rt = Z.aggregate(), Dt = kt.aggregate(), Ft = j.aggregate(), Et = qe.aggregate(), Tt = Ye.c();
|
|
948
953
|
return {
|
|
949
954
|
stylesheet: {
|
|
950
|
-
sourceLinesOfCode:
|
|
951
|
-
linesOfCode:
|
|
955
|
+
sourceLinesOfCode: Tt.total + H + K + de.size(),
|
|
956
|
+
linesOfCode: $t,
|
|
952
957
|
size: Lt,
|
|
953
|
-
complexity:
|
|
958
|
+
complexity: Ot.sum + Rt.sum + Dt.sum + Ft.sum + Et.sum,
|
|
954
959
|
comments: {
|
|
955
|
-
total:
|
|
960
|
+
total: b,
|
|
956
961
|
size: w
|
|
957
962
|
},
|
|
958
963
|
embeddedContent: {
|
|
@@ -961,97 +966,99 @@ function Di(r, t = {}) {
|
|
|
961
966
|
ratio: z(_, Lt)
|
|
962
967
|
},
|
|
963
968
|
types: {
|
|
964
|
-
total:
|
|
965
|
-
totalUnique:
|
|
966
|
-
uniquenessRatio: z(
|
|
967
|
-
unique: Object.fromEntries(
|
|
969
|
+
total: k.total,
|
|
970
|
+
totalUnique: k.unique.size,
|
|
971
|
+
uniquenessRatio: z(k.unique.size, k.total),
|
|
972
|
+
unique: Object.fromEntries(k.unique)
|
|
968
973
|
}
|
|
969
974
|
}
|
|
970
975
|
},
|
|
971
|
-
atrules:
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
976
|
+
atrules: d(
|
|
977
|
+
Tt,
|
|
978
|
+
{
|
|
979
|
+
fontface: d({
|
|
980
|
+
total: Ee,
|
|
981
|
+
totalUnique: Ee,
|
|
982
|
+
unique: se,
|
|
983
|
+
uniquenessRatio: Ee === 0 ? 0 : 1
|
|
984
|
+
}, e ? {
|
|
985
|
+
uniqueWithLocations: Ge.c().uniqueWithLocations
|
|
986
|
+
} : {}),
|
|
987
|
+
import: Qe.c(),
|
|
988
|
+
media: d(
|
|
989
|
+
Ze.c(),
|
|
990
|
+
{
|
|
991
|
+
browserhacks: Je.c(),
|
|
992
|
+
features: Xe.c()
|
|
993
|
+
}
|
|
994
|
+
),
|
|
995
|
+
charset: $e.c(),
|
|
996
|
+
supports: d(
|
|
997
|
+
ne.c(),
|
|
998
|
+
{
|
|
999
|
+
browserhacks: et.c()
|
|
1000
|
+
}
|
|
1001
|
+
),
|
|
1002
|
+
keyframes: d(
|
|
1003
|
+
ae.c(),
|
|
1004
|
+
{
|
|
1005
|
+
prefixed: d(
|
|
1006
|
+
oe.c(),
|
|
1007
|
+
{
|
|
1008
|
+
ratio: z(oe.size(), ae.size())
|
|
1009
|
+
}
|
|
1010
|
+
)
|
|
1011
|
+
}
|
|
1012
|
+
),
|
|
1013
|
+
container: d(
|
|
1014
|
+
tt.c(),
|
|
1015
|
+
{
|
|
1016
|
+
names: Q.c()
|
|
1017
|
+
}
|
|
1018
|
+
),
|
|
1019
|
+
layer: le.c(),
|
|
1020
|
+
property: it.c(),
|
|
1021
|
+
complexity: Ot,
|
|
1022
|
+
nesting: d(
|
|
1023
|
+
ue.aggregate(),
|
|
1024
|
+
{
|
|
1025
|
+
items: ue.toArray()
|
|
1026
|
+
},
|
|
1027
|
+
rt.c()
|
|
1028
|
+
)
|
|
1029
|
+
}
|
|
1030
|
+
),
|
|
1024
1031
|
rules: {
|
|
1025
|
-
total:
|
|
1032
|
+
total: ce,
|
|
1026
1033
|
empty: {
|
|
1027
|
-
total:
|
|
1028
|
-
ratio: z(
|
|
1034
|
+
total: fe,
|
|
1035
|
+
ratio: z(fe, ce)
|
|
1029
1036
|
},
|
|
1030
1037
|
sizes: d(
|
|
1031
|
-
|
|
1038
|
+
pe.aggregate(),
|
|
1032
1039
|
{
|
|
1033
|
-
items:
|
|
1040
|
+
items: pe.toArray()
|
|
1034
1041
|
},
|
|
1035
1042
|
st.c()
|
|
1036
1043
|
),
|
|
1037
1044
|
nesting: d(
|
|
1038
|
-
|
|
1045
|
+
ge.aggregate(),
|
|
1039
1046
|
{
|
|
1040
|
-
items:
|
|
1047
|
+
items: ge.toArray()
|
|
1041
1048
|
},
|
|
1042
1049
|
at.c()
|
|
1043
1050
|
),
|
|
1044
1051
|
selectors: d(
|
|
1045
|
-
|
|
1052
|
+
he.aggregate(),
|
|
1046
1053
|
{
|
|
1047
|
-
items:
|
|
1054
|
+
items: he.toArray()
|
|
1048
1055
|
},
|
|
1049
1056
|
lt.c()
|
|
1050
1057
|
),
|
|
1051
1058
|
declarations: d(
|
|
1052
|
-
|
|
1059
|
+
me.aggregate(),
|
|
1053
1060
|
{
|
|
1054
|
-
items:
|
|
1061
|
+
items: me.toArray()
|
|
1055
1062
|
},
|
|
1056
1063
|
nt.c()
|
|
1057
1064
|
)
|
|
@@ -1067,34 +1074,34 @@ function Di(r, t = {}) {
|
|
|
1067
1074
|
/** @type Specificity */
|
|
1068
1075
|
max: M === void 0 ? [0, 0, 0] : M,
|
|
1069
1076
|
/** @type Specificity */
|
|
1070
|
-
sum: [
|
|
1077
|
+
sum: [Re.sum, De.sum, Fe.sum],
|
|
1071
1078
|
/** @type Specificity */
|
|
1072
|
-
mean: [
|
|
1079
|
+
mean: [Re.mean, De.mean, Fe.mean],
|
|
1073
1080
|
/** @type Specificity */
|
|
1074
|
-
mode: [
|
|
1081
|
+
mode: [Re.mode, De.mode, Fe.mode],
|
|
1075
1082
|
/** @type Specificity */
|
|
1076
1083
|
items: mt
|
|
1077
1084
|
},
|
|
1078
1085
|
pt.c()
|
|
1079
1086
|
),
|
|
1080
1087
|
complexity: d(
|
|
1081
|
-
|
|
1088
|
+
Rt,
|
|
1082
1089
|
ht.c(),
|
|
1083
1090
|
{
|
|
1084
1091
|
items: Z.toArray()
|
|
1085
1092
|
}
|
|
1086
1093
|
),
|
|
1087
1094
|
nesting: d(
|
|
1088
|
-
|
|
1095
|
+
be.aggregate(),
|
|
1089
1096
|
{
|
|
1090
|
-
items:
|
|
1097
|
+
items: be.toArray()
|
|
1091
1098
|
},
|
|
1092
1099
|
yt.c()
|
|
1093
1100
|
),
|
|
1094
1101
|
id: d(
|
|
1095
|
-
|
|
1102
|
+
we.c(),
|
|
1096
1103
|
{
|
|
1097
|
-
ratio: z(
|
|
1104
|
+
ratio: z(we.size(), H)
|
|
1098
1105
|
}
|
|
1099
1106
|
),
|
|
1100
1107
|
pseudoClasses: gt.c(),
|
|
@@ -1104,11 +1111,11 @@ function Di(r, t = {}) {
|
|
|
1104
1111
|
ratio: z(ke.size(), H)
|
|
1105
1112
|
}
|
|
1106
1113
|
),
|
|
1107
|
-
keyframes:
|
|
1114
|
+
keyframes: de.c(),
|
|
1108
1115
|
prefixed: d(
|
|
1109
|
-
|
|
1116
|
+
ye.c(),
|
|
1110
1117
|
{
|
|
1111
|
-
ratio: z(
|
|
1118
|
+
ratio: z(ye.size(), H)
|
|
1112
1119
|
}
|
|
1113
1120
|
),
|
|
1114
1121
|
combinators: dt.c()
|
|
@@ -1121,26 +1128,26 @@ function Di(r, t = {}) {
|
|
|
1121
1128
|
total: J,
|
|
1122
1129
|
ratio: z(J, K),
|
|
1123
1130
|
inKeyframes: {
|
|
1124
|
-
total:
|
|
1125
|
-
ratio: z(
|
|
1131
|
+
total: xe,
|
|
1132
|
+
ratio: z(xe, J)
|
|
1126
1133
|
}
|
|
1127
1134
|
},
|
|
1128
1135
|
complexity: Dt,
|
|
1129
1136
|
nesting: d(
|
|
1130
|
-
|
|
1137
|
+
ze.aggregate(),
|
|
1131
1138
|
{
|
|
1132
|
-
items:
|
|
1139
|
+
items: ze.toArray()
|
|
1133
1140
|
},
|
|
1134
|
-
|
|
1141
|
+
bt.c()
|
|
1135
1142
|
)
|
|
1136
1143
|
},
|
|
1137
1144
|
properties: d(
|
|
1138
1145
|
N.c(),
|
|
1139
1146
|
{
|
|
1140
1147
|
prefixed: d(
|
|
1141
|
-
|
|
1148
|
+
_e.c(),
|
|
1142
1149
|
{
|
|
1143
|
-
ratio: z(
|
|
1150
|
+
ratio: z(_e.size(), N.size())
|
|
1144
1151
|
}
|
|
1145
1152
|
),
|
|
1146
1153
|
custom: d(
|
|
@@ -1148,20 +1155,20 @@ function Di(r, t = {}) {
|
|
|
1148
1155
|
{
|
|
1149
1156
|
ratio: z(X.size(), N.size()),
|
|
1150
1157
|
importants: d(
|
|
1151
|
-
|
|
1158
|
+
Ce.c(),
|
|
1152
1159
|
{
|
|
1153
|
-
ratio: z(
|
|
1160
|
+
ratio: z(Ce.size(), X.size())
|
|
1154
1161
|
}
|
|
1155
1162
|
)
|
|
1156
1163
|
}
|
|
1157
1164
|
),
|
|
1158
1165
|
browserhacks: d(
|
|
1159
|
-
|
|
1166
|
+
Se.c(),
|
|
1160
1167
|
{
|
|
1161
|
-
ratio: z(
|
|
1168
|
+
ratio: z(Se.size(), N.size())
|
|
1162
1169
|
}
|
|
1163
1170
|
),
|
|
1164
|
-
complexity:
|
|
1171
|
+
complexity: Ft
|
|
1165
1172
|
}
|
|
1166
1173
|
),
|
|
1167
1174
|
values: {
|
|
@@ -1172,23 +1179,23 @@ function Di(r, t = {}) {
|
|
|
1172
1179
|
}
|
|
1173
1180
|
),
|
|
1174
1181
|
gradients: _t.c(),
|
|
1175
|
-
fontFamilies:
|
|
1176
|
-
fontSizes:
|
|
1177
|
-
lineHeights:
|
|
1182
|
+
fontFamilies: Ae.c(),
|
|
1183
|
+
fontSizes: Pe.c(),
|
|
1184
|
+
lineHeights: Le.c(),
|
|
1178
1185
|
zindexes: Ct.c(),
|
|
1179
1186
|
textShadows: zt.c(),
|
|
1180
1187
|
boxShadows: St.c(),
|
|
1181
|
-
borderRadiuses:
|
|
1188
|
+
borderRadiuses: qt.count(),
|
|
1182
1189
|
animations: {
|
|
1183
1190
|
durations: ee.c(),
|
|
1184
1191
|
timingFunctions: $.c()
|
|
1185
1192
|
},
|
|
1186
1193
|
prefixes: xt.c(),
|
|
1187
|
-
browserhacks:
|
|
1194
|
+
browserhacks: ve.c(),
|
|
1188
1195
|
units: Oe.count(),
|
|
1189
|
-
complexity:
|
|
1196
|
+
complexity: Et,
|
|
1190
1197
|
keywords: B.c(),
|
|
1191
|
-
resets:
|
|
1198
|
+
resets: vt.c()
|
|
1192
1199
|
},
|
|
1193
1200
|
__meta__: {
|
|
1194
1201
|
parseTime: T - P,
|
|
@@ -1197,18 +1204,18 @@ function Di(r, t = {}) {
|
|
|
1197
1204
|
}
|
|
1198
1205
|
};
|
|
1199
1206
|
}
|
|
1200
|
-
function
|
|
1207
|
+
function Kt(r, t) {
|
|
1201
1208
|
return r[0] === t[0] ? r[1] === t[1] ? t[2] - r[2] : t[1] - r[1] : t[0] - r[0];
|
|
1202
1209
|
}
|
|
1203
1210
|
export {
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1211
|
+
Ei as analyze,
|
|
1212
|
+
Kt as compareSpecificity,
|
|
1213
|
+
E as hasVendorPrefix,
|
|
1214
|
+
Zt as isAccessibilitySelector,
|
|
1215
|
+
ui as isMediaBrowserhack,
|
|
1216
|
+
qi as isPropertyHack,
|
|
1217
|
+
ci as isSelectorPrefixed,
|
|
1218
|
+
oi as isSupportsBrowserhack,
|
|
1219
|
+
Xt as isValuePrefixed,
|
|
1220
|
+
Jt as selectorComplexity
|
|
1214
1221
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -44,7 +44,21 @@ export function analyze(css: string, options?: Options): {
|
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
|
-
atrules: {
|
|
47
|
+
atrules: ({
|
|
48
|
+
total: number;
|
|
49
|
+
totalUnique: number;
|
|
50
|
+
uniquenessRatio: number;
|
|
51
|
+
unique: Record<string, number>;
|
|
52
|
+
} & ({
|
|
53
|
+
uniqueWithLocations: Record<string, {
|
|
54
|
+
line: number;
|
|
55
|
+
column: number;
|
|
56
|
+
offset: number;
|
|
57
|
+
length: number;
|
|
58
|
+
}[]>;
|
|
59
|
+
} | {
|
|
60
|
+
uniqueWithLocations?: undefined;
|
|
61
|
+
})) & {
|
|
48
62
|
fontface: {
|
|
49
63
|
total: number;
|
|
50
64
|
totalUnique: number;
|
|
@@ -261,7 +275,6 @@ export function analyze(css: string, options?: Options): {
|
|
|
261
275
|
} | {
|
|
262
276
|
uniqueWithLocations?: undefined;
|
|
263
277
|
});
|
|
264
|
-
total: number;
|
|
265
278
|
complexity: {
|
|
266
279
|
min: number | undefined;
|
|
267
280
|
max: number | undefined;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@projectwallace/css-analyzer",
|
|
3
3
|
"description": "The best CSS analyzer out there. Check design tokens, complexity, specificity, performance and more.",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.5.1",
|
|
5
5
|
"author": "Bart Veneman",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|