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