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