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