@projectwallace/css-analyzer 7.6.2 → 7.6.3

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.
@@ -4,13 +4,13 @@ var Zt = (i) => {
4
4
  };
5
5
  var hi = (i, e, t) => e in i ? pi(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
6
6
  var $t = (i, e, t) => hi(i, typeof e != "symbol" ? e + "" : e, t), Jt = (i, e, t) => e.has(i) || Zt("Cannot " + t);
7
- var h = (i, e, t) => (Jt(i, e, "read from private field"), t ? t.call(i) : e.get(i)), _ = (i, e, t) => e.has(i) ? Zt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), R = (i, e, t, r) => (Jt(i, e, "write to private field"), r ? r.call(i, t) : e.set(i, t), t);
7
+ var m = (i, e, t) => (Jt(i, e, "read from private field"), t ? t.call(i) : e.get(i)), I = (i, e, t) => e.has(i) ? Zt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), R = (i, e, t, r) => (Jt(i, e, "write to private field"), r ? r.call(i, t) : e.set(i, t), t);
8
8
  var Ye = (i, e, t, r) => ({
9
9
  set _(n) {
10
10
  R(i, e, n, t);
11
11
  },
12
12
  get _() {
13
- return h(i, e, r);
13
+ return m(i, e, r);
14
14
  }
15
15
  });
16
16
  import mi from "css-tree/parser";
@@ -29,7 +29,7 @@ function q(i, e) {
29
29
  return !1;
30
30
  return !0;
31
31
  }
32
- function I(i, e) {
32
+ function M(i, e) {
33
33
  if (i === e) return !0;
34
34
  let t = e.length, r = t - i.length;
35
35
  if (r < 0)
@@ -48,10 +48,10 @@ function Xe(i, e) {
48
48
  return !1;
49
49
  return !0;
50
50
  }
51
- const Ge = "Atrule", di = "MediaQuery", Qe = "Rule", yi = "Selector", wi = "Value", V = "Identifier", ki = "Nth", bi = "Combinator", ni = "Number", Le = "Dimension", Z = "Operator", xi = "Hash", Ci = "Url", et = "Function";
51
+ const Ge = "Atrule", di = "MediaQuery", Qe = "Rule", yi = "Selector", wi = "Value", W = "Identifier", ki = "Nth", bi = "Combinator", ni = "Number", Le = "Dimension", Z = "Operator", xi = "Hash", Ci = "Url", et = "Function";
52
52
  function Xt(i, e, t) {
53
53
  let r = i.value.children.first;
54
- return q(e, i.property) && r.type === V && q(t, r.name);
54
+ return q(e, i.property) && r.type === W && q(t, r.name);
55
55
  }
56
56
  function vi(i) {
57
57
  let e = !1;
@@ -63,11 +63,11 @@ function vi(i) {
63
63
  function Si(i) {
64
64
  let e = !1;
65
65
  return li(i, function(t) {
66
- let { mediaType: r, name: n, value: c, type: g, kind: w } = t;
67
- if (g === di && r !== null) {
68
- if (Xe("\\0", r) || I("\\9 ", r))
66
+ let { mediaType: r, name: n, value: c, type: d, kind: w } = t;
67
+ if (d === di && r !== null) {
68
+ if (Xe("\\0", r) || M("\\9 ", r))
69
69
  return e = !0, this.break;
70
- } else if (g === "Feature" && w === "media") {
70
+ } else if (d === "Feature" && w === "media") {
71
71
  if (c && c.unit && c.unit === "\\0")
72
72
  return e = !0, this.break;
73
73
  if (q("-moz-images-in-menus", n) || q("min--moz-device-pixel-ratio", n) || q("-ms-high-contrast", n))
@@ -83,7 +83,7 @@ const Lt = 45;
83
83
  function N(i) {
84
84
  return i.charCodeAt(0) === Lt && i.charCodeAt(1) !== Lt && i.indexOf("-", 2) !== -1;
85
85
  }
86
- class D {
86
+ class F {
87
87
  constructor(e) {
88
88
  $t(this, "set");
89
89
  this.set = new Set(e);
@@ -101,7 +101,7 @@ function si(i, e) {
101
101
  }
102
102
  }), t;
103
103
  }
104
- const ai = new D(["nth-child", "where", "not", "is", "has", "nth-last-child", "matches", "-webkit-any", "-moz-any"]);
104
+ const ai = new F(["nth-child", "where", "not", "is", "has", "nth-last-child", "matches", "-webkit-any", "-moz-any"]);
105
105
  function oi(i) {
106
106
  let e = !1;
107
107
  return C(i, function(t) {
@@ -156,10 +156,10 @@ function Ai(i, e) {
156
156
  if (t.type === bi) {
157
157
  let n = t.loc, c = t.name;
158
158
  if (n === null) {
159
- let g = r.prev.data.loc.end, w = {
160
- offset: g.offset,
161
- line: g.line,
162
- column: g.column
159
+ let d = r.prev.data.loc.end, w = {
160
+ offset: d.offset,
161
+ line: d.line,
162
+ column: d.column
163
163
  };
164
164
  e({
165
165
  name: c,
@@ -182,7 +182,7 @@ function Ai(i, e) {
182
182
  }
183
183
  });
184
184
  }
185
- const Pi = new D([
185
+ const Pi = new F([
186
186
  // CSS Named Colors
187
187
  // Spec: https://drafts.csswg.org/css-color/#named-colors
188
188
  // Heuristic: popular names first for quick finding in set.has()
@@ -335,7 +335,7 @@ const Pi = new D([
335
335
  "mediumorchid",
336
336
  "darksalmon",
337
337
  "mediumspringgreen"
338
- ]), Ri = new D([
338
+ ]), Ri = new F([
339
339
  // CSS System Colors
340
340
  // Spec: https://drafts.csswg.org/css-color/#css-system-colors
341
341
  "accentcolor",
@@ -357,7 +357,7 @@ const Pi = new D([
357
357
  "selecteditem",
358
358
  "selecteditemtext",
359
359
  "visitedtext"
360
- ]), Oi = new D(["rgba", "rgb", "hsla", "hsl", "oklch", "color", "hwb", "lch", "lab", "oklab"]), Di = new D(["transparent", "currentcolor"]), pe = new D([
360
+ ]), Oi = new F(["rgba", "rgb", "hsla", "hsl", "oklch", "color", "hwb", "lch", "lab", "oklab"]), Di = new F(["transparent", "currentcolor"]), pe = new F([
361
361
  "auto",
362
362
  "none",
363
363
  // for `text-shadow`, `box-shadow` and `background`
@@ -371,7 +371,7 @@ function fe(i) {
371
371
  let e = i.children, t = e.size;
372
372
  if (!e || t > 1 || t === 0) return !1;
373
373
  let r = e.first;
374
- return r.type === V && pe.has(r.name);
374
+ return r.type === W && pe.has(r.name);
375
375
  }
376
376
  function ei(i) {
377
377
  return parseFloat(i) === 0;
@@ -382,7 +382,7 @@ function Fi(i) {
382
382
  return !1;
383
383
  return !0;
384
384
  }
385
- const Ei = new D(["caption", "icon", "menu", "message-box", "small-caption", "status-bar"]), _i = new D([
385
+ const Ei = new F(["caption", "icon", "menu", "message-box", "small-caption", "status-bar"]), _i = new F([
386
386
  /* <absolute-size> values */
387
387
  "xx-small",
388
388
  "x-small",
@@ -398,7 +398,7 @@ const Ei = new D(["caption", "icon", "menu", "message-box", "small-caption", "st
398
398
  ]), Ii = 44, ti = 47;
399
399
  function Ze(i) {
400
400
  let e = i.children.first;
401
- return e === null ? !1 : e.type === V && Ei.has(e.name);
401
+ return e === null ? !1 : e.type === W && Ei.has(e.name);
402
402
  }
403
403
  function Mi(i, e, t) {
404
404
  var w;
@@ -407,7 +407,7 @@ function Mi(i, e, t) {
407
407
  return null;
408
408
  i.children.forEach(function(b, x) {
409
409
  let O = x.prev ? x.prev.data : void 0, A = x.next ? x.next.data : void 0;
410
- if (b.type === V && pe.has(b.name) && t({
410
+ if (b.type === W && pe.has(b.name) && t({
411
411
  type: "keyword",
412
412
  value: b.name
413
413
  }), A && A.type === Z && A.value.charCodeAt(0) === ti) {
@@ -427,16 +427,16 @@ function Mi(i, e, t) {
427
427
  r[1] = b, !n && !r[0] && O && (n = e(O));
428
428
  return;
429
429
  }
430
- if (b.type === V) {
431
- let F = b.name;
432
- if (_i.has(F)) {
433
- n = F;
430
+ if (b.type === W) {
431
+ let E = b.name;
432
+ if (_i.has(E)) {
433
+ n = E;
434
434
  return;
435
435
  }
436
436
  }
437
437
  }
438
438
  });
439
- let g = r[0] || r[1] ? e({
439
+ let d = r[0] || r[1] ? e({
440
440
  loc: {
441
441
  // @ts-expect-error TODO: fix this
442
442
  start: {
@@ -454,10 +454,10 @@ function Mi(i, e, t) {
454
454
  return {
455
455
  font_size: n,
456
456
  line_height: c,
457
- font_family: g
457
+ font_family: d
458
458
  };
459
459
  }
460
- const Ui = new D(["linear", "ease", "ease-in", "ease-out", "ease-in-out", "step-start", "step-end"]), Ti = new D(["cubic-bezier", "steps"]);
460
+ const Ui = new F(["linear", "ease", "ease-in", "ease-out", "ease-in-out", "step-start", "step-end"]), Ti = new F(["cubic-bezier", "steps"]);
461
461
  function Vi(i, e) {
462
462
  let t = !1;
463
463
  for (let r of i) {
@@ -465,7 +465,7 @@ function Vi(i, e) {
465
465
  n === Z ? t = !1 : n === Le && t === !1 ? (t = !0, e({
466
466
  type: "duration",
467
467
  value: r
468
- })) : n === V ? Ui.has(c) ? e({
468
+ })) : n === W ? Ui.has(c) ? e({
469
469
  type: "fn",
470
470
  value: r
471
471
  }) : pe.has(c) && e({
@@ -483,75 +483,75 @@ function ci(i) {
483
483
  return !1;
484
484
  for (let t of e) {
485
485
  let { type: r, name: n } = t;
486
- if (r === V && N(n) || r === et && (N(n) || ci(t)))
486
+ if (r === W && N(n) || r === et && (N(n) || ci(t)))
487
487
  return !0;
488
488
  }
489
489
  return !1;
490
490
  }
491
- var H, M, U, $;
491
+ var H, U, T, $;
492
492
  class o {
493
493
  constructor(e = !1) {
494
- _(this, H);
495
- _(this, M);
496
- _(this, U, []);
497
- _(this, $);
498
- R(this, H, /* @__PURE__ */ new Map()), R(this, M, 0), e && R(this, U, []), R(this, $, e);
494
+ I(this, H);
495
+ I(this, U);
496
+ I(this, T, []);
497
+ I(this, $);
498
+ R(this, H, /* @__PURE__ */ new Map()), R(this, U, 0), e && R(this, T, []), R(this, $, e);
499
499
  }
500
500
  p(e, t) {
501
- let r = h(this, M);
502
- if (h(this, $)) {
503
- let n = t.start, c = n.offset, g = r * 4;
504
- h(this, U)[g] = n.line, h(this, U)[g + 1] = n.column, h(this, U)[g + 2] = c, h(this, U)[g + 3] = t.end.offset - c;
501
+ let r = m(this, U);
502
+ if (m(this, $)) {
503
+ let n = t.start, c = n.offset, d = r * 4;
504
+ m(this, T)[d] = n.line, m(this, T)[d + 1] = n.column, m(this, T)[d + 2] = c, m(this, T)[d + 3] = t.end.offset - c;
505
505
  }
506
- if (h(this, H).has(e)) {
507
- h(this, H).get(e).push(r), Ye(this, M)._++;
506
+ if (m(this, H).has(e)) {
507
+ m(this, H).get(e).push(r), Ye(this, U)._++;
508
508
  return;
509
509
  }
510
- h(this, H).set(e, [r]), Ye(this, M)._++;
510
+ m(this, H).set(e, [r]), Ye(this, U)._++;
511
511
  }
512
512
  size() {
513
- return h(this, M);
513
+ return m(this, U);
514
514
  }
515
515
  c() {
516
- let e = /* @__PURE__ */ new Map(), t = {}, r = h(this, $), n = h(this, H), c = h(this, U), g = n.size;
516
+ let e = /* @__PURE__ */ new Map(), t = {}, r = m(this, $), n = m(this, H), c = m(this, T), d = n.size;
517
517
  n.forEach((b, x) => {
518
518
  if (r) {
519
519
  let O = b.map(function(A) {
520
- let F = A * 4;
520
+ let E = A * 4;
521
521
  return {
522
- line: c[F],
523
- column: c[F + 1],
524
- offset: c[F + 2],
525
- length: c[F + 3]
522
+ line: c[E],
523
+ column: c[E + 1],
524
+ offset: c[E + 2],
525
+ length: c[E + 3]
526
526
  };
527
527
  });
528
528
  e.set(x, O);
529
529
  } else
530
530
  t[x] = b.length;
531
531
  });
532
- let w = h(this, M);
532
+ let w = m(this, U);
533
533
  return r ? {
534
534
  total: w,
535
- totalUnique: g,
535
+ totalUnique: d,
536
536
  unique: t,
537
- uniquenessRatio: w === 0 ? 0 : g / w,
537
+ uniquenessRatio: w === 0 ? 0 : d / w,
538
538
  uniqueWithLocations: Object.fromEntries(e)
539
539
  } : {
540
540
  total: w,
541
- totalUnique: g,
541
+ totalUnique: d,
542
542
  unique: t,
543
- uniquenessRatio: w === 0 ? 0 : g / w,
543
+ uniquenessRatio: w === 0 ? 0 : d / w,
544
544
  uniqueWithLocations: void 0
545
545
  };
546
546
  }
547
547
  }
548
- H = new WeakMap(), M = new WeakMap(), U = new WeakMap(), $ = new WeakMap();
548
+ H = new WeakMap(), U = new WeakMap(), T = new WeakMap(), $ = new WeakMap();
549
549
  var J, K, le;
550
550
  class $e {
551
551
  constructor(e) {
552
- _(this, J);
553
- _(this, K);
554
- _(this, le);
552
+ I(this, J);
553
+ I(this, K);
554
+ I(this, le);
555
555
  R(this, J, new o(e)), R(this, K, /* @__PURE__ */ new Map()), R(this, le, e);
556
556
  }
557
557
  /**
@@ -561,13 +561,13 @@ class $e {
561
561
  * @param node_location
562
562
  */
563
563
  push(e, t, r) {
564
- h(this, J).p(e, r), h(this, K).has(t) || h(this, K).set(t, new o(h(this, le))), h(this, K).get(t).p(e, r);
564
+ m(this, J).p(e, r), m(this, K).has(t) || m(this, K).set(t, new o(m(this, le))), m(this, K).get(t).p(e, r);
565
565
  }
566
566
  count() {
567
567
  let e = /* @__PURE__ */ new Map();
568
- for (let [t, r] of h(this, K).entries())
568
+ for (let [t, r] of m(this, K).entries())
569
569
  e.set(t, r.c());
570
- return Object.assign(h(this, J).c(), {
570
+ return Object.assign(m(this, J).c(), {
571
571
  itemsPerContext: Object.fromEntries(e)
572
572
  });
573
573
  }
@@ -575,31 +575,31 @@ class $e {
575
575
  J = new WeakMap(), K = new WeakMap(), le = new WeakMap();
576
576
  function Wi(i) {
577
577
  let e = /* @__PURE__ */ new Map(), t = -1, r = 0, n = 0, c = i.length;
578
- for (let g = 0; g < c; g++) {
579
- let w = i[g], b = (e.get(w) || 0) + 1;
578
+ for (let d = 0; d < c; d++) {
579
+ let w = i[d], b = (e.get(w) || 0) + 1;
580
580
  e.set(w, b), b > t && (t = b, r = 0, n = 0), b >= t && (r++, n += w);
581
581
  }
582
582
  return n / r;
583
583
  }
584
- var T, X;
584
+ var V, X;
585
585
  class S {
586
586
  constructor() {
587
- _(this, T);
588
- _(this, X);
589
- R(this, T, []), R(this, X, 0);
587
+ I(this, V);
588
+ I(this, X);
589
+ R(this, V, []), R(this, X, 0);
590
590
  }
591
591
  /**
592
592
  * Add a new Integer at the end of this AggregateCollection
593
593
  * @param item - The item to add
594
594
  */
595
595
  push(e) {
596
- h(this, T).push(e), R(this, X, h(this, X) + e);
596
+ m(this, V).push(e), R(this, X, m(this, X) + e);
597
597
  }
598
598
  size() {
599
- return h(this, T).length;
599
+ return m(this, V).length;
600
600
  }
601
601
  aggregate() {
602
- let e = h(this, T).length;
602
+ let e = m(this, V).length;
603
603
  if (e === 0)
604
604
  return {
605
605
  min: 0,
@@ -609,21 +609,21 @@ class S {
609
609
  range: 0,
610
610
  sum: 0
611
611
  };
612
- let t = h(this, T).slice().sort((w, b) => w - b), r = t[0], n = t[e - 1], c = Wi(t), g = h(this, X);
612
+ let t = m(this, V).slice().sort((w, b) => w - b), r = t[0], n = t[e - 1], c = Wi(t), d = m(this, X);
613
613
  return {
614
614
  min: r,
615
615
  max: n,
616
- mean: g / e,
616
+ mean: d / e,
617
617
  mode: c,
618
618
  range: n - r,
619
- sum: g
619
+ sum: d
620
620
  };
621
621
  }
622
622
  toArray() {
623
- return h(this, T);
623
+ return m(this, V);
624
624
  }
625
625
  }
626
- T = new WeakMap(), X = new WeakMap();
626
+ V = new WeakMap(), X = new WeakMap();
627
627
  function Hi(i) {
628
628
  if (tt(i) || N(i)) return !1;
629
629
  let e = i.charCodeAt(0);
@@ -638,8 +638,8 @@ function Hi(i) {
638
638
  function tt(i) {
639
639
  return i.length < 3 ? !1 : i.charCodeAt(0) === 45 && i.charCodeAt(1) === 45;
640
640
  }
641
- function m(i, e) {
642
- return tt(e) ? !1 : I(i, e);
641
+ function g(i, e) {
642
+ return tt(e) ? !1 : M(i, e);
643
643
  }
644
644
  function Ki(i) {
645
645
  return N(i) ? i.slice(i.indexOf("-", 2) + 1) : i;
@@ -652,11 +652,11 @@ function ji(i) {
652
652
  let e = i.children;
653
653
  if (e) {
654
654
  let t = e.last;
655
- return !!(t && t.type === V && I("\\9", t.name));
655
+ return !!(t && t.type === W && M("\\9", t.name));
656
656
  }
657
657
  return !1;
658
658
  }
659
- let Bi = new D([
659
+ let Bi = new F([
660
660
  "border-radius",
661
661
  "border-top-left-radius",
662
662
  "border-top-right-radius",
@@ -682,7 +682,7 @@ function ii(i, e, t) {
682
682
  let re = l.loc;
683
683
  return i.substring(re.start.offset, re.end.offset);
684
684
  }
685
- let g = 0, w = 0, b = 0, x = {
685
+ let d = 0, w = 0, b = 0, x = {
686
686
  total: 0,
687
687
  unique: /* @__PURE__ */ new Map()
688
688
  }, O = Date.now(), A = mi(i, {
@@ -691,51 +691,51 @@ function ii(i, e, t) {
691
691
  positions: !0,
692
692
  // So we can use stringifyNode()
693
693
  onComment: function(l) {
694
- g++, w += l.length;
694
+ d++, w += l.length;
695
695
  }
696
- }), F = Date.now(), fi = A.loc.end.line - A.loc.start.line + 1, it = new o(t), he = new S(), me = [], rt = new o(t), ge = new o(t), lt = new o(t), nt = new o(t), st = new o(t), at = new o(t), ot = new o(t), de = new o(t), ut = new o(t), ye = new o(t), we = new o(t), ct = new o(t), ne = new o(t), ft = new o(t), ke = new S(), pt = new o(t), be = 0, xe = 0, Ce = new S(), ve = new S(), Se = new S(), ht = new o(t), mt = new o(t), gt = new o(t), ze = new S(), dt = new o(t), qe = new o(t), yt = /* @__PURE__ */ new Set(), Ae = new o(t), j, B, wt = new S(), kt = new S(), bt = new S(), xt = new o(t), se = new S(), Ct = new o(t), vt = [], Pe = new o(t), Re = new o(t), St = new o(t), zt = new o(t), Oe = new S(), qt = new o(t), At = /* @__PURE__ */ new Set(), L = 0, Pt = new S(), ae = 0, De = 0, Fe = new o(t), Ee = new S(), Rt = new o(t), ee = new o(t), _e = new o(t), Ie = new o(t), oe = new o(t), te = new S(), Me = new S(), Ot = new o(t), Ue = new o(t), Dt = new o(t), Ft = new o(t), Et = new o(t), Te = new o(t), Ve = new o(t), We = new o(t), ue = new o(t), ce = new o(t), Y = new $e(t), G = new o(t), He = new $e(t), _t = new o(t), ie = new o(t), It = new $e(t), Mt = new o(t), E = 0;
696
+ }), E = Date.now(), fi = A.loc.end.line - A.loc.start.line + 1, it = new o(t), he = new S(), me = [], rt = new o(t), ge = new o(t), lt = new o(t), nt = new o(t), st = new o(t), at = new o(t), ot = new o(t), de = new o(t), ut = new o(t), ye = new o(t), we = new o(t), ct = new o(t), ne = new o(t), ft = new o(t), ke = new S(), pt = new o(t), be = 0, xe = 0, Ce = new S(), ve = new S(), Se = new S(), ht = new o(t), mt = new o(t), gt = new o(t), ze = new S(), dt = new o(t), qe = new o(t), yt = /* @__PURE__ */ new Set(), Ae = new o(t), j, B, wt = new S(), kt = new S(), bt = new S(), xt = new o(t), se = new S(), Ct = new o(t), vt = [], Pe = new o(t), Re = new o(t), St = new o(t), zt = new o(t), Oe = new S(), qt = new o(t), At = /* @__PURE__ */ new Set(), L = 0, Pt = new S(), ae = 0, De = 0, Fe = new o(t), Ee = new S(), Rt = new o(t), ee = new o(t), _e = new o(t), Ie = new o(t), oe = new o(t), te = new S(), Me = new S(), Ot = new o(t), Ue = new o(t), Dt = new o(t), Ft = new o(t), Et = new o(t), Te = new o(t), Ve = new o(t), We = new o(t), ue = new o(t), ce = new o(t), Y = new $e(t), G = new o(t), He = new $e(t), _t = new o(t), ie = new o(t), It = new $e(t), Mt = new o(t), _ = 0;
697
697
  C(A, {
698
698
  enter(l) {
699
699
  var re, Yt, Gt;
700
700
  switch (l.type) {
701
701
  case Ge: {
702
- it.p(l.name, l.loc), ke.push(E), pt.p(E, l.loc);
702
+ it.p(l.name, l.loc), ke.push(_), pt.p(_, l.loc);
703
703
  let s = l.name;
704
704
  if (s === "font-face") {
705
705
  let a = /* @__PURE__ */ Object.create(null);
706
- t && rt.p(l.loc.start.offset, l.loc), (re = l.block) == null || re.children.forEach((u) => {
707
- u.type === "Declaration" && (a[u.property] = n(u.value));
706
+ t && rt.p(l.loc.start.offset, l.loc), (re = l.block) == null || re.children.forEach((h) => {
707
+ h.type === "Declaration" && (a[h.property] = n(h.value));
708
708
  }), me.push(a), he.push(1);
709
709
  break;
710
710
  }
711
- let d = 1;
711
+ let f = 1;
712
712
  if (l.prelude !== null) {
713
- let a = l.prelude, u = a && n(l.prelude), p = a.loc;
713
+ let a = l.prelude, h = a && n(l.prelude), u = a.loc;
714
714
  if (s === "media")
715
- nt.p(u, p), Si(a) && (st.p(u, p), d++);
715
+ nt.p(h, u), Si(a) && (st.p(h, u), f++);
716
716
  else if (s === "supports")
717
- de.p(u, p), vi(a) && (ut.p(u, p), d++);
718
- else if (I("keyframes", s)) {
719
- let y = "@" + s + " " + u;
720
- N(s) && (we.p(y, p), d++), ye.p(y, p);
717
+ de.p(h, u), vi(a) && (ut.p(h, u), f++);
718
+ else if (M("keyframes", s)) {
719
+ let y = "@" + s + " " + h;
720
+ N(s) && (we.p(y, u), f++), ye.p(y, u);
721
721
  } else if (s === "import")
722
722
  C(l, (y) => {
723
723
  if (y.type === "Condition" && y.kind === "supports") {
724
- let f = n(y);
725
- return de.p(f, y.loc), C.break;
724
+ let p = n(y);
725
+ return de.p(p, y.loc), C.break;
726
726
  }
727
- }), lt.p(u, p);
727
+ }), lt.p(h, u);
728
728
  else if (s === "charset")
729
- ot.p(u, p);
729
+ ot.p(h, u);
730
730
  else if (s === "container") {
731
- if (ct.p(u, p), a.type === "AtrulePrelude" && ((Yt = a.children.first) == null ? void 0 : Yt.type) === "Identifier") {
731
+ if (ct.p(h, u), a.type === "AtrulePrelude" && ((Yt = a.children.first) == null ? void 0 : Yt.type) === "Identifier") {
732
732
  let y = a.children.first.name;
733
- ne.p(y, p);
733
+ ne.p(y, u);
734
734
  }
735
- } else s === "property" && ft.p(u, p);
735
+ } else s === "property" && ft.p(h, u);
736
736
  } else
737
- s === "layer" && (ge.p("<anonymous>", l.loc), d++);
738
- he.push(d);
737
+ s === "layer" && (ge.p("<anonymous>", l.loc), f++);
738
+ he.push(f);
739
739
  break;
740
740
  }
741
741
  // @ts-expect-error Oudated css-tree types
@@ -749,52 +749,52 @@ function ii(i, e, t) {
749
749
  break;
750
750
  }
751
751
  case Qe: {
752
- let s = l.prelude, d = l.block, a = s.children, u = d.children, p = a ? a.size : 0, y = u ? u.size : 0;
753
- Ce.push(p + y), ht.p(p + y, l.loc), ve.push(p), mt.p(p, s.loc), Se.push(y), gt.p(y, d.loc), ze.push(E), dt.p(E, l.loc), be++, y === 0 && xe++;
752
+ let s = l.prelude, f = l.block, a = s.children, h = f.children, u = a ? a.size : 0, y = h ? h.size : 0;
753
+ Ce.push(u + y), ht.p(u + y, l.loc), ve.push(u), mt.p(u, s.loc), Se.push(y), gt.p(y, f.loc), ze.push(_), dt.p(_, l.loc), be++, y === 0 && xe++;
754
754
  break;
755
755
  }
756
756
  case yi: {
757
- let s = n(l);
758
- if (this.atrule && I("keyframes", this.atrule.name))
759
- return qe.p(s, l.loc), this.skip;
760
- oi(l) && Re.p(s, l.loc);
761
- let d = qi(l);
762
- if (d !== !1)
763
- for (let v of d)
764
- St.p(v, l.loc);
765
- let a = ui(l);
766
- zi(l) && Ae.p(s, l.loc), yt.add(s), se.push(a), Ct.p(a, l.loc), Oe.push(E - 1), qt.p(E - 1, l.loc);
767
- let u = gi(l).toArray(), [p, y, f] = u;
768
- return xt.p(u.toString(), l.loc), wt.push(p), kt.push(y), bt.push(f), j === void 0 && (j = u), B === void 0 && (B = u), B !== void 0 && ri(B, u) < 0 && (B = u), j !== void 0 && ri(j, u) > 0 && (j = u), vt.push(u), p > 0 && Pe.p(s, l.loc), Ai(l, function(P) {
769
- zt.p(P.name, P.loc);
757
+ let s = n(l), f = l.loc;
758
+ if (this.atrule && M("keyframes", this.atrule.name))
759
+ return qe.p(s, f), this.skip;
760
+ oi(l) && Re.p(s, f);
761
+ let a = qi(l);
762
+ if (a !== !1)
763
+ for (let P of a)
764
+ St.p(P, f);
765
+ let h = ui(l);
766
+ zi(l) && Ae.p(s, f), yt.add(s), se.push(h), Ct.p(h, f), Oe.push(_ - 1), qt.p(_ - 1, f);
767
+ let u = gi(l).toArray(), [y, p, v] = u;
768
+ return xt.p(u.toString(), f), wt.push(y), kt.push(p), bt.push(v), j === void 0 && (j = u), B === void 0 && (B = u), B !== void 0 && ri(B, u) < 0 && (B = u), j !== void 0 && ri(j, u) > 0 && (j = u), vt.push(u), y > 0 && Pe.p(s, f), Ai(l, function(D) {
769
+ zt.p(D.name, D.loc);
770
770
  }), this.skip;
771
771
  }
772
772
  case Le: {
773
773
  if (!this.declaration)
774
774
  break;
775
775
  let s = l.unit;
776
- return I("\\9", s) ? He.push(s.substring(0, s.length - 2), this.declaration.property, l.loc) : He.push(s, this.declaration.property, l.loc), this.skip;
776
+ return M("\\9", s) ? He.push(s.substring(0, s.length - 2), this.declaration.property, l.loc) : He.push(s, this.declaration.property, l.loc), this.skip;
777
777
  }
778
778
  case Ci: {
779
779
  if (Xe("data:", l.value)) {
780
- let s = l.value, d = s.length, a = Ni(s);
781
- x.total++, b += d;
782
- let u = {
780
+ let s = l.value, f = s.length, a = Ni(s);
781
+ x.total++, b += f;
782
+ let h = {
783
783
  line: l.loc.start.line,
784
784
  column: l.loc.start.column,
785
785
  offset: l.loc.start.offset,
786
786
  length: l.loc.end.offset - l.loc.start.offset
787
787
  };
788
788
  if (x.unique.has(a)) {
789
- let p = x.unique.get(a);
790
- p.count++, p.size += d, x.unique.set(a, p), t && p.uniqueWithLocations && p.uniqueWithLocations.push(u);
789
+ let u = x.unique.get(a);
790
+ u.count++, u.size += f, x.unique.set(a, u), t && u.uniqueWithLocations && u.uniqueWithLocations.push(h);
791
791
  } else {
792
- let p = {
792
+ let u = {
793
793
  count: 1,
794
- size: d,
795
- uniqueWithLocations: t ? [u] : void 0
794
+ size: f,
795
+ uniqueWithLocations: t ? [h] : void 0
796
796
  };
797
- x.unique.set(a, p);
797
+ x.unique.set(a, u);
798
798
  }
799
799
  }
800
800
  break;
@@ -805,81 +805,81 @@ function ii(i, e, t) {
805
805
  Me.push(1), ie.p(n(l), s);
806
806
  break;
807
807
  }
808
- let d = this.declaration, { property: a, important: u } = d, p = 1;
809
- ci(l) && (Ot.p(n(l), s), p++), typeof u == "string" && (Ue.p(c(l) + "!" + u, s), p++), ji(l) && (Ue.p(n(l), s), p++);
808
+ let f = this.declaration, { property: a, important: h } = f, u = 1;
809
+ ci(l) && (Ot.p(n(l), s), u++), typeof h == "string" && (Ue.p(c(l) + "!" + h, s), u++), ji(l) && (Ue.p(n(l), s), u++);
810
810
  let y = l.children;
811
- if (Me.push(p), m("margin", a) || m("margin-block", a) || m("margin-inline", a) || m("margin-top", a) || m("margin-right", a) || m("margin-bottom", a) || m("margin-left", a) || m("padding", a) || m("padding-block", a) || m("padding-inline", a) || m("padding-top", a) || m("padding-right", a) || m("padding-bottom", a) || m("padding-left", a))
812
- Fi(l) && Mt.p(a, d.loc);
811
+ if (Me.push(u), g("margin", a) || g("margin-block", a) || g("margin-inline", a) || g("margin-top", a) || g("margin-right", a) || g("margin-bottom", a) || g("margin-left", a) || g("padding", a) || g("padding-block", a) || g("padding-inline", a) || g("padding-top", a) || g("padding-right", a) || g("padding-bottom", a) || g("padding-left", a))
812
+ Fi(l) && Mt.p(a, f.loc);
813
813
  else {
814
- if (m("z-index", a))
814
+ if (g("z-index", a))
815
815
  return Dt.p(n(l), s), this.skip;
816
- if (m("font", a)) {
816
+ if (g("font", a)) {
817
817
  if (Ze(l)) return;
818
- let f = Mi(l, n, function(Qt) {
818
+ let p = Mi(l, n, function(Qt) {
819
819
  Qt.type === "keyword" && ie.p(Qt.value, s);
820
820
  });
821
- if (!f)
821
+ if (!p)
822
822
  return this.skip;
823
- let { font_size: v, line_height: P, font_family: W } = f;
824
- W && Te.p(W, s), v && Ve.p(v, s), P && We.p(P, s);
823
+ let { font_size: v, line_height: P, font_family: D } = p;
824
+ D && Te.p(D, s), v && Ve.p(v, s), P && We.p(P, s);
825
825
  break;
826
- } else if (m("font-size", a)) {
826
+ } else if (g("font-size", a)) {
827
827
  Ze(l) || Ve.p(n(l), s);
828
828
  break;
829
- } else if (m("font-family", a)) {
829
+ } else if (g("font-family", a)) {
830
830
  Ze(l) || Te.p(n(l), s);
831
831
  break;
832
- } else if (m("line-height", a))
832
+ } else if (g("line-height", a))
833
833
  We.p(n(l), s);
834
- else if (m("transition", a) || m("animation", a)) {
835
- Vi(y, function(f) {
836
- f.type === "fn" ? ue.p(n(f.value), s) : f.type === "duration" ? ce.p(n(f.value), s) : f.type === "keyword" && ie.p(n(f.value), s);
834
+ else if (g("transition", a) || g("animation", a)) {
835
+ Vi(y, function(p) {
836
+ p.type === "fn" ? ue.p(n(p.value), s) : p.type === "duration" ? ce.p(n(p.value), s) : p.type === "keyword" && ie.p(n(p.value), s);
837
837
  });
838
838
  break;
839
- } else if (m("animation-duration", a) || m("transition-duration", a)) {
840
- y && y.size > 1 ? y.forEach((f) => {
841
- f.type !== Z && ce.p(n(f), s);
839
+ } else if (g("animation-duration", a) || g("transition-duration", a)) {
840
+ y && y.size > 1 ? y.forEach((p) => {
841
+ p.type !== Z && ce.p(n(p), s);
842
842
  }) : ce.p(n(l), s);
843
843
  break;
844
- } else if (m("transition-timing-function", a) || m("animation-timing-function", a)) {
845
- y && y.size > 1 ? y.forEach((f) => {
846
- f.type !== Z && ue.p(n(f), s);
844
+ } else if (g("transition-timing-function", a) || g("animation-timing-function", a)) {
845
+ y && y.size > 1 ? y.forEach((p) => {
846
+ p.type !== Z && ue.p(n(p), s);
847
847
  }) : ue.p(n(l), s);
848
848
  break;
849
- } else if (m("container-name", a))
849
+ } else if (g("container-name", a))
850
850
  ne.p(n(l), s);
851
- else if (m("container", a))
851
+ else if (g("container", a))
852
852
  ((Gt = y.first) == null ? void 0 : Gt.type) === "Identifier" && ne.p(y.first.name, s);
853
853
  else if (Bi.has(Ki(a))) {
854
854
  fe(l) || It.push(n(l), a, s);
855
855
  break;
856
- } else m("text-shadow", a) ? fe(l) || Ft.p(n(l), s) : m("box-shadow", a) && (fe(l) || Et.p(n(l), s));
856
+ } else g("text-shadow", a) ? fe(l) || Ft.p(n(l), s) : g("box-shadow", a) && (fe(l) || Et.p(n(l), s));
857
857
  }
858
- C(l, function(f) {
859
- let v = f.name;
860
- switch (f.type) {
858
+ C(l, function(p) {
859
+ let v = p.name;
860
+ switch (p.type) {
861
861
  case xi: {
862
- let P = f.value.length;
863
- return I("\\9", f.value) && (P = P - 2), Y.push("#" + f.value, a, s), G.p("hex" + P, s), C.skip;
862
+ let P = p.value.length;
863
+ return M("\\9", p.value) && (P = P - 2), Y.push("#" + p.value, a, s), G.p("hex" + P, s), C.skip;
864
864
  }
865
- case V: {
865
+ case W: {
866
866
  pe.has(v) && ie.p(v, s);
867
867
  let P = v.length;
868
868
  if (P > 20 || P < 3)
869
869
  return C.skip;
870
870
  if (Di.has(v)) {
871
- let W = n(f);
872
- Y.push(W, a, s), G.p(v.toLowerCase(), s);
871
+ let D = n(p);
872
+ Y.push(D, a, s), G.p(v.toLowerCase(), s);
873
873
  return;
874
874
  }
875
875
  if (Pi.has(v)) {
876
- let W = n(f);
877
- Y.push(W, a, s), G.p("named", s);
876
+ let D = n(p);
877
+ Y.push(D, a, s), G.p("named", s);
878
878
  return;
879
879
  }
880
880
  if (Ri.has(v)) {
881
- let W = n(f);
882
- Y.push(W, a, s), G.p("system", s);
881
+ let D = n(p);
882
+ Y.push(D, a, s), G.p("system", s);
883
883
  return;
884
884
  }
885
885
  return C.skip;
@@ -888,11 +888,11 @@ function ii(i, e, t) {
888
888
  if (q("var", v))
889
889
  return C.skip;
890
890
  if (Oi.has(v)) {
891
- Y.push(n(f), a, f.loc), G.p(v.toLowerCase(), f.loc);
891
+ Y.push(n(p), a, p.loc), G.p(v.toLowerCase(), p.loc);
892
892
  return;
893
893
  }
894
- if (I("gradient", v)) {
895
- _t.p(n(f), f.loc);
894
+ if (M("gradient", v)) {
895
+ _t.p(n(p), p.loc);
896
896
  return;
897
897
  }
898
898
  }
@@ -905,29 +905,29 @@ function ii(i, e, t) {
905
905
  return this.skip;
906
906
  L++;
907
907
  let s = 1;
908
- At.add(n(l)), Ee.push(E - 1), Rt.p(E - 1, l.loc), l.important === !0 && (ae++, s++, this.atrule && I("keyframes", this.atrule.name) && (De++, s++)), Pt.push(s);
908
+ At.add(n(l)), Ee.push(_ - 1), Rt.p(_ - 1, l.loc), l.important === !0 && (ae++, s++, this.atrule && M("keyframes", this.atrule.name) && (De++, s++)), Pt.push(s);
909
909
  let {
910
- property: d,
910
+ property: f,
911
911
  // @ts-expect-error TODO: fix this
912
912
  loc: { start: a }
913
- } = l, u = {
913
+ } = l, h = {
914
914
  start: {
915
915
  line: a.line,
916
916
  column: a.column,
917
917
  offset: a.offset
918
918
  },
919
919
  end: {
920
- offset: a.offset + d.length
920
+ offset: a.offset + f.length
921
921
  }
922
922
  };
923
- ee.p(d, u), N(d) ? (Ie.p(d, u), te.push(2)) : Hi(d) ? (_e.p(d, u), te.push(2)) : tt(d) ? (oe.p(d, u), te.push(l.important ? 3 : 2), l.important === !0 && Fe.p(d, u)) : te.push(1);
923
+ ee.p(f, h), N(f) ? (Ie.p(f, h), te.push(2)) : Hi(f) ? (_e.p(f, h), te.push(2)) : tt(f) ? (oe.p(f, h), te.push(l.important ? 3 : 2), l.important === !0 && Fe.p(f, h)) : te.push(1);
924
924
  break;
925
925
  }
926
926
  }
927
- (l.type === Qe || l.type === Ge) && E++;
927
+ (l.type === Qe || l.type === Ge) && _++;
928
928
  },
929
929
  leave(l) {
930
- (l.type === Qe || l.type === Ge) && E--;
930
+ (l.type === Qe || l.type === Ge) && _--;
931
931
  }
932
932
  });
933
933
  let Ut = At.size, Q = se.size(), Ke = wt.aggregate(), Ne = kt.aggregate(), je = bt.aggregate(), Tt = yt.size, k = Object.assign, Vt = i.length, Be = me.length, Wt = he.aggregate(), Ht = se.aggregate(), Kt = Pt.aggregate(), Nt = te.aggregate(), jt = Me.aggregate(), Bt = it.c();
@@ -938,7 +938,7 @@ function ii(i, e, t) {
938
938
  size: Vt,
939
939
  complexity: Wt.sum + Ht.sum + Kt.sum + Nt.sum + jt.sum,
940
940
  comments: {
941
- total: g,
941
+ total: d,
942
942
  size: w
943
943
  },
944
944
  embeddedContent: {
@@ -1133,8 +1133,8 @@ function ii(i, e, t) {
1133
1133
  resets: Mt.c()
1134
1134
  },
1135
1135
  __meta__: {
1136
- parseTime: F - O,
1137
- analyzeTime: Date.now() - F,
1136
+ parseTime: E - O,
1137
+ analyzeTime: Date.now() - E,
1138
1138
  total: Date.now() - r
1139
1139
  }
1140
1140
  };
@@ -1143,7 +1143,7 @@ function ri(i, e) {
1143
1143
  return i[0] === e[0] ? i[1] === e[1] ? e[2] - i[2] : e[1] - i[1] : e[0] - i[0];
1144
1144
  }
1145
1145
  export {
1146
- D as KeywordSet,
1146
+ F as KeywordSet,
1147
1147
  Ji as analyze,
1148
1148
  Oi as colorFunctions,
1149
1149
  Di as colorKeywords,
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ import { isPrefixed as isSelectorPrefixed } from './selectors/utils.js';
10
10
  import { isSupportsBrowserhack } from './atrules/atrules.js';
11
11
  import { isValuePrefixed } from './values/vendor-prefix.js';
12
12
  import { KeywordSet } from './keyword-set.js';
13
+ import { Location as Location_2 } from './collection.js';
13
14
  import { namedColors } from './values/colors.js';
14
15
  import { getComplexity as selectorComplexity } from './selectors/utils.js';
15
16
  import { systemColors } from './values/colors.js';
@@ -46,12 +47,7 @@ declare function analyzeInternal<T extends boolean>(css: string, options: Option
46
47
  [k: string]: {
47
48
  size: number;
48
49
  count: number;
49
- uniqueWithLocations?: {
50
- offset: number;
51
- line: number;
52
- column: number;
53
- length: number;
54
- }[];
50
+ uniqueWithLocations?: Location_2[];
55
51
  };
56
52
  };
57
53
  };
@@ -568,6 +564,8 @@ export { isValuePrefixed }
568
564
 
569
565
  export { KeywordSet }
570
566
 
567
+ export { Location_2 as Location }
568
+
571
569
  export { namedColors }
572
570
 
573
571
  export declare type Options = {
@@ -577,8 +575,10 @@ export declare type Options = {
577
575
 
578
576
  export { selectorComplexity }
579
577
 
580
- declare type Specificity = [number, number, number];
578
+ export declare type Specificity = [number, number, number];
581
579
 
582
580
  export { systemColors }
583
581
 
582
+ export { UniqueWithLocations }
583
+
584
584
  export { }
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.6.2",
4
+ "version": "7.6.3",
5
5
  "author": "Bart Veneman",
6
6
  "repository": {
7
7
  "type": "git",
@@ -24,6 +24,8 @@
24
24
  "node": ">=18.0.0"
25
25
  },
26
26
  "scripts": {
27
+ "lint": "oxlint --config .oxlintrc.json",
28
+ "lint-package": "publint",
27
29
  "test": "vitest",
28
30
  "check": "tsc --noEmit",
29
31
  "build": "vite build"
@@ -53,7 +55,9 @@
53
55
  "@codecov/vite-plugin": "^1.9.1",
54
56
  "@types/css-tree": "^2.3.11",
55
57
  "c8": "^10.1.3",
58
+ "oxlint": "^1.26.0",
56
59
  "prettier": "^3.6.2",
60
+ "publint": "^0.3.15",
57
61
  "typescript": "^5.9.3",
58
62
  "vite": "^6.3.4",
59
63
  "vite-plugin-dts": "^4.5.4",