@projectwallace/css-analyzer 7.0.0 → 7.0.2
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 +349 -338
- package/package.json +5 -7
package/dist/css-analyzer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Dt from "css-tree/parser";
|
|
2
|
-
import
|
|
2
|
+
import q from "css-tree/walker";
|
|
3
3
|
import { calculateForAST as Ft } from "@bramus/specificity/core";
|
|
4
|
-
function
|
|
4
|
+
function Ee(i, t) {
|
|
5
5
|
return t >= 65 && t <= 90 && (t = t | 32), i === t;
|
|
6
6
|
}
|
|
7
7
|
function z(i, t) {
|
|
@@ -9,7 +9,7 @@ function z(i, t) {
|
|
|
9
9
|
let r = i.length;
|
|
10
10
|
if (r !== t.length) return !1;
|
|
11
11
|
for (let e = 0; e < r; e++)
|
|
12
|
-
if (
|
|
12
|
+
if (Ee(i.charCodeAt(e), t.charCodeAt(e)) === !1)
|
|
13
13
|
return !1;
|
|
14
14
|
return !0;
|
|
15
15
|
}
|
|
@@ -18,57 +18,56 @@ function L(i, t) {
|
|
|
18
18
|
let r = t.length, e = r - i.length;
|
|
19
19
|
if (e < 0)
|
|
20
20
|
return !1;
|
|
21
|
-
for (let
|
|
22
|
-
if (
|
|
21
|
+
for (let l = r - 1; l >= e; l--)
|
|
22
|
+
if (Ee(i.charCodeAt(l - e), t.charCodeAt(l)) === !1)
|
|
23
23
|
return !1;
|
|
24
24
|
return !0;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function De(i, t) {
|
|
27
27
|
if (i === t) return !0;
|
|
28
28
|
let r = i.length;
|
|
29
29
|
if (t.length < r) return !1;
|
|
30
30
|
for (let e = 0; e < r; e++)
|
|
31
|
-
if (
|
|
31
|
+
if (Ee(i.charCodeAt(e), t.charCodeAt(e)) === !1)
|
|
32
32
|
return !1;
|
|
33
33
|
return !0;
|
|
34
34
|
}
|
|
35
|
-
const
|
|
36
|
-
function
|
|
35
|
+
const Tt = "Atrule", Mt = "MediaQuery", Ut = "Rule", Fe = "Selector", _t = "TypeSelector", Y = "PseudoClassSelector", St = "AttributeSelector", vt = "PseudoElementSelector", Re = "Declaration", It = "Value", O = "Identifier", Ht = "Nth", Vt = "Combinator", Wt = "Number", qt = "Dimension", V = "Operator", Kt = "Hash", jt = "Url", Te = "Function";
|
|
36
|
+
function bt(i, t, r) {
|
|
37
37
|
let e = i.value.children.first;
|
|
38
|
-
return z(t, i.property) && e.type ===
|
|
38
|
+
return z(t, i.property) && e.type === O && z(r, e.name);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Bt(i) {
|
|
41
41
|
let t = !1;
|
|
42
|
-
return
|
|
43
|
-
if (r.type ===
|
|
42
|
+
return q(i, function(r) {
|
|
43
|
+
if (r.type === Re && (bt(r, "-webkit-appearance", "none") || bt(r, "-moz-appearance", "meterbar")))
|
|
44
44
|
return t = !0, this.break;
|
|
45
45
|
}), t;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Yt(i) {
|
|
48
48
|
let t = !1;
|
|
49
|
-
return
|
|
50
|
-
let e = r.
|
|
51
|
-
if (r.type ===
|
|
52
|
-
|
|
53
|
-
if (Ee("\\0", d) || L("\\9 ", d))
|
|
49
|
+
return q(i, function(r) {
|
|
50
|
+
let e = r.name, l = r.value;
|
|
51
|
+
if (r.type === Mt && r.mediaType !== null) {
|
|
52
|
+
if (De("\\0", r.mediaType) || L("\\9 ", r.mediaType))
|
|
54
53
|
return t = !0, this.break;
|
|
55
|
-
} else if (r.type ===
|
|
54
|
+
} else if (r.type === "Feature" && r.kind === "media") {
|
|
56
55
|
if (l && l.unit && l.unit === "\\0")
|
|
57
56
|
return t = !0, this.break;
|
|
58
|
-
if (z("-moz-images-in-menus",
|
|
57
|
+
if (z("-moz-images-in-menus", e) || z("min--moz-device-pixel-ratio", e) || z("-ms-high-contrast", e))
|
|
59
58
|
return t = !0, this.break;
|
|
60
|
-
if (z("min-resolution",
|
|
59
|
+
if (z("min-resolution", e) && l && z(".001", l.value) && z("dpcm", l.unit))
|
|
61
60
|
return t = !0, this.break;
|
|
62
|
-
if (z("-webkit-min-device-pixel-ratio",
|
|
61
|
+
if (z("-webkit-min-device-pixel-ratio", e) && l && l.value && (z("0", l.value) || z("10000", l.value)))
|
|
63
62
|
return t = !0, this.break;
|
|
64
63
|
}
|
|
65
64
|
}), t;
|
|
66
65
|
}
|
|
67
66
|
const xt = 45;
|
|
68
|
-
function
|
|
67
|
+
function D(i) {
|
|
69
68
|
return i.charCodeAt(0) === xt && i.charCodeAt(1) !== xt && i.indexOf("-", 2) !== -1;
|
|
70
69
|
}
|
|
71
|
-
class
|
|
70
|
+
class A {
|
|
72
71
|
/** @param {string[]} items */
|
|
73
72
|
constructor(t) {
|
|
74
73
|
this.set = new Set(t);
|
|
@@ -80,14 +79,14 @@ class q {
|
|
|
80
79
|
}
|
|
81
80
|
function At(i, t) {
|
|
82
81
|
let r = [];
|
|
83
|
-
return
|
|
84
|
-
visit:
|
|
82
|
+
return q(i, {
|
|
83
|
+
visit: Fe,
|
|
85
84
|
enter: function(e) {
|
|
86
85
|
r.push(t(e));
|
|
87
86
|
}
|
|
88
87
|
}), r;
|
|
89
88
|
}
|
|
90
|
-
const Pt = new
|
|
89
|
+
const Pt = new A([
|
|
91
90
|
"nth-child",
|
|
92
91
|
"where",
|
|
93
92
|
"not",
|
|
@@ -100,15 +99,15 @@ const Pt = new q([
|
|
|
100
99
|
]);
|
|
101
100
|
function Lt(i) {
|
|
102
101
|
let t = !1;
|
|
103
|
-
return
|
|
102
|
+
return q(i, function(r) {
|
|
104
103
|
if (r.type === St) {
|
|
105
104
|
let e = r.name.name;
|
|
106
|
-
if (z("role", e) ||
|
|
105
|
+
if (z("role", e) || De("aria-", e))
|
|
107
106
|
return t = !0, this.break;
|
|
108
107
|
} else if (r.type === Y && Pt.has(r.name)) {
|
|
109
108
|
let e = At(r, Lt);
|
|
110
|
-
for (let
|
|
111
|
-
if (
|
|
109
|
+
for (let l of e)
|
|
110
|
+
if (l === !0) {
|
|
112
111
|
t = !0;
|
|
113
112
|
break;
|
|
114
113
|
}
|
|
@@ -116,67 +115,67 @@ function Lt(i) {
|
|
|
116
115
|
}
|
|
117
116
|
}), t;
|
|
118
117
|
}
|
|
119
|
-
function
|
|
118
|
+
function Gt(i) {
|
|
120
119
|
let t = !1;
|
|
121
|
-
return
|
|
120
|
+
return q(i, function(r) {
|
|
122
121
|
let e = r.type;
|
|
123
|
-
if ((e === vt || e ===
|
|
122
|
+
if ((e === vt || e === _t || e === Y) && D(r.name))
|
|
124
123
|
return t = !0, this.break;
|
|
125
124
|
}), t;
|
|
126
125
|
}
|
|
127
|
-
function
|
|
126
|
+
function Qt(i) {
|
|
128
127
|
let t = [];
|
|
129
|
-
return
|
|
128
|
+
return q(i, function(r) {
|
|
130
129
|
r.type === Y && t.push(r.name);
|
|
131
130
|
}), t.length === 0 ? !1 : t;
|
|
132
131
|
}
|
|
133
132
|
function Ot(i) {
|
|
134
133
|
let t = 0;
|
|
135
|
-
return
|
|
134
|
+
return q(i, function(r) {
|
|
136
135
|
let e = r.type;
|
|
137
|
-
if (!(e ===
|
|
138
|
-
if (t++, (e === vt || e ===
|
|
136
|
+
if (!(e === Fe || e === Ht)) {
|
|
137
|
+
if (t++, (e === vt || e === _t || e === Y) && D(r.name) && t++, e === St)
|
|
139
138
|
return r.value && t++, this.skip;
|
|
140
139
|
if (e === Y && Pt.has(r.name)) {
|
|
141
|
-
let
|
|
142
|
-
if (
|
|
143
|
-
for (let
|
|
144
|
-
t +=
|
|
140
|
+
let l = At(r, Ot);
|
|
141
|
+
if (l.length === 0) return;
|
|
142
|
+
for (let n of l)
|
|
143
|
+
t += n;
|
|
145
144
|
return this.skip;
|
|
146
145
|
}
|
|
147
146
|
}
|
|
148
147
|
}), t;
|
|
149
148
|
}
|
|
150
|
-
function
|
|
151
|
-
|
|
152
|
-
if (r.type ===
|
|
153
|
-
let
|
|
154
|
-
if (
|
|
155
|
-
let
|
|
156
|
-
offset:
|
|
157
|
-
line:
|
|
158
|
-
column:
|
|
149
|
+
function Zt(i, t) {
|
|
150
|
+
q(i, function(r, e) {
|
|
151
|
+
if (r.type === Vt) {
|
|
152
|
+
let l = r.loc, n = r.name;
|
|
153
|
+
if (l === null) {
|
|
154
|
+
let g = e.prev.data.loc.end, w = {
|
|
155
|
+
offset: g.offset,
|
|
156
|
+
line: g.line,
|
|
157
|
+
column: g.column
|
|
159
158
|
};
|
|
160
159
|
t({
|
|
161
|
-
name:
|
|
160
|
+
name: n,
|
|
162
161
|
loc: {
|
|
163
|
-
start:
|
|
162
|
+
start: w,
|
|
164
163
|
end: {
|
|
165
|
-
offset:
|
|
166
|
-
line:
|
|
167
|
-
column:
|
|
164
|
+
offset: w.offset + 1,
|
|
165
|
+
line: w.line,
|
|
166
|
+
column: w.column + 1
|
|
168
167
|
}
|
|
169
168
|
}
|
|
170
169
|
});
|
|
171
170
|
} else
|
|
172
171
|
t({
|
|
173
|
-
name:
|
|
174
|
-
loc:
|
|
172
|
+
name: n,
|
|
173
|
+
loc: l
|
|
175
174
|
});
|
|
176
175
|
}
|
|
177
176
|
});
|
|
178
177
|
}
|
|
179
|
-
const
|
|
178
|
+
const Jt = new A([
|
|
180
179
|
// CSS Named Colors
|
|
181
180
|
// Spec: https://drafts.csswg.org/css-color/#named-colors
|
|
182
181
|
// Heuristic: popular names first for quick finding in set.has()
|
|
@@ -329,7 +328,7 @@ const Xt = new q([
|
|
|
329
328
|
"mediumorchid",
|
|
330
329
|
"darksalmon",
|
|
331
330
|
"mediumspringgreen"
|
|
332
|
-
]),
|
|
331
|
+
]), Xt = new A([
|
|
333
332
|
// CSS System Colors
|
|
334
333
|
// Spec: https://drafts.csswg.org/css-color/#css-system-colors
|
|
335
334
|
"accentcolor",
|
|
@@ -351,7 +350,7 @@ const Xt = new q([
|
|
|
351
350
|
"selecteditem",
|
|
352
351
|
"selecteditemtext",
|
|
353
352
|
"visitedtext"
|
|
354
|
-
]),
|
|
353
|
+
]), $t = new A([
|
|
355
354
|
"rgba",
|
|
356
355
|
"rgb",
|
|
357
356
|
"hsla",
|
|
@@ -362,10 +361,10 @@ const Xt = new q([
|
|
|
362
361
|
"lch",
|
|
363
362
|
"lab",
|
|
364
363
|
"oklab"
|
|
365
|
-
]),
|
|
364
|
+
]), Nt = new A([
|
|
366
365
|
"transparent",
|
|
367
366
|
"currentcolor"
|
|
368
|
-
]), N = new
|
|
367
|
+
]), N = new A([
|
|
369
368
|
"auto",
|
|
370
369
|
"none",
|
|
371
370
|
// for `text-shadow`, `box-shadow` and `background`
|
|
@@ -379,16 +378,16 @@ function $(i) {
|
|
|
379
378
|
let t = i.children, r = t.size;
|
|
380
379
|
if (!t || r > 1 || r === 0) return !1;
|
|
381
380
|
let e = t.first;
|
|
382
|
-
return e.type ===
|
|
381
|
+
return e.type === O && N.has(e.name);
|
|
383
382
|
}
|
|
384
|
-
const
|
|
383
|
+
const ei = new A([
|
|
385
384
|
"caption",
|
|
386
385
|
"icon",
|
|
387
386
|
"menu",
|
|
388
387
|
"message-box",
|
|
389
388
|
"small-caption",
|
|
390
389
|
"status-bar"
|
|
391
|
-
]),
|
|
390
|
+
]), ti = new A([
|
|
392
391
|
/* <absolute-size> values */
|
|
393
392
|
"xx-small",
|
|
394
393
|
"x-small",
|
|
@@ -401,61 +400,64 @@ const ti = new q([
|
|
|
401
400
|
/* <relative-size> values */
|
|
402
401
|
"smaller",
|
|
403
402
|
"larger"
|
|
404
|
-
]),
|
|
405
|
-
function
|
|
403
|
+
]), ii = 44, Ct = 47;
|
|
404
|
+
function Le(i) {
|
|
406
405
|
let t = i.children.first;
|
|
407
|
-
return t === null ? !1 : t.type ===
|
|
406
|
+
return t === null ? !1 : t.type === O && ei.has(t.name);
|
|
408
407
|
}
|
|
409
|
-
function
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
408
|
+
function ri(i, t, r) {
|
|
409
|
+
var w;
|
|
410
|
+
let e = Array.from({ length: 2 }), l, n;
|
|
411
|
+
i.children.forEach(function(d, _) {
|
|
412
|
+
let y = _.prev ? _.prev.data : void 0, P = _.next ? _.next.data : void 0;
|
|
413
|
+
if (d.type === O && N.has(d.name) && r({
|
|
414
414
|
type: "keyword",
|
|
415
|
-
value:
|
|
416
|
-
}),
|
|
417
|
-
|
|
415
|
+
value: d.name
|
|
416
|
+
}), P && P.type === V && P.value.charCodeAt(0) === Ct) {
|
|
417
|
+
l = t(d);
|
|
418
418
|
return;
|
|
419
419
|
}
|
|
420
|
-
if (
|
|
421
|
-
|
|
420
|
+
if (y && y.type === V && y.value.charCodeAt(0) === Ct) {
|
|
421
|
+
n = t(d);
|
|
422
422
|
return;
|
|
423
423
|
}
|
|
424
|
-
if (
|
|
425
|
-
e[0] =
|
|
424
|
+
if (P && P.type === V && P.value.charCodeAt(0) === ii && !e[0]) {
|
|
425
|
+
e[0] = d, !l && y && (l = t(y));
|
|
426
426
|
return;
|
|
427
427
|
}
|
|
428
|
-
if (
|
|
429
|
-
if (
|
|
430
|
-
e[1] =
|
|
428
|
+
if (d.type !== Wt) {
|
|
429
|
+
if (_.next === null) {
|
|
430
|
+
e[1] = d, !l && !e[0] && y && (l = t(y));
|
|
431
431
|
return;
|
|
432
432
|
}
|
|
433
|
-
if (
|
|
434
|
-
let
|
|
435
|
-
if (
|
|
436
|
-
|
|
433
|
+
if (d.type === O) {
|
|
434
|
+
let R = d.name;
|
|
435
|
+
if (ti.has(R)) {
|
|
436
|
+
l = R;
|
|
437
437
|
return;
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
});
|
|
442
|
-
let
|
|
442
|
+
let g = e[0] || e[1] ? t({
|
|
443
443
|
loc: {
|
|
444
444
|
start: {
|
|
445
445
|
offset: (e[0] || e[1]).loc.start.offset
|
|
446
446
|
},
|
|
447
447
|
end: {
|
|
448
|
-
|
|
448
|
+
// Either the node we detected as the last node, or the end of the whole value
|
|
449
|
+
// It's never 0 because the first node is always a font-size or font-style
|
|
450
|
+
offset: ((w = e[1]) == null ? void 0 : w.loc.end.offset) || i.loc.end.offset
|
|
449
451
|
}
|
|
450
452
|
}
|
|
451
453
|
}) : null;
|
|
452
454
|
return {
|
|
453
|
-
font_size:
|
|
454
|
-
line_height:
|
|
455
|
-
font_family:
|
|
455
|
+
font_size: l,
|
|
456
|
+
line_height: n,
|
|
457
|
+
font_family: g
|
|
456
458
|
};
|
|
457
459
|
}
|
|
458
|
-
const
|
|
460
|
+
const si = new A([
|
|
459
461
|
"linear",
|
|
460
462
|
"ease",
|
|
461
463
|
"ease-in",
|
|
@@ -463,24 +465,24 @@ const li = new q([
|
|
|
463
465
|
"ease-in-out",
|
|
464
466
|
"step-start",
|
|
465
467
|
"step-end"
|
|
466
|
-
]),
|
|
468
|
+
]), li = new A([
|
|
467
469
|
"cubic-bezier",
|
|
468
470
|
"steps"
|
|
469
471
|
]);
|
|
470
|
-
function
|
|
472
|
+
function ni(i, t) {
|
|
471
473
|
let r = !1;
|
|
472
474
|
for (let e of i) {
|
|
473
|
-
let
|
|
474
|
-
|
|
475
|
+
let l = e.type, n = e.name;
|
|
476
|
+
l === V ? r = !1 : l === qt && r === !1 ? (r = !0, t({
|
|
475
477
|
type: "duration",
|
|
476
478
|
value: e
|
|
477
|
-
})) :
|
|
479
|
+
})) : l === O ? si.has(n) ? t({
|
|
478
480
|
type: "fn",
|
|
479
481
|
value: e
|
|
480
|
-
}) : N.has(
|
|
482
|
+
}) : N.has(n) && t({
|
|
481
483
|
type: "keyword",
|
|
482
484
|
value: e
|
|
483
|
-
}) :
|
|
485
|
+
}) : l === Te && li.has(n) && t({
|
|
484
486
|
type: "fn",
|
|
485
487
|
value: e
|
|
486
488
|
});
|
|
@@ -491,13 +493,13 @@ function Rt(i) {
|
|
|
491
493
|
if (!t)
|
|
492
494
|
return !1;
|
|
493
495
|
for (let r of t) {
|
|
494
|
-
let { type: e, name:
|
|
495
|
-
if (e ===
|
|
496
|
+
let { type: e, name: l } = r;
|
|
497
|
+
if (e === O && D(l) || e === Te && (D(l) || Rt(r)))
|
|
496
498
|
return !0;
|
|
497
499
|
}
|
|
498
500
|
return !1;
|
|
499
501
|
}
|
|
500
|
-
class
|
|
502
|
+
class u {
|
|
501
503
|
/** @param {boolean} useLocations */
|
|
502
504
|
constructor(t = !1) {
|
|
503
505
|
this._items = /* @__PURE__ */ new Map(), this._total = 0, t && (this._nodes = []), this._useLocations = t;
|
|
@@ -509,8 +511,8 @@ class o {
|
|
|
509
511
|
p(t, r) {
|
|
510
512
|
let e = this._total;
|
|
511
513
|
if (this._useLocations) {
|
|
512
|
-
let
|
|
513
|
-
this._nodes[
|
|
514
|
+
let l = r.start, n = l.offset, g = e * 4;
|
|
515
|
+
this._nodes[g] = l.line, this._nodes[g + 1] = l.column, this._nodes[g + 2] = n, this._nodes[g + 3] = r.end.offset - n;
|
|
514
516
|
}
|
|
515
517
|
if (this._items.has(t)) {
|
|
516
518
|
this._items.get(t).push(e), this._total++;
|
|
@@ -540,35 +542,35 @@ class o {
|
|
|
540
542
|
* })}
|
|
541
543
|
*/
|
|
542
544
|
c() {
|
|
543
|
-
let t = /* @__PURE__ */ new Map(), r = {}, e = this._useLocations,
|
|
544
|
-
|
|
545
|
+
let t = /* @__PURE__ */ new Map(), r = {}, e = this._useLocations, l = this._items, n = this._nodes, g = l.size;
|
|
546
|
+
l.forEach((_, y) => {
|
|
545
547
|
if (e) {
|
|
546
|
-
let
|
|
547
|
-
let
|
|
548
|
+
let P = _.map(function(R) {
|
|
549
|
+
let F = R * 4;
|
|
548
550
|
return {
|
|
549
|
-
line:
|
|
550
|
-
column:
|
|
551
|
-
offset:
|
|
552
|
-
length:
|
|
551
|
+
line: n[F],
|
|
552
|
+
column: n[F + 1],
|
|
553
|
+
offset: n[F + 2],
|
|
554
|
+
length: n[F + 3]
|
|
553
555
|
};
|
|
554
556
|
});
|
|
555
|
-
t.set(y,
|
|
557
|
+
t.set(y, P);
|
|
556
558
|
} else
|
|
557
|
-
r[y] =
|
|
559
|
+
r[y] = _.length;
|
|
558
560
|
});
|
|
559
|
-
let
|
|
560
|
-
total:
|
|
561
|
-
totalUnique:
|
|
561
|
+
let w = this._total, d = {
|
|
562
|
+
total: w,
|
|
563
|
+
totalUnique: g,
|
|
562
564
|
unique: r,
|
|
563
|
-
uniquenessRatio:
|
|
565
|
+
uniquenessRatio: w === 0 ? 0 : g / w
|
|
564
566
|
};
|
|
565
|
-
return e && (
|
|
567
|
+
return e && (d.uniqueWithLocations = Object.fromEntries(t)), d;
|
|
566
568
|
}
|
|
567
569
|
}
|
|
568
|
-
class
|
|
570
|
+
class Oe {
|
|
569
571
|
/** @param {boolean} useLocations */
|
|
570
572
|
constructor(t) {
|
|
571
|
-
this._list = new
|
|
573
|
+
this._list = new u(t), this._contexts = /* @__PURE__ */ new Map(), this._useLocations = t;
|
|
572
574
|
}
|
|
573
575
|
/**
|
|
574
576
|
* Add an item to this _list's context
|
|
@@ -577,7 +579,7 @@ class Le {
|
|
|
577
579
|
* @param {import('css-tree').CssLocation} node_location
|
|
578
580
|
*/
|
|
579
581
|
push(t, r, e) {
|
|
580
|
-
this._list.p(t, e), this._contexts.has(r) || this._contexts.set(r, new
|
|
582
|
+
this._list.p(t, e), this._contexts.has(r) || this._contexts.set(r, new u(this._useLocations)), this._contexts.get(r).p(t, e);
|
|
581
583
|
}
|
|
582
584
|
count() {
|
|
583
585
|
let t = /* @__PURE__ */ new Map();
|
|
@@ -588,13 +590,13 @@ class Le {
|
|
|
588
590
|
});
|
|
589
591
|
}
|
|
590
592
|
}
|
|
591
|
-
function
|
|
592
|
-
let t = /* @__PURE__ */ new Map(), r = -1, e = 0,
|
|
593
|
-
for (let
|
|
594
|
-
let
|
|
595
|
-
t.set(
|
|
593
|
+
function ai(i) {
|
|
594
|
+
let t = /* @__PURE__ */ new Map(), r = -1, e = 0, l = 0, n = i.length;
|
|
595
|
+
for (let g = 0; g < n; g++) {
|
|
596
|
+
let w = i[g], d = (t.get(w) || 0) + 1;
|
|
597
|
+
t.set(w, d), d > r && (r = d, e = 0, l = 0), d >= r && (e++, l += w);
|
|
596
598
|
}
|
|
597
|
-
return
|
|
599
|
+
return l / e;
|
|
598
600
|
}
|
|
599
601
|
class v {
|
|
600
602
|
constructor() {
|
|
@@ -621,14 +623,14 @@ class v {
|
|
|
621
623
|
range: 0,
|
|
622
624
|
sum: 0
|
|
623
625
|
};
|
|
624
|
-
let r = this._items.slice().sort((
|
|
626
|
+
let r = this._items.slice().sort((w, d) => w - d), e = r[0], l = r[t - 1], n = ai(r), g = this._sum;
|
|
625
627
|
return {
|
|
626
628
|
min: e,
|
|
627
|
-
max:
|
|
628
|
-
mean:
|
|
629
|
-
mode:
|
|
630
|
-
range:
|
|
631
|
-
sum:
|
|
629
|
+
max: l,
|
|
630
|
+
mean: g / t,
|
|
631
|
+
mode: n,
|
|
632
|
+
range: l - e,
|
|
633
|
+
sum: g
|
|
632
634
|
};
|
|
633
635
|
}
|
|
634
636
|
/**
|
|
@@ -638,33 +640,33 @@ class v {
|
|
|
638
640
|
return this._items;
|
|
639
641
|
}
|
|
640
642
|
}
|
|
641
|
-
function
|
|
642
|
-
if (Me(i) ||
|
|
643
|
+
function oi(i) {
|
|
644
|
+
if (Me(i) || D(i)) return !1;
|
|
643
645
|
let t = i.charCodeAt(0);
|
|
644
646
|
return t === 47 || t === 42 || t === 95 || t === 43 || t === 38 || t === 36 || t === 35;
|
|
645
647
|
}
|
|
646
648
|
function Me(i) {
|
|
647
649
|
return i.length < 3 ? !1 : i.charCodeAt(0) === 45 && i.charCodeAt(1) === 45;
|
|
648
650
|
}
|
|
649
|
-
function
|
|
651
|
+
function C(i, t) {
|
|
650
652
|
return Me(t) ? !1 : L(i, t);
|
|
651
653
|
}
|
|
652
|
-
function
|
|
653
|
-
return
|
|
654
|
+
function ui(i) {
|
|
655
|
+
return D(i) ? i.slice(i.indexOf("-", 2) + 1) : i;
|
|
654
656
|
}
|
|
655
|
-
function
|
|
657
|
+
function ci(i) {
|
|
656
658
|
let t = 5, r = i.indexOf(";"), e = i.indexOf(",");
|
|
657
659
|
return r === -1 || e !== -1 && e < r ? i.substring(t, e) : i.substring(t, r);
|
|
658
660
|
}
|
|
659
|
-
function
|
|
661
|
+
function fi(i) {
|
|
660
662
|
let t = i.children;
|
|
661
663
|
if (t) {
|
|
662
664
|
let r = t.last;
|
|
663
|
-
return r && r.type ===
|
|
665
|
+
return r && r.type === O && L("\\9", r.name);
|
|
664
666
|
}
|
|
665
667
|
return !1;
|
|
666
668
|
}
|
|
667
|
-
let
|
|
669
|
+
let pi = new A([
|
|
668
670
|
"border-radius",
|
|
669
671
|
"border-top-left-radius",
|
|
670
672
|
"border-top-right-radius",
|
|
@@ -678,78 +680,87 @@ let hi = new q([
|
|
|
678
680
|
function x(i, t) {
|
|
679
681
|
return t === 0 ? 0 : i / t;
|
|
680
682
|
}
|
|
681
|
-
let
|
|
683
|
+
let hi = {
|
|
682
684
|
useLocations: !1
|
|
683
685
|
};
|
|
684
|
-
function
|
|
685
|
-
let e = Object.assign({},
|
|
686
|
-
function
|
|
687
|
-
return
|
|
686
|
+
function yi(i, t = {}) {
|
|
687
|
+
let e = Object.assign({}, hi, t).useLocations === !0, l = Date.now();
|
|
688
|
+
function n(s) {
|
|
689
|
+
return g(s).trim();
|
|
688
690
|
}
|
|
689
|
-
function
|
|
691
|
+
function g(s) {
|
|
690
692
|
let f = s.loc;
|
|
691
693
|
return i.substring(f.start.offset, f.end.offset);
|
|
692
694
|
}
|
|
693
|
-
let
|
|
695
|
+
let w = 0, d = 0, _ = 0, y = {
|
|
694
696
|
total: 0,
|
|
695
697
|
/** @type {Map<string, { size: number, count: number } & ({ uniqueWithLocations?: undefined } | ({ uniqueWithLocations: { offset: number, line: number, column: number, length: number }[] })) }>} */
|
|
696
698
|
unique: /* @__PURE__ */ new Map()
|
|
697
|
-
},
|
|
699
|
+
}, P = Date.now(), R = Dt(i, {
|
|
698
700
|
parseCustomProperty: !0,
|
|
699
701
|
// To find font-families, colors, etc.
|
|
700
702
|
positions: !0,
|
|
701
703
|
// So we can use stringifyNode()
|
|
702
704
|
/** @param {string} comment */
|
|
703
705
|
onComment: function(s) {
|
|
704
|
-
|
|
706
|
+
w++, d += s.length;
|
|
705
707
|
}
|
|
706
|
-
}),
|
|
707
|
-
|
|
708
|
+
}), F = Date.now(), Et = R.loc.end.line - R.loc.start.line + 1, ee = 0, te = new v(), ie = [], Ue = new u(e), re = new u(e), Ie = new u(e), He = new u(e), Ve = new u(e), We = new u(e), se = new u(e), Ke = new u(e), le = new u(e), ne = new u(e), je = new u(e), Be = new u(e), ae = 0, oe = 0, ue = new v(), ce = new v(), fe = new v(), Ye = new u(e), Ge = new u(e), Qe = new u(e), pe = new u(e), Ze = /* @__PURE__ */ new Set(), he = new u(e), T, M, Je = new v(), Xe = new v(), $e = new v(), Ne = new u(e), G = new v(), et = new u(e), tt = [], me = new u(e), ge = new u(e), it = new u(e), rt = new u(e), st = /* @__PURE__ */ new Set(), W = 0, lt = new v(), Q = 0, de = 0, ye = new u(e), K = new u(e), we = new u(e), ke = new u(e), Z = new u(e), j = new v(), be = new v(), nt = new u(e), xe = new u(e), at = new u(e), ot = new u(e), ut = new u(e), Ce = new u(e), ze = new u(e), _e = new u(e), J = new u(e), X = new u(e), U = new Oe(e), I = new u(e), Se = new Oe(e), ct = new u(e), B = new u(e), ft = new Oe(e);
|
|
709
|
+
q(R, function(s) {
|
|
708
710
|
switch (s.type) {
|
|
709
|
-
case
|
|
711
|
+
case Tt: {
|
|
710
712
|
ee++;
|
|
711
713
|
let f = s.name;
|
|
712
714
|
if (f === "font-face") {
|
|
713
|
-
let
|
|
714
|
-
e && Ue.p(s.loc.start.offset, s.loc), s.block.children.forEach((
|
|
715
|
-
|
|
716
|
-
}), ie.push(
|
|
715
|
+
let m = {};
|
|
716
|
+
e && Ue.p(s.loc.start.offset, s.loc), s.block.children.forEach((c) => {
|
|
717
|
+
c.type === Re && (m[c.property] = n(c.value));
|
|
718
|
+
}), ie.push(m), te.push(1);
|
|
717
719
|
break;
|
|
718
720
|
}
|
|
719
721
|
let a = 1;
|
|
720
722
|
if (s.prelude !== null) {
|
|
721
|
-
let
|
|
723
|
+
let m = s.prelude, c = m && n(s.prelude), p = m.loc;
|
|
722
724
|
if (f === "media")
|
|
723
|
-
|
|
725
|
+
He.p(c, p), Yt(m) && (Ve.p(c, p), a++);
|
|
724
726
|
else if (f === "supports")
|
|
725
|
-
|
|
727
|
+
se.p(c, p), Bt(m) && (Ke.p(c, p), a++);
|
|
726
728
|
else if (L("keyframes", f)) {
|
|
727
|
-
let
|
|
728
|
-
|
|
729
|
-
} else f === "import" ?
|
|
729
|
+
let o = "@" + f + " " + c;
|
|
730
|
+
D(f) && (ne.p(o, p), a++), le.p(o, p);
|
|
731
|
+
} else f === "import" ? (q(s, function(o) {
|
|
732
|
+
if (o.type === "Condition" && o.kind === "supports") {
|
|
733
|
+
let h = n(o);
|
|
734
|
+
return se.p(h, o.loc), this.break;
|
|
735
|
+
}
|
|
736
|
+
}), Ie.p(c, p)) : f === "charset" ? We.p(c, p) : f === "container" ? je.p(c, p) : f === "property" && Be.p(c, p);
|
|
730
737
|
} else
|
|
731
738
|
f === "layer" && (re.p("<anonymous>", s.loc), a++);
|
|
732
739
|
te.push(a);
|
|
733
740
|
break;
|
|
734
741
|
}
|
|
735
|
-
case
|
|
736
|
-
|
|
737
|
-
|
|
742
|
+
case "Layer": {
|
|
743
|
+
s.name !== null && re.p(s.name, s.loc);
|
|
744
|
+
break;
|
|
745
|
+
}
|
|
746
|
+
case Ut: {
|
|
747
|
+
let f = s.prelude, a = s.block, m = f.children, c = a.children, p = m ? m.size : 0, o = c ? c.size : 0;
|
|
748
|
+
ue.push(p + o), Ye.p(p + o, s.loc), ce.push(p), Ge.p(p, f.loc), fe.push(o), Qe.p(o, a.loc), ae++, o === 0 && oe++;
|
|
738
749
|
break;
|
|
739
750
|
}
|
|
740
|
-
case
|
|
741
|
-
let f =
|
|
751
|
+
case Fe: {
|
|
752
|
+
let f = n(s);
|
|
742
753
|
if (this.atrule && L("keyframes", this.atrule.name))
|
|
743
|
-
return
|
|
744
|
-
Lt(s) &&
|
|
745
|
-
let a =
|
|
754
|
+
return pe.p(f, s.loc), this.skip;
|
|
755
|
+
Lt(s) && ge.p(f, s.loc);
|
|
756
|
+
let a = Qt(s);
|
|
746
757
|
if (a !== !1)
|
|
747
|
-
for (let
|
|
748
|
-
it.p(
|
|
749
|
-
let
|
|
750
|
-
|
|
751
|
-
let
|
|
752
|
-
return Ne.p(
|
|
758
|
+
for (let b of a)
|
|
759
|
+
it.p(b, s.loc);
|
|
760
|
+
let m = Ot(s);
|
|
761
|
+
Gt(s) && he.p(f, s.loc), Ze.add(f), G.push(m), et.p(m, s.loc);
|
|
762
|
+
let c = Ft(s).toArray(), [p, o, h] = c;
|
|
763
|
+
return Ne.p(c.toString(), s.loc), Je.push(p), Xe.push(o), $e.push(h), T === void 0 && (T = c), M === void 0 && (M = c), M !== void 0 && zt(M, c) < 0 && (M = c), T !== void 0 && zt(T, c) > 0 && (T = c), tt.push(c), p > 0 && me.p(f, s.loc), Zt(s, function(S) {
|
|
753
764
|
rt.p(S.name, S.loc);
|
|
754
765
|
}), this.skip;
|
|
755
766
|
}
|
|
@@ -757,13 +768,13 @@ function wi(i, t = {}) {
|
|
|
757
768
|
if (!this.declaration)
|
|
758
769
|
break;
|
|
759
770
|
let f = s.unit;
|
|
760
|
-
return L("\\9", f) ?
|
|
771
|
+
return L("\\9", f) ? Se.push(f.substring(0, f.length - 2), this.declaration.property, s.loc) : Se.push(f, this.declaration.property, s.loc), this.skip;
|
|
761
772
|
}
|
|
762
|
-
case
|
|
763
|
-
if (
|
|
764
|
-
let f = s.value, a = f.length,
|
|
765
|
-
y.total++,
|
|
766
|
-
let
|
|
773
|
+
case jt: {
|
|
774
|
+
if (De("data:", s.value)) {
|
|
775
|
+
let f = s.value, a = f.length, m = ci(f);
|
|
776
|
+
y.total++, _ += a;
|
|
777
|
+
let c = {
|
|
767
778
|
/** @type {number} */
|
|
768
779
|
line: s.loc.start.line,
|
|
769
780
|
/** @type {number} */
|
|
@@ -773,101 +784,101 @@ function wi(i, t = {}) {
|
|
|
773
784
|
/** @type {number} */
|
|
774
785
|
length: s.loc.end.offset - s.loc.start.offset
|
|
775
786
|
};
|
|
776
|
-
if (y.unique.has(
|
|
777
|
-
let p = y.unique.get(
|
|
778
|
-
p.count++, p.size += a, y.unique.set(
|
|
787
|
+
if (y.unique.has(m)) {
|
|
788
|
+
let p = y.unique.get(m);
|
|
789
|
+
p.count++, p.size += a, y.unique.set(m, p), e && p.uniqueWithLocations.push(c);
|
|
779
790
|
} else {
|
|
780
791
|
let p = {
|
|
781
792
|
count: 1,
|
|
782
793
|
size: a
|
|
783
794
|
};
|
|
784
|
-
e && (p.uniqueWithLocations = [
|
|
795
|
+
e && (p.uniqueWithLocations = [c]), y.unique.set(m, p);
|
|
785
796
|
}
|
|
786
797
|
}
|
|
787
798
|
break;
|
|
788
799
|
}
|
|
789
|
-
case
|
|
800
|
+
case It: {
|
|
790
801
|
if ($(s)) {
|
|
791
|
-
be.push(1), B.p(
|
|
802
|
+
be.push(1), B.p(n(s), s.loc);
|
|
792
803
|
break;
|
|
793
804
|
}
|
|
794
|
-
let f = this.declaration, { property: a, important:
|
|
795
|
-
Rt(s) && (nt.p(
|
|
796
|
-
let p = s.children,
|
|
797
|
-
if (be.push(
|
|
798
|
-
return at.p(
|
|
799
|
-
if (
|
|
800
|
-
if (
|
|
801
|
-
let { font_size: h, line_height:
|
|
802
|
-
|
|
805
|
+
let f = this.declaration, { property: a, important: m } = f, c = 1;
|
|
806
|
+
Rt(s) && (nt.p(n(s), s.loc), c++), typeof m == "string" && (xe.p(g(s) + "!" + m, s.loc), c++), fi(s) && (xe.p(n(s), s.loc), c++);
|
|
807
|
+
let p = s.children, o = s.loc;
|
|
808
|
+
if (be.push(c), C("z-index", a))
|
|
809
|
+
return at.p(n(s), o), this.skip;
|
|
810
|
+
if (C("font", a)) {
|
|
811
|
+
if (Le(s)) return;
|
|
812
|
+
let { font_size: h, line_height: b, font_family: S } = ri(s, n, function(E) {
|
|
813
|
+
E.type === "keyword" && B.p(E.value, o);
|
|
803
814
|
});
|
|
804
|
-
S &&
|
|
815
|
+
S && Ce.p(S, o), h && ze.p(h, o), b && _e.p(b, o);
|
|
805
816
|
break;
|
|
806
|
-
} else if (
|
|
807
|
-
|
|
817
|
+
} else if (C("font-size", a)) {
|
|
818
|
+
Le(s) || ze.p(n(s), o);
|
|
808
819
|
break;
|
|
809
|
-
} else if (
|
|
810
|
-
|
|
820
|
+
} else if (C("font-family", a)) {
|
|
821
|
+
Le(s) || Ce.p(n(s), o);
|
|
811
822
|
break;
|
|
812
|
-
} else if (
|
|
813
|
-
_e.p(
|
|
814
|
-
else if (
|
|
815
|
-
|
|
816
|
-
h.type === "fn" ? J.p(
|
|
823
|
+
} else if (C("line-height", a))
|
|
824
|
+
_e.p(n(s), o);
|
|
825
|
+
else if (C("transition", a) || C("animation", a)) {
|
|
826
|
+
ni(p, function(h) {
|
|
827
|
+
h.type === "fn" ? J.p(n(h.value), o) : h.type === "duration" ? X.p(n(h.value), o) : h.type === "keyword" && B.p(n(h.value), o);
|
|
817
828
|
});
|
|
818
829
|
break;
|
|
819
|
-
} else if (
|
|
830
|
+
} else if (C("animation-duration", a) || C("transition-duration", a)) {
|
|
820
831
|
p && p.size > 1 ? p.forEach((h) => {
|
|
821
|
-
h.type !==
|
|
822
|
-
}) : X.p(
|
|
832
|
+
h.type !== V && X.p(n(h), o);
|
|
833
|
+
}) : X.p(n(s), o);
|
|
823
834
|
break;
|
|
824
|
-
} else if (
|
|
835
|
+
} else if (C("transition-timing-function", a) || C("animation-timing-function", a)) {
|
|
825
836
|
p && p.size > 1 ? p.forEach((h) => {
|
|
826
|
-
h.type !==
|
|
827
|
-
}) : J.p(
|
|
837
|
+
h.type !== V && J.p(n(h), o);
|
|
838
|
+
}) : J.p(n(s), o);
|
|
828
839
|
break;
|
|
829
|
-
} else if (
|
|
830
|
-
$(s) || ft.push(
|
|
840
|
+
} else if (pi.has(ui(a))) {
|
|
841
|
+
$(s) || ft.push(n(s), a, o);
|
|
831
842
|
break;
|
|
832
|
-
} else
|
|
833
|
-
|
|
834
|
-
let
|
|
843
|
+
} else C("text-shadow", a) ? $(s) || ot.p(n(s), o) : C("box-shadow", a) && ($(s) || ut.p(n(s), o));
|
|
844
|
+
q(s, function(h) {
|
|
845
|
+
let b = h.name;
|
|
835
846
|
switch (h.type) {
|
|
836
|
-
case
|
|
847
|
+
case Kt: {
|
|
837
848
|
let S = h.value.length;
|
|
838
|
-
return L("\\9", h.value) && (S = S - 2), U.push("#" + h.value, a,
|
|
849
|
+
return L("\\9", h.value) && (S = S - 2), U.push("#" + h.value, a, o), I.p("hex" + S, o), this.skip;
|
|
839
850
|
}
|
|
840
|
-
case
|
|
841
|
-
N.has(
|
|
842
|
-
let S =
|
|
851
|
+
case O: {
|
|
852
|
+
N.has(b) && B.p(b, o);
|
|
853
|
+
let S = b.length;
|
|
843
854
|
if (S > 20 || S < 3)
|
|
844
855
|
return this.skip;
|
|
845
|
-
if (
|
|
846
|
-
let
|
|
847
|
-
U.push(
|
|
856
|
+
if (Nt.has(b)) {
|
|
857
|
+
let E = n(h);
|
|
858
|
+
U.push(E, a, o), I.p(b.toLowerCase(), o);
|
|
848
859
|
return;
|
|
849
860
|
}
|
|
850
|
-
if (
|
|
851
|
-
let
|
|
852
|
-
U.push(
|
|
861
|
+
if (Jt.has(b)) {
|
|
862
|
+
let E = n(h);
|
|
863
|
+
U.push(E, a, o), I.p("named", o);
|
|
853
864
|
return;
|
|
854
865
|
}
|
|
855
|
-
if (
|
|
856
|
-
let
|
|
857
|
-
U.push(
|
|
866
|
+
if (Xt.has(b)) {
|
|
867
|
+
let E = n(h);
|
|
868
|
+
U.push(E, a, o), I.p("system", o);
|
|
858
869
|
return;
|
|
859
870
|
}
|
|
860
871
|
return this.skip;
|
|
861
872
|
}
|
|
862
|
-
case
|
|
863
|
-
if (z("var",
|
|
873
|
+
case Te: {
|
|
874
|
+
if (z("var", b))
|
|
864
875
|
return this.skip;
|
|
865
|
-
if (
|
|
866
|
-
U.push(
|
|
876
|
+
if ($t.has(b)) {
|
|
877
|
+
U.push(n(h), a, h.loc), I.p(b.toLowerCase(), h.loc);
|
|
867
878
|
return;
|
|
868
879
|
}
|
|
869
|
-
if (L("gradient",
|
|
870
|
-
ct.p(
|
|
880
|
+
if (L("gradient", b)) {
|
|
881
|
+
ct.p(n(h), h.loc);
|
|
871
882
|
return;
|
|
872
883
|
}
|
|
873
884
|
}
|
|
@@ -875,42 +886,42 @@ function wi(i, t = {}) {
|
|
|
875
886
|
});
|
|
876
887
|
break;
|
|
877
888
|
}
|
|
878
|
-
case
|
|
889
|
+
case Re: {
|
|
879
890
|
if (this.atrulePrelude !== null)
|
|
880
891
|
return this.skip;
|
|
881
892
|
W++;
|
|
882
893
|
let f = 1;
|
|
883
|
-
st.add(
|
|
884
|
-
let { property: a, loc: { start:
|
|
894
|
+
st.add(n(s)), s.important === !0 && (Q++, f++, this.atrule && L("keyframes", this.atrule.name) && (de++, f++)), lt.push(f);
|
|
895
|
+
let { property: a, loc: { start: m } } = s, c = {
|
|
885
896
|
start: {
|
|
886
|
-
line:
|
|
887
|
-
column:
|
|
888
|
-
offset:
|
|
897
|
+
line: m.line,
|
|
898
|
+
column: m.column,
|
|
899
|
+
offset: m.offset
|
|
889
900
|
},
|
|
890
901
|
end: {
|
|
891
|
-
offset:
|
|
902
|
+
offset: m.offset + a.length
|
|
892
903
|
}
|
|
893
904
|
};
|
|
894
|
-
K.p(a,
|
|
905
|
+
K.p(a, c), D(a) ? (ke.p(a, c), j.push(2)) : oi(a) ? (we.p(a, c), j.push(2)) : Me(a) ? (Z.p(a, c), j.push(s.important ? 3 : 2), s.important === !0 && ye.p(a, c)) : j.push(1);
|
|
895
906
|
break;
|
|
896
907
|
}
|
|
897
908
|
}
|
|
898
909
|
});
|
|
899
|
-
let pt = st.size,
|
|
910
|
+
let pt = st.size, H = G.size(), ve = Je.aggregate(), qe = Xe.aggregate(), Ae = $e.aggregate(), ht = Ze.size, k = Object.assign, mt = i.length, Pe = ie.length, gt = te.aggregate(), dt = G.aggregate(), yt = lt.aggregate(), wt = j.aggregate(), kt = be.aggregate();
|
|
900
911
|
return {
|
|
901
912
|
stylesheet: {
|
|
902
|
-
sourceLinesOfCode: ee +
|
|
913
|
+
sourceLinesOfCode: ee + H + W + pe.size(),
|
|
903
914
|
linesOfCode: Et,
|
|
904
915
|
size: mt,
|
|
905
|
-
complexity:
|
|
916
|
+
complexity: gt.sum + dt.sum + yt.sum + wt.sum + kt.sum,
|
|
906
917
|
comments: {
|
|
907
|
-
total:
|
|
908
|
-
size:
|
|
918
|
+
total: w,
|
|
919
|
+
size: d
|
|
909
920
|
},
|
|
910
921
|
embeddedContent: {
|
|
911
922
|
size: {
|
|
912
|
-
total:
|
|
913
|
-
ratio: x(
|
|
923
|
+
total: _,
|
|
924
|
+
ratio: x(_, mt)
|
|
914
925
|
},
|
|
915
926
|
types: {
|
|
916
927
|
total: y.total,
|
|
@@ -921,35 +932,35 @@ function wi(i, t = {}) {
|
|
|
921
932
|
}
|
|
922
933
|
},
|
|
923
934
|
atrules: {
|
|
924
|
-
fontface:
|
|
925
|
-
total:
|
|
926
|
-
totalUnique:
|
|
935
|
+
fontface: k({
|
|
936
|
+
total: Pe,
|
|
937
|
+
totalUnique: Pe,
|
|
927
938
|
unique: ie,
|
|
928
|
-
uniquenessRatio:
|
|
939
|
+
uniquenessRatio: Pe === 0 ? 0 : 1
|
|
929
940
|
}, e ? {
|
|
930
941
|
uniqueWithLocations: Ue.c().uniqueWithLocations
|
|
931
942
|
} : {}),
|
|
932
|
-
import:
|
|
933
|
-
media:
|
|
934
|
-
|
|
943
|
+
import: Ie.c(),
|
|
944
|
+
media: k(
|
|
945
|
+
He.c(),
|
|
935
946
|
{
|
|
936
|
-
browserhacks:
|
|
947
|
+
browserhacks: Ve.c()
|
|
937
948
|
}
|
|
938
949
|
),
|
|
939
|
-
charset:
|
|
940
|
-
supports:
|
|
941
|
-
|
|
950
|
+
charset: We.c(),
|
|
951
|
+
supports: k(
|
|
952
|
+
se.c(),
|
|
942
953
|
{
|
|
943
954
|
browserhacks: Ke.c()
|
|
944
955
|
}
|
|
945
956
|
),
|
|
946
|
-
keyframes:
|
|
947
|
-
|
|
957
|
+
keyframes: k(
|
|
958
|
+
le.c(),
|
|
948
959
|
{
|
|
949
|
-
prefixed:
|
|
950
|
-
|
|
960
|
+
prefixed: k(
|
|
961
|
+
ne.c(),
|
|
951
962
|
{
|
|
952
|
-
ratio: x(
|
|
963
|
+
ratio: x(ne.size(), le.size())
|
|
953
964
|
}
|
|
954
965
|
)
|
|
955
966
|
}
|
|
@@ -958,82 +969,82 @@ function wi(i, t = {}) {
|
|
|
958
969
|
layer: re.c(),
|
|
959
970
|
property: Be.c(),
|
|
960
971
|
total: ee,
|
|
961
|
-
complexity:
|
|
972
|
+
complexity: gt
|
|
962
973
|
},
|
|
963
974
|
rules: {
|
|
964
|
-
total:
|
|
975
|
+
total: ae,
|
|
965
976
|
empty: {
|
|
966
|
-
total:
|
|
967
|
-
ratio: x(
|
|
977
|
+
total: oe,
|
|
978
|
+
ratio: x(oe, ae)
|
|
968
979
|
},
|
|
969
|
-
sizes:
|
|
970
|
-
|
|
980
|
+
sizes: k(
|
|
981
|
+
ue.aggregate(),
|
|
971
982
|
{
|
|
972
|
-
items:
|
|
983
|
+
items: ue.toArray()
|
|
973
984
|
},
|
|
974
985
|
Ye.c()
|
|
975
986
|
),
|
|
976
|
-
selectors:
|
|
977
|
-
|
|
987
|
+
selectors: k(
|
|
988
|
+
ce.aggregate(),
|
|
978
989
|
{
|
|
979
|
-
items:
|
|
990
|
+
items: ce.toArray()
|
|
980
991
|
},
|
|
981
992
|
Ge.c()
|
|
982
993
|
),
|
|
983
|
-
declarations:
|
|
984
|
-
|
|
994
|
+
declarations: k(
|
|
995
|
+
fe.aggregate(),
|
|
985
996
|
{
|
|
986
|
-
items:
|
|
997
|
+
items: fe.toArray()
|
|
987
998
|
},
|
|
988
999
|
Qe.c()
|
|
989
1000
|
)
|
|
990
1001
|
},
|
|
991
1002
|
selectors: {
|
|
992
|
-
total:
|
|
1003
|
+
total: H,
|
|
993
1004
|
totalUnique: ht,
|
|
994
|
-
uniquenessRatio: x(ht,
|
|
995
|
-
specificity:
|
|
1005
|
+
uniquenessRatio: x(ht, H),
|
|
1006
|
+
specificity: k(
|
|
996
1007
|
{
|
|
997
1008
|
/** @type Specificity */
|
|
998
|
-
min:
|
|
1009
|
+
min: M === void 0 ? [0, 0, 0] : M,
|
|
999
1010
|
/** @type Specificity */
|
|
1000
|
-
max:
|
|
1011
|
+
max: T === void 0 ? [0, 0, 0] : T,
|
|
1001
1012
|
/** @type Specificity */
|
|
1002
|
-
sum: [
|
|
1013
|
+
sum: [ve.sum, qe.sum, Ae.sum],
|
|
1003
1014
|
/** @type Specificity */
|
|
1004
|
-
mean: [
|
|
1015
|
+
mean: [ve.mean, qe.mean, Ae.mean],
|
|
1005
1016
|
/** @type Specificity */
|
|
1006
|
-
mode: [
|
|
1017
|
+
mode: [ve.mode, qe.mode, Ae.mode],
|
|
1007
1018
|
/** @type Specificity */
|
|
1008
1019
|
items: tt
|
|
1009
1020
|
},
|
|
1010
1021
|
Ne.c()
|
|
1011
1022
|
),
|
|
1012
|
-
complexity:
|
|
1013
|
-
|
|
1023
|
+
complexity: k(
|
|
1024
|
+
dt,
|
|
1014
1025
|
et.c(),
|
|
1015
1026
|
{
|
|
1016
1027
|
items: G.toArray()
|
|
1017
1028
|
}
|
|
1018
1029
|
),
|
|
1019
|
-
id:
|
|
1020
|
-
|
|
1030
|
+
id: k(
|
|
1031
|
+
me.c(),
|
|
1021
1032
|
{
|
|
1022
|
-
ratio: x(
|
|
1033
|
+
ratio: x(me.size(), H)
|
|
1023
1034
|
}
|
|
1024
1035
|
),
|
|
1025
1036
|
pseudoClasses: it.c(),
|
|
1026
|
-
accessibility:
|
|
1027
|
-
|
|
1037
|
+
accessibility: k(
|
|
1038
|
+
ge.c(),
|
|
1028
1039
|
{
|
|
1029
|
-
ratio: x(
|
|
1040
|
+
ratio: x(ge.size(), H)
|
|
1030
1041
|
}
|
|
1031
1042
|
),
|
|
1032
|
-
keyframes:
|
|
1033
|
-
prefixed:
|
|
1034
|
-
|
|
1043
|
+
keyframes: pe.c(),
|
|
1044
|
+
prefixed: k(
|
|
1045
|
+
he.c(),
|
|
1035
1046
|
{
|
|
1036
|
-
ratio: x(
|
|
1047
|
+
ratio: x(he.size(), H)
|
|
1037
1048
|
}
|
|
1038
1049
|
),
|
|
1039
1050
|
combinators: rt.c()
|
|
@@ -1052,46 +1063,46 @@ function wi(i, t = {}) {
|
|
|
1052
1063
|
},
|
|
1053
1064
|
complexity: yt
|
|
1054
1065
|
},
|
|
1055
|
-
properties:
|
|
1066
|
+
properties: k(
|
|
1056
1067
|
K.c(),
|
|
1057
1068
|
{
|
|
1058
|
-
prefixed:
|
|
1059
|
-
|
|
1069
|
+
prefixed: k(
|
|
1070
|
+
ke.c(),
|
|
1060
1071
|
{
|
|
1061
|
-
ratio: x(
|
|
1072
|
+
ratio: x(ke.size(), K.size())
|
|
1062
1073
|
}
|
|
1063
1074
|
),
|
|
1064
|
-
custom:
|
|
1075
|
+
custom: k(
|
|
1065
1076
|
Z.c(),
|
|
1066
1077
|
{
|
|
1067
1078
|
ratio: x(Z.size(), K.size()),
|
|
1068
|
-
importants:
|
|
1069
|
-
|
|
1079
|
+
importants: k(
|
|
1080
|
+
ye.c(),
|
|
1070
1081
|
{
|
|
1071
|
-
ratio: x(
|
|
1082
|
+
ratio: x(ye.size(), Z.size())
|
|
1072
1083
|
}
|
|
1073
1084
|
)
|
|
1074
1085
|
}
|
|
1075
1086
|
),
|
|
1076
|
-
browserhacks:
|
|
1077
|
-
|
|
1087
|
+
browserhacks: k(
|
|
1088
|
+
we.c(),
|
|
1078
1089
|
{
|
|
1079
|
-
ratio: x(
|
|
1090
|
+
ratio: x(we.size(), K.size())
|
|
1080
1091
|
}
|
|
1081
1092
|
),
|
|
1082
1093
|
complexity: wt
|
|
1083
1094
|
}
|
|
1084
1095
|
),
|
|
1085
1096
|
values: {
|
|
1086
|
-
colors:
|
|
1097
|
+
colors: k(
|
|
1087
1098
|
U.count(),
|
|
1088
1099
|
{
|
|
1089
|
-
formats:
|
|
1100
|
+
formats: I.c()
|
|
1090
1101
|
}
|
|
1091
1102
|
),
|
|
1092
1103
|
gradients: ct.c(),
|
|
1093
|
-
fontFamilies:
|
|
1094
|
-
fontSizes:
|
|
1104
|
+
fontFamilies: Ce.c(),
|
|
1105
|
+
fontSizes: ze.c(),
|
|
1095
1106
|
lineHeights: _e.c(),
|
|
1096
1107
|
zindexes: at.c(),
|
|
1097
1108
|
textShadows: ot.c(),
|
|
@@ -1102,30 +1113,30 @@ function wi(i, t = {}) {
|
|
|
1102
1113
|
timingFunctions: J.c()
|
|
1103
1114
|
},
|
|
1104
1115
|
prefixes: nt.c(),
|
|
1105
|
-
browserhacks:
|
|
1106
|
-
units:
|
|
1107
|
-
complexity:
|
|
1116
|
+
browserhacks: xe.c(),
|
|
1117
|
+
units: Se.count(),
|
|
1118
|
+
complexity: kt,
|
|
1108
1119
|
keywords: B.c()
|
|
1109
1120
|
},
|
|
1110
1121
|
__meta__: {
|
|
1111
|
-
parseTime:
|
|
1112
|
-
analyzeTime: Date.now() -
|
|
1113
|
-
total: Date.now() -
|
|
1122
|
+
parseTime: F - P,
|
|
1123
|
+
analyzeTime: Date.now() - F,
|
|
1124
|
+
total: Date.now() - l
|
|
1114
1125
|
}
|
|
1115
1126
|
};
|
|
1116
1127
|
}
|
|
1117
|
-
function
|
|
1128
|
+
function zt(i, t) {
|
|
1118
1129
|
return i[0] === t[0] ? i[1] === t[1] ? t[2] - i[2] : t[1] - i[1] : t[0] - i[0];
|
|
1119
1130
|
}
|
|
1120
1131
|
export {
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1132
|
+
yi as analyze,
|
|
1133
|
+
zt as compareSpecificity,
|
|
1134
|
+
D as hasVendorPrefix,
|
|
1124
1135
|
Lt as isAccessibilitySelector,
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1136
|
+
Yt as isMediaBrowserhack,
|
|
1137
|
+
oi as isPropertyHack,
|
|
1138
|
+
Gt as isSelectorPrefixed,
|
|
1139
|
+
Bt as isSupportsBrowserhack,
|
|
1129
1140
|
Rt as isValuePrefixed,
|
|
1130
1141
|
Ot as selectorComplexity
|
|
1131
1142
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
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.0.2",
|
|
4
5
|
"author": "Bart Veneman",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
7
8
|
"url": "git+https://github.com/projectwallace/css-analyzer.git"
|
|
8
9
|
},
|
|
9
|
-
"homepage": "https://
|
|
10
|
+
"homepage": "https://github.com/projectwallace/css-analyzer",
|
|
10
11
|
"issues": "https://github.com/projectwallace/css-analyzer/issues",
|
|
11
12
|
"license": "MIT",
|
|
12
13
|
"type": "module",
|
|
@@ -45,16 +46,13 @@
|
|
|
45
46
|
],
|
|
46
47
|
"dependencies": {
|
|
47
48
|
"@bramus/specificity": "^2.4.1",
|
|
48
|
-
"css-tree": "^
|
|
49
|
+
"css-tree": "^3.1.0"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@codecov/vite-plugin": "^1.9.0",
|
|
52
53
|
"c8": "^10.1.3",
|
|
53
54
|
"uvu": "^0.5.6",
|
|
54
|
-
"vite": "^6.
|
|
55
|
+
"vite": "^6.3.4",
|
|
55
56
|
"vite-plugin-dts": "^4.5.0"
|
|
56
|
-
},
|
|
57
|
-
"mangle": {
|
|
58
|
-
"regex": "^_[^_]"
|
|
59
57
|
}
|
|
60
58
|
}
|