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