@projectwallace/css-analyzer 8.0.1 → 8.0.2

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.
Files changed (2) hide show
  1. package/dist/css-analyzer.js +127 -125
  2. package/package.json +1 -1
@@ -13,7 +13,7 @@ var Vt = (r, e, t, s) => ({
13
13
  return w(r, e, s);
14
14
  }
15
15
  });
16
- import { walk as B, SUPPORTS_QUERY as Hi, BREAK as Q, MEDIA_TYPE as cr, MEDIA_FEATURE as Ii, str_equals as P, DIMENSION as ft, NUMBER as _s, IDENTIFIER as he, SELECTOR as ce, NTH_SELECTOR as _r, PSEUDO_ELEMENT_SELECTOR as us, TYPE_SELECTOR as fs, PSEUDO_CLASS_SELECTOR as Oe, ATTRIBUTE_SELECTOR as ps, SKIP as I, COMBINATOR as is, SELECTOR_LIST as ds, NTH_OF_SELECTOR as ur, CLASS_SELECTOR as fr, ID_SELECTOR as pr, FUNCTION as gs, OPERATOR as Ee, is_custom as xs, is_vendor_prefixed as ms, parse as dr, AT_RULE as gr, BLOCK as xr, DECLARATION as jt, LAYER_NAME as mr, CONTAINER_QUERY as kr, STYLE_RULE as wr, HASH as Ar, URL as yr, str_starts_with as Er } from "@projectwallace/css-parser";
16
+ import { walk as B, SUPPORTS_QUERY as Hi, BREAK as Q, MEDIA_TYPE as cr, MEDIA_FEATURE as Ii, str_equals as P, DIMENSION as ft, NUMBER as _s, IDENTIFIER as he, SELECTOR as ce, NTH_SELECTOR as _r, PSEUDO_ELEMENT_SELECTOR as us, TYPE_SELECTOR as fs, PSEUDO_CLASS_SELECTOR as Oe, ATTRIBUTE_SELECTOR as ps, SKIP as I, COMBINATOR as is, SELECTOR_LIST as ds, NTH_OF_SELECTOR as ur, CLASS_SELECTOR as fr, ID_SELECTOR as pr, FUNCTION as gs, OPERATOR as Ee, is_custom as xs, is_vendor_prefixed as ms, parse as dr, AT_RULE as gr, BLOCK as xr, DECLARATION as jt, LAYER_NAME as mr, CONTAINER_QUERY as kr, STYLE_RULE as wr, HASH as yr, URL as Ar, str_starts_with as Er } from "@projectwallace/css-parser";
17
17
  function Cr(r) {
18
18
  let e = !1;
19
19
  return B(r, function(t) {
@@ -137,38 +137,38 @@ function Tr(r, e) {
137
137
  });
138
138
  });
139
139
  }
140
- let ks = 1, q = 2, pt = 4, Ce = 8, ge = 16, y = new Uint8Array(128);
140
+ let ks = 1, q = 2, pt = 4, Ce = 8, ge = 16, A = new Uint8Array(128);
141
141
  for (let r = 48; r <= 57; r++)
142
- y[r] = q;
142
+ A[r] = q;
143
143
  for (let r = 48; r <= 57; r++)
144
- y[r] |= pt;
144
+ A[r] |= pt;
145
145
  for (let r = 65; r <= 70; r++)
146
- y[r] = pt;
146
+ A[r] = pt;
147
147
  for (let r = 97; r <= 102; r++)
148
- y[r] = pt;
148
+ A[r] = pt;
149
149
  for (let r = 65; r <= 90; r++)
150
- y[r] |= ks;
150
+ A[r] |= ks;
151
151
  for (let r = 97; r <= 122; r++)
152
- y[r] |= ks;
153
- y[32] = Ce;
154
- y[9] = Ce;
155
- y[10] = ge;
156
- y[13] = ge;
157
- y[12] = ge;
152
+ A[r] |= ks;
153
+ A[32] = Ce;
154
+ A[9] = Ce;
155
+ A[10] = ge;
156
+ A[13] = ge;
157
+ A[12] = ge;
158
158
  function Or(r) {
159
- return r < 128 && (y[r] & q) !== 0;
159
+ return r < 128 && (A[r] & q) !== 0;
160
160
  }
161
161
  function et(r) {
162
- return r < 128 && (y[r] & pt) !== 0;
162
+ return r < 128 && (A[r] & pt) !== 0;
163
163
  }
164
164
  function Sr(r) {
165
- return r < 128 && (y[r] & ks) !== 0;
165
+ return r < 128 && (A[r] & ks) !== 0;
166
166
  }
167
167
  function gi(r) {
168
- return r < 128 && (y[r] & Ce) !== 0;
168
+ return r < 128 && (A[r] & Ce) !== 0;
169
169
  }
170
170
  function ie(r) {
171
- return r < 128 && (y[r] & ge) !== 0;
171
+ return r < 128 && (A[r] & ge) !== 0;
172
172
  }
173
173
  function Me(r) {
174
174
  return r >= 128 || r === 95 ? !0 : Sr(r);
@@ -176,7 +176,7 @@ function Me(r) {
176
176
  function tt(r) {
177
177
  return r === 45 ? !0 : Me(r) || Or(r);
178
178
  }
179
- const le = 1, rt = 2, Nr = 3, Fi = 4, Mi = 5, xi = 6, de = 9, nt = 10, qi = 11, zi = 12, ns = 13, Ur = 14, Lr = 15, Ki = 16, Hr = 17, qe = 18, ls = 19, Bi = 20, $i = 21, Gi = 22, Ir = 23, Pr = 24, os = 26, Dr = 123, Fr = 125, Mr = 58, qr = 59, zr = 44, Kr = 91, Br = 93, mi = 40, $r = 41, ki = 47, wi = 42, Gr = 34, Yr = 39, Xt = 46, Wr = 60, Qr = 33, K = 45, Vr = 62, jr = 64, Xr = 35, Zt = 92, st = 43, Zr = 37, Jr = 101, en = 69, Ai = 13, yi = 10;
179
+ const le = 1, rt = 2, Nr = 3, Fi = 4, Mi = 5, xi = 6, de = 9, nt = 10, qi = 11, zi = 12, ns = 13, Ur = 14, Lr = 15, Ki = 16, Hr = 17, qe = 18, ls = 19, Bi = 20, $i = 21, Gi = 22, Ir = 23, Pr = 24, os = 26, Dr = 123, Fr = 125, Mr = 58, qr = 59, zr = 44, Kr = 91, Br = 93, mi = 40, $r = 41, ki = 47, wi = 42, Gr = 34, Yr = 39, Xt = 46, Wr = 60, Qr = 33, K = 45, Vr = 62, jr = 64, Xr = 35, Zt = 92, st = 43, Zr = 37, Jr = 101, en = 69, yi = 13, Ai = 10;
180
180
  class Yi {
181
181
  constructor(e, t) {
182
182
  g(this, "source");
@@ -197,7 +197,7 @@ class Yi {
197
197
  if (e)
198
198
  for (; this.pos < this.source.length; ) {
199
199
  let l = this.source.charCodeAt(this.pos);
200
- if (l >= 128 || (y[l] & (Ce | ge)) === 0) break;
200
+ if (l >= 128 || (A[l] & (Ce | ge)) === 0) break;
201
201
  this.advance();
202
202
  }
203
203
  if (this.pos >= this.source.length)
@@ -223,7 +223,7 @@ class Yi {
223
223
  case $r:
224
224
  return this.advance(), this.make_token(Gi, s, this.pos, i, n);
225
225
  }
226
- if (t < 128 && (y[t] & (Ce | ge)) !== 0)
226
+ if (t < 128 && (A[t] & (Ce | ge)) !== 0)
227
227
  return this.consume_whitespace(i, n);
228
228
  if (t === ki && this.peek() === wi) {
229
229
  let l = s, o = i, h = n;
@@ -245,11 +245,11 @@ class Yi {
245
245
  }
246
246
  if (t === Gr || t === Yr)
247
247
  return this.consume_string(t, i, n);
248
- if (t < 128 && (y[t] & q) !== 0)
248
+ if (t < 128 && (A[t] & q) !== 0)
249
249
  return this.consume_number(i, n);
250
250
  if (t === Xt) {
251
251
  let l = this.peek();
252
- if (l < 128 && (y[l] & q) !== 0)
252
+ if (l < 128 && (A[l] & q) !== 0)
253
253
  return this.consume_number(i, n);
254
254
  }
255
255
  if (t === Wr && this.pos + 3 < this.source.length && this.peek() === Qr && this.peek(2) === K && this.peek(3) === K)
@@ -274,11 +274,11 @@ class Yi {
274
274
  }
275
275
  if (t === K || t === st) {
276
276
  let l = this.peek();
277
- if (l < 128 && (y[l] & q) !== 0)
277
+ if (l < 128 && (A[l] & q) !== 0)
278
278
  return this.consume_number(i, n);
279
279
  if (l === Xt) {
280
280
  let h = this.peek(2);
281
- if (h < 128 && (y[h] & q) !== 0)
281
+ if (h < 128 && (A[h] & q) !== 0)
282
282
  return this.consume_number(i, n);
283
283
  }
284
284
  }
@@ -288,7 +288,7 @@ class Yi {
288
288
  let s = this.pos;
289
289
  for (; this.pos < this.source.length; ) {
290
290
  let i = this.source.charCodeAt(this.pos);
291
- if (i >= 128 || (y[i] & (Ce | ge)) === 0) break;
291
+ if (i >= 128 || (A[i] & (Ce | ge)) === 0) break;
292
292
  this.advance();
293
293
  }
294
294
  return this.make_token(ns, s, this.pos, e, t);
@@ -328,22 +328,22 @@ class Yi {
328
328
  let s = this.pos, i = this.source.charCodeAt(this.pos);
329
329
  for ((i === st || i === K) && this.advance(); this.pos < this.source.length; ) {
330
330
  let n = this.source.charCodeAt(this.pos);
331
- if (n >= 128 || (y[n] & q) === 0) break;
331
+ if (n >= 128 || (A[n] & q) === 0) break;
332
332
  this.advance();
333
333
  }
334
334
  if (this.pos < this.source.length && this.source.charCodeAt(this.pos) === Xt && this.pos + 1 < this.source.length) {
335
335
  let n = this.peek();
336
- if (n < 128 && (y[n] & q) !== 0)
336
+ if (n < 128 && (A[n] & q) !== 0)
337
337
  for (this.advance(); this.pos < this.source.length; ) {
338
338
  let l = this.source.charCodeAt(this.pos);
339
- if (l >= 128 || (y[l] & q) === 0) break;
339
+ if (l >= 128 || (A[l] & q) === 0) break;
340
340
  this.advance();
341
341
  }
342
342
  }
343
343
  if (this.pos < this.source.length) {
344
344
  let n = this.source.charCodeAt(this.pos);
345
345
  if (n === Jr || n === en) {
346
- let l = this.peek(), o = l < 128 && (y[l] & q) !== 0, h = this.peek(2), c = h < 128 && (y[h] & q) !== 0;
346
+ let l = this.peek(), o = l < 128 && (A[l] & q) !== 0, h = this.peek(2), c = h < 128 && (A[h] & q) !== 0;
347
347
  if (o || (l === st || l === K) && c) {
348
348
  if (this.advance(), this.pos < this.source.length) {
349
349
  let u = this.source.charCodeAt(this.pos);
@@ -351,7 +351,7 @@ class Yi {
351
351
  }
352
352
  for (; this.pos < this.source.length; ) {
353
353
  let u = this.source.charCodeAt(this.pos);
354
- if (u >= 128 || (y[u] & q) === 0) break;
354
+ if (u >= 128 || (A[u] & q) === 0) break;
355
355
  this.advance();
356
356
  }
357
357
  }
@@ -410,12 +410,12 @@ class Yi {
410
410
  if (e === 1) {
411
411
  if (this.pos >= this.source.length) return;
412
412
  let t = this.source.charCodeAt(this.pos);
413
- this.pos++, ie(t) ? (t === Ai && this.pos < this.source.length && this.source.charCodeAt(this.pos) === yi && this.pos++, this.line++, this.column = 1) : this.column++;
413
+ this.pos++, ie(t) ? (t === yi && this.pos < this.source.length && this.source.charCodeAt(this.pos) === Ai && this.pos++, this.line++, this.column = 1) : this.column++;
414
414
  return;
415
415
  }
416
416
  for (let t = 0; t < e && !(this.pos >= this.source.length); t++) {
417
417
  let s = this.source.charCodeAt(this.pos);
418
- this.pos++, ie(s) ? (s === Ai && this.pos < this.source.length && this.source.charCodeAt(this.pos) === yi && (this.pos++, t++), this.line++, this.column = 1) : this.column++;
418
+ this.pos++, ie(s) ? (s === yi && this.pos < this.source.length && this.source.charCodeAt(this.pos) === Ai && (this.pos++, t++), this.line++, this.column = 1) : this.column++;
419
419
  }
420
420
  }
421
421
  peek(e = 1) {
@@ -460,7 +460,7 @@ class Yi {
460
460
  }
461
461
  }
462
462
  let it = 36;
463
- const tn = 1, lt = 2, ze = 3, pe = 4, Wi = 5, Qi = 6, ot = 7, Vi = 10, as = 11, Ke = 12, ji = 13, sn = 14, Xi = 15, rn = 16, nn = 17, Zi = 18, ln = 19, dt = 20, hs = 21, Ji = 22, er = 23, Be = 24, be = 25, Ye = 26, at = 27, cs = 28, tr = 29, $e = 30, re = 31, sr = 56, on = 32, an = 33, hn = 34, cn = 35, _n = 36, un = 37, fn = 38, pn = 39, ir = 40, dn = 1, gn = 2, Ei = 4, xn = 8, mn = 32, rr = 64, kn = 128, Ci = 0, wn = 1, An = 2, yn = 3, En = 4, Cn = 5, bn = 6, Pe = 0, Rn = 1, vn = 2, ne = class ne {
463
+ const tn = 1, lt = 2, ze = 3, pe = 4, Wi = 5, Qi = 6, ot = 7, Vi = 10, as = 11, Ke = 12, ji = 13, sn = 14, Xi = 15, rn = 16, nn = 17, Zi = 18, ln = 19, dt = 20, hs = 21, Ji = 22, er = 23, Be = 24, be = 25, Ye = 26, at = 27, cs = 28, tr = 29, $e = 30, re = 31, sr = 56, on = 32, an = 33, hn = 34, cn = 35, _n = 36, un = 37, fn = 38, pn = 39, ir = 40, dn = 1, gn = 2, Ei = 4, xn = 8, mn = 32, rr = 64, kn = 128, Ci = 0, wn = 1, yn = 2, An = 3, En = 4, Cn = 5, bn = 6, Pe = 0, Rn = 1, vn = 2, ne = class ne {
464
464
  constructor(e = 1024) {
465
465
  g(this, "buffer");
466
466
  g(this, "view");
@@ -729,7 +729,7 @@ function qn(r, e, t) {
729
729
  e++;
730
730
  return e;
731
731
  }
732
- function ye(r, e, t) {
732
+ function Ae(r, e, t) {
733
733
  for (; e < t; ) {
734
734
  let s = r.charCodeAt(e);
735
735
  if (se(s)) {
@@ -1228,7 +1228,7 @@ class vi {
1228
1228
  return null;
1229
1229
  }
1230
1230
  skip_whitespace() {
1231
- this.lexer.pos = ye(this.source, this.lexer.pos, this.expr_end);
1231
+ this.lexer.pos = Ae(this.source, this.lexer.pos, this.expr_end);
1232
1232
  }
1233
1233
  create_anplusb_node(e, t, s, i, n) {
1234
1234
  const l = this.arena.create_node($e, e, this.lexer.pos - e, this.lexer.line, 1);
@@ -1462,7 +1462,7 @@ class Bn {
1462
1462
  }
1463
1463
  // Parse attribute content to extract name, operator, and value
1464
1464
  parse_attribute_content(e, t, s) {
1465
- if (t = ye(this.source, t, s), s = zn(this.source, s, t), t >= s) return;
1465
+ if (t = Ae(this.source, t, s), s = zn(this.source, s, t), t >= s) return;
1466
1466
  let i = t, n = t, l = -1, o = -1, h = -1;
1467
1467
  for (; n < s; ) {
1468
1468
  let k = this.source.charCodeAt(n);
@@ -1471,7 +1471,7 @@ class Bn {
1471
1471
  n++;
1472
1472
  }
1473
1473
  n > i && (this.arena.set_content_start_delta(e, i - this.arena.get_start_offset(e)), this.arena.set_content_length(e, n - i));
1474
- let c = ye(this.source, n, s);
1474
+ let c = Ae(this.source, n, s);
1475
1475
  if (c >= s) {
1476
1476
  this.arena.set_attr_operator(e, Ci), this.arena.set_attr_flags(e, Pe);
1477
1477
  return;
@@ -1480,9 +1480,9 @@ class Bn {
1480
1480
  if (u === fe)
1481
1481
  l = c + 1, this.arena.set_attr_operator(e, wn);
1482
1482
  else if (u === ht && f === fe)
1483
- l = c + 2, this.arena.set_attr_operator(e, An);
1484
- else if (u === De && f === fe)
1485
1483
  l = c + 2, this.arena.set_attr_operator(e, yn);
1484
+ else if (u === De && f === fe)
1485
+ l = c + 2, this.arena.set_attr_operator(e, An);
1486
1486
  else if (u === Ri && f === fe)
1487
1487
  l = c + 2, this.arena.set_attr_operator(e, En);
1488
1488
  else if (u === bi && f === fe)
@@ -1493,7 +1493,7 @@ class Bn {
1493
1493
  this.arena.set_attr_operator(e, Ci), this.arena.set_attr_flags(e, Pe);
1494
1494
  return;
1495
1495
  }
1496
- if (c = ye(this.source, l, s), c >= s) {
1496
+ if (c = Ae(this.source, l, s), c >= s) {
1497
1497
  this.arena.set_attr_flags(e, Pe);
1498
1498
  return;
1499
1499
  }
@@ -1519,7 +1519,7 @@ class Bn {
1519
1519
  }
1520
1520
  h = c;
1521
1521
  }
1522
- if (h > o && (this.arena.set_value_start_delta(e, o - this.arena.get_start_offset(e)), this.arena.set_value_length(e, h - o)), c = ye(this.source, h, s), c < s) {
1522
+ if (h > o && (this.arena.set_value_start_delta(e, o - this.arena.get_start_offset(e)), this.arena.set_value_length(e, h - o)), c = Ae(this.source, h, s), c < s) {
1523
1523
  let k = this.source.charCodeAt(c);
1524
1524
  k === 105 || k === 73 ? this.arena.set_attr_flags(e, Rn) : k === 115 || k === 83 ? this.arena.set_attr_flags(e, vn) : this.arena.set_attr_flags(e, Pe);
1525
1525
  } else
@@ -1618,7 +1618,7 @@ class Bn {
1618
1618
  // Find the position of standalone "of" keyword (case-insensitive)
1619
1619
  find_of_keyword(e, t) {
1620
1620
  let s = e;
1621
- for (; s < t - 1 && (s = ye(this.source, s, t), !(s >= t - 1)); ) {
1621
+ for (; s < t - 1 && (s = Ae(this.source, s, t), !(s >= t - 1)); ) {
1622
1622
  let i = this.source.charCodeAt(s), n = this.source.charCodeAt(s + 1);
1623
1623
  if ((i === 111 || i === 79) && (n === 102 || n === 70)) {
1624
1624
  let l = s === e || se(this.source.charCodeAt(s - 1)), o = s + 2 >= t || se(this.source.charCodeAt(s + 2));
@@ -2298,8 +2298,8 @@ function Ui(r, e, t) {
2298
2298
  on_comment({ length: a }) {
2299
2299
  n++, l += a;
2300
2300
  }
2301
- }), f = Date.now(), x = new p(t), k = new L(), V = [], ws = new p(t), Ve = new p(t), As = new p(t), ys = new p(t), Es = new p(t), Cs = new p(t), bs = new p(t), gt = new p(t), Rs = new p(t), xt = new p(t), mt = new p(t), vs = new p(t), je = new p(t), Ts = new p(t), kt = new L(), Os = new p(t), wt = 0, At = 0, yt = new L(), Et = new L(), Ct = new L(), Ss = new p(t), Ns = new p(t), Us = new p(t), bt = new L(), Ls = new p(t), Rt = new p(t), Hs = /* @__PURE__ */ new Set(), vt = new p(t), _e, ue, Is = new L(), Ps = new L(), Ds = new L(), Fs = new p(t), Xe = new L(), Ms = new p(t), qs = [], Tt = new p(t), Ot = new p(t), zs = new p(t), Ks = new p(t), St = new L(), Bs = new p(t), $s = /* @__PURE__ */ new Set(), Ne = 0, Gs = new L(), Ze = 0, Nt = 0, Ut = new p(t), Lt = new L(), Ys = new p(t), Ue = new p(t), Ht = new p(t), It = new p(t), Je = new p(t), Le = new L(), Pt = new L(), Ws = new p(t), Dt = new p(t), Qs = new p(t), Vs = new p(t), js = new p(t), Ft = new p(t), Mt = new p(t), qt = new p(t), zt = new p(t), Kt = new p(t), xe = new ss(t), me = new p(t), Xs = new ss(t), Zs = new p(t), He = new p(t), Js = new ss(t), ei = new p(t);
2302
- function A(a) {
2301
+ }), f = Date.now(), x = new p(t), k = new L(), V = [], ws = new p(t), Ve = new p(t), ys = new p(t), As = new p(t), Es = new p(t), Cs = new p(t), bs = new p(t), gt = new p(t), Rs = new p(t), xt = new p(t), mt = new p(t), vs = new p(t), je = new p(t), Ts = new p(t), kt = new L(), Os = new p(t), wt = 0, yt = 0, At = new L(), Et = new L(), Ct = new L(), Ss = new p(t), Ns = new p(t), Us = new p(t), bt = new L(), Ls = new p(t), Rt = new p(t), Hs = /* @__PURE__ */ new Set(), vt = new p(t), _e, ue, Is = new L(), Ps = new L(), Ds = new L(), Fs = new p(t), Xe = new L(), Ms = new p(t), qs = [], Tt = new p(t), Ot = new p(t), zs = new p(t), Ks = new p(t), St = new L(), Bs = new p(t), $s = /* @__PURE__ */ new Set(), Ne = 0, Gs = new L(), Ze = 0, Nt = 0, Ut = new p(t), Lt = new L(), Ys = new p(t), Ue = new p(t), Ht = new p(t), It = new p(t), Je = new p(t), Le = new L(), Pt = new L(), Ws = new p(t), Dt = new p(t), Qs = new p(t), Vs = new p(t), js = new p(t), Ft = new p(t), Mt = new p(t), qt = new p(t), zt = new p(t), Kt = new p(t), xe = new ss(t), me = new p(t), Xs = new ss(t), Zs = new p(t), He = new p(t), Js = new ss(t), ei = new p(t);
2302
+ function y(a) {
2303
2303
  return {
2304
2304
  line: a.line,
2305
2305
  column: a.column,
@@ -2313,104 +2313,106 @@ function Ui(r, e, t) {
2313
2313
  ke >= 0 && D <= ke && (ke = -1);
2314
2314
  let Wt = ke >= 0 && D > ke;
2315
2315
  if (a.type === gr) {
2316
- let N = A(a);
2317
- if (kt.push(D), Os.p(D, N), x.p(a.name, N), P("font-face", a.name)) {
2316
+ let T = y(a);
2317
+ if (kt.push(D), Os.p(D, T), x.p(a.name, T), P("font-face", a.name)) {
2318
2318
  let E = /* @__PURE__ */ Object.create(null);
2319
- t && ws.p(a.start, A(a));
2319
+ t && ws.p(a.start, y(a));
2320
2320
  let R = a.children.find((d) => d.type === xr);
2321
2321
  for (let d of (R == null ? void 0 : R.children) || [])
2322
2322
  d.type === jt && d.value && (E[d.property] = d.value.text);
2323
2323
  k.push(1), V.push(E);
2324
2324
  }
2325
2325
  if (a.prelude === null || a.prelude === void 0)
2326
- P("layer", a.name) && (Ve.p("<anonymous>", A(a)), k.push(2));
2326
+ P("layer", a.name) && (Ve.p("<anonymous>", y(a)), k.push(2));
2327
2327
  else {
2328
2328
  let { name: E } = a, R = 1;
2329
2329
  if (P("media", E))
2330
- ys.p(a.prelude.text, A(a)), br(a.prelude) && (Es.p(a.prelude.text, A(a)), R++);
2330
+ As.p(a.prelude.text, y(a)), br(a.prelude) && (Es.p(a.prelude.text, y(a)), R++);
2331
2331
  else if (P("supports", E))
2332
- gt.p(a.prelude.text, A(a)), Cr(a.prelude) && (Rs.p(a.prelude.text, A(a)), R++);
2332
+ gt.p(a.prelude.text, y(a)), Cr(a.prelude) && (Rs.p(a.prelude.text, y(a)), R++);
2333
2333
  else if (Ge("keyframes", E)) {
2334
2334
  let d = `@${E} ${a.prelude.text}`;
2335
- xt.p(d, A(a)), a.is_vendor_prefixed && (mt.p(d, A(a)), R++), ke = D;
2335
+ xt.p(d, y(a)), a.is_vendor_prefixed && (mt.p(d, y(a)), R++), ke = D;
2336
2336
  } else if (P("layer", E))
2337
2337
  for (let d of a.prelude.text.split(",").map((_) => _.trim()))
2338
- Ve.p(d, A(a));
2338
+ Ve.p(d, y(a));
2339
2339
  else if (P("import", E)) {
2340
- if (As.p(a.prelude.text, A(a)), a.prelude.has_children)
2340
+ if (ys.p(a.prelude.text, y(a)), a.prelude.has_children)
2341
2341
  for (let d of a.prelude)
2342
- d.type === Hi && typeof d.value == "string" ? gt.p(d.value, A(d)) : d.type === mr && typeof d.value == "string" && Ve.p(d.value, A(d));
2343
- } else P("container", E) ? (vs.p(a.prelude.text, A(a)), ((ci = a.prelude.first_child) == null ? void 0 : ci.type) === kr && ((_i = a.prelude.first_child.first_child) == null ? void 0 : _i.type) === he && je.p(a.prelude.first_child.first_child.text, A(a))) : P("property", E) ? Ts.p(a.prelude.text, A(a)) : P("charset", E) && bs.p(a.prelude.text, A(a));
2342
+ d.type === Hi && typeof d.value == "string" ? gt.p(d.value, y(d)) : d.type === mr && typeof d.value == "string" && Ve.p(d.value, y(d));
2343
+ } else P("container", E) ? (vs.p(a.prelude.text, y(a)), ((ci = a.prelude.first_child) == null ? void 0 : ci.type) === kr && ((_i = a.prelude.first_child.first_child) == null ? void 0 : _i.type) === he && je.p(a.prelude.first_child.first_child.text, y(a))) : P("property", E) ? Ts.p(a.prelude.text, y(a)) : P("charset", E) && bs.p(a.prelude.text, y(a));
2344
2344
  k.push(R);
2345
2345
  }
2346
2346
  } else if (a.type === wr)
2347
- if (Wt && a.prelude)
2348
- a.prelude.type === ds && a.prelude.text && Rt.p(a.prelude.text, A(a.prelude));
2349
- else {
2350
- wt++, (ui = a.block) != null && ui.is_empty && At++;
2351
- let N = 0, E = 0, R = A(a);
2347
+ if (Wt && a.prelude) {
2348
+ if (a.prelude.type === ds && a.prelude.children.length > 0)
2349
+ for (let T of a.prelude.children)
2350
+ Rt.p(T.text, y(T));
2351
+ } else {
2352
+ wt++, (ui = a.block) != null && ui.is_empty && yt++;
2353
+ let T = 0, E = 0, R = y(a);
2352
2354
  if (a.prelude)
2353
2355
  for (const d of a.prelude.children)
2354
- d.type === ce && N++;
2356
+ d.type === ce && T++;
2355
2357
  if (a.block)
2356
2358
  for (const d of a.block.children)
2357
2359
  d.type === jt && E++;
2358
- yt.push(N + E), Ss.p(N + E, R), Et.push(N), Ns.p(N, R), Ct.push(E), Us.p(E, R), bt.push(D), Ls.p(D, R);
2360
+ At.push(T + E), Ss.p(T + E, R), Et.push(T), Ns.p(T, R), Ct.push(E), Us.p(E, R), bt.push(D), Ls.p(D, R);
2359
2361
  }
2360
2362
  else if (a.type === ce) {
2361
2363
  if (Wt)
2362
2364
  return I;
2363
- let N = A(a);
2364
- St.push(D > 0 ? D - 1 : 0), Bs.p(D > 0 ? D - 1 : 0, N), Hs.add(a.text);
2365
+ let T = y(a);
2366
+ St.push(D > 0 ? D - 1 : 0), Bs.p(D > 0 ? D - 1 : 0, T), Hs.add(a.text);
2365
2367
  let E = rs(a);
2366
- Xe.push(E), Ms.p(E, N), Rr(a) && vt.p(a.text, N), Di(a) && Ot.p(a.text, N);
2368
+ Xe.push(E), Ms.p(E, T), Rr(a) && vt.p(a.text, T), Di(a) && Ot.p(a.text, T);
2367
2369
  let R = vr(a);
2368
2370
  if (R !== !1)
2369
2371
  for (let j of R)
2370
- zs.p(j, N);
2371
- Tr(a, function(T) {
2372
- let U = T.name.trim() === "" ? " " : T.name;
2373
- Ks.p(U, T.loc);
2372
+ zs.p(j, T);
2373
+ Tr(a, function(O) {
2374
+ let U = O.name.trim() === "" ? " " : O.name;
2375
+ Ks.p(U, O.loc);
2374
2376
  });
2375
2377
  let d = _t(a), [_, z, Qt] = d;
2376
- return Fs.p(d.toString(), N), Is.push(_), Ps.push(z), Ds.push(Qt), _e === void 0 && (_e = d), ue === void 0 && (ue = d), ue !== void 0 && Li(ue, d) < 0 && (ue = d), _e !== void 0 && Li(_e, d) > 0 && (_e = d), qs.push(d), _ > 0 && Tt.p(a.text, N), I;
2378
+ return Fs.p(d.toString(), T), Is.push(_), Ps.push(z), Ds.push(Qt), _e === void 0 && (_e = d), ue === void 0 && (ue = d), ue !== void 0 && Li(ue, d) < 0 && (ue = d), _e !== void 0 && Li(_e, d) > 0 && (_e = d), qs.push(d), _ > 0 && Tt.p(a.text, T), I;
2377
2379
  } else if (a.type === jt) {
2378
2380
  Ne++, $s.add(a.text);
2379
- let N = A(a), E = D > 0 ? D - 1 : 0;
2380
- Lt.push(E), Ys.p(E, N);
2381
+ let T = y(a), E = D > 0 ? D - 1 : 0;
2382
+ Lt.push(E), Ys.p(E, T);
2381
2383
  let R = 1;
2382
2384
  if (a.is_important) {
2383
2385
  R++;
2384
- let T = a.text;
2385
- if (!T.toLowerCase().includes("!important")) {
2386
- let U = a.value.text, v = T.indexOf(U), Ae = T.slice(-1) === ";";
2387
- Dt.p(`${T.slice(v, Ae ? -1 : void 0)}`, A(a.value));
2386
+ let O = a.text;
2387
+ if (!O.toLowerCase().includes("!important")) {
2388
+ let U = a.value.text, v = O.indexOf(U), ye = O.slice(-1) === ";";
2389
+ Dt.p(`${O.slice(v, ye ? -1 : void 0)}`, y(a.value));
2388
2390
  }
2389
2391
  Wt && (Nt++, R++);
2390
2392
  }
2391
2393
  Gs.push(R);
2392
- let { is_important: d, property: _, is_browserhack: z, is_vendor_prefixed: Qt } = a, j = A(a);
2394
+ let { is_important: d, property: _, is_browserhack: z, is_vendor_prefixed: Qt } = a, j = y(a);
2393
2395
  j.length = _.length, Ue.p(_, j), d && Ze++, Qt ? (Le.push(2), It.p(_, j)) : xs(_) ? (Je.p(_, j), Le.push(d ? 3 : 2), d && Ut.p(_, j)) : z ? (Ht.p(_, j), Le.push(2)) : Le.push(1);
2394
2396
  {
2395
- let T = a.value, { text: U } = T, v = A(T), Ae = 1;
2397
+ let O = a.value, { text: U } = O, v = y(O), ye = 1;
2396
2398
  if (ut.has(U)) {
2397
- He.p(U, v), Pt.push(Ae);
2399
+ He.p(U, v), Pt.push(ye);
2398
2400
  return;
2399
2401
  }
2400
- if (rl(T) && (Ws.p(T.text, v), Ae++), Ni(T) && (Dt.p(U, v), U = U.slice(0, -2), Ae++), Pt.push(Ae), m("margin", _) || m("margin-block", _) || m("margin-inline", _) || m("margin-top", _) || m("margin-right", _) || m("margin-bottom", _) || m("margin-left", _) || m("padding", _) || m("padding-block", _) || m("padding-inline", _) || m("padding-top", _) || m("padding-right", _) || m("padding-bottom", _) || m("padding-left", _))
2401
- Xn(T) && ei.p(_, v);
2402
+ if (rl(O) && (Ws.p(O.text, v), ye++), Ni(O) && (Dt.p(U, v), U = U.slice(0, -2), ye++), Pt.push(ye), m("margin", _) || m("margin-block", _) || m("margin-inline", _) || m("margin-top", _) || m("margin-right", _) || m("margin-bottom", _) || m("margin-left", _) || m("padding", _) || m("padding-block", _) || m("padding-inline", _) || m("padding-top", _) || m("padding-right", _) || m("padding-bottom", _) || m("padding-left", _))
2403
+ Xn(O) && ei.p(_, v);
2402
2404
  else {
2403
2405
  if (m("z-index", _))
2404
2406
  return Qs.p(U, v), I;
2405
2407
  if (m("font", _)) {
2406
2408
  if (!ts.has(U)) {
2407
- let C = el(T, function(Ie) {
2409
+ let C = el(O, function(Ie) {
2408
2410
  Ie.type === "keyword" && He.p(Ie.value, v);
2409
2411
  });
2410
2412
  if (!C)
2411
2413
  return I;
2412
- let { font_size: O, line_height: S, font_family: X } = C;
2413
- X && Ft.p(X, v), O && Mt.p(O, v), S && qt.p(S, v);
2414
+ let { font_size: S, line_height: N, font_family: X } = C;
2415
+ X && Ft.p(X, v), S && Mt.p(S, v), N && qt.p(N, v);
2414
2416
  }
2415
2417
  } else if (m("font-size", _))
2416
2418
  ts.has(U) || Mt.p(U, v);
@@ -2421,75 +2423,75 @@ function Ui(r, e, t) {
2421
2423
  qt.p(U, v);
2422
2424
  else {
2423
2425
  if (m("transition", _) || m("animation", _))
2424
- return il(T.children, function(C) {
2426
+ return il(O.children, function(C) {
2425
2427
  C.type === "fn" ? zt.p(C.value.text, v) : C.type === "duration" ? Kt.p(C.value.text, v) : C.type === "keyword" && He.p(C.value.text, v);
2426
2428
  }), I;
2427
2429
  if (m("animation-duration", _) || m("transition-duration", _))
2428
- for (let C of T.children)
2430
+ for (let C of O.children)
2429
2431
  C.type !== Ee && Kt.p(C.text, v);
2430
2432
  else if (m("transition-timing-function", _) || m("animation-timing-function", _))
2431
- for (let C of T.children)
2433
+ for (let C of O.children)
2432
2434
  C.type !== Ee && zt.p(C.text, v);
2433
- else m("container-name", _) ? je.p(U, v) : m("container", _) ? ((fi = T.first_child) == null ? void 0 : fi.type) === he && je.p(T.first_child.text, v) : cl.has(al(_)) ? Js.push(U, _, v) : m("text-shadow", _) ? Vs.p(U, v) : m("box-shadow", _) && js.p(U, v);
2435
+ else m("container-name", _) ? je.p(U, v) : m("container", _) ? ((fi = O.first_child) == null ? void 0 : fi.type) === he && je.p(O.first_child.text, v) : cl.has(al(_)) ? Js.push(U, _, v) : m("text-shadow", _) ? Vs.p(U, v) : m("box-shadow", _) && js.p(U, v);
2434
2436
  }
2435
2437
  }
2436
2438
  }
2437
- let or = Ni(T);
2438
- B(T, (C) => {
2439
+ let or = Ni(O);
2440
+ B(O, (C) => {
2439
2441
  switch (C.type) {
2440
2442
  case ft: {
2441
- let O = C.unit, S = A(C);
2442
- return Xs.push(O, _, S), I;
2443
+ let S = C.unit, N = y(C);
2444
+ return Xs.push(S, _, N), I;
2443
2445
  }
2444
- case Ar: {
2445
- let O = C.text;
2446
- if (!O || !O.startsWith("#"))
2446
+ case yr: {
2447
+ let S = C.text;
2448
+ if (!S || !S.startsWith("#"))
2447
2449
  return I;
2448
- let S = O;
2449
- or && !S.endsWith("\\9") && (S = S + "\\9");
2450
- let X = S.length - 1;
2451
- Ge("\\9", S) && (X = X - 2);
2452
- let Ie = A(C);
2453
- return xe.push(S, _, Ie), me.p("hex" + X, Ie), I;
2450
+ let N = S;
2451
+ or && !N.endsWith("\\9") && (N = N + "\\9");
2452
+ let X = N.length - 1;
2453
+ Ge("\\9", N) && (X = X - 2);
2454
+ let Ie = y(C);
2455
+ return xe.push(N, _, Ie), me.p("hex" + X, Ie), I;
2454
2456
  }
2455
2457
  case he: {
2456
- let O = C.text, S = A(C);
2458
+ let S = C.text, N = y(C);
2457
2459
  if (m("font", _) || m("font-family", _))
2458
2460
  return I;
2459
- ut.has(O) && He.p(O, S);
2460
- let X = O.length;
2461
+ ut.has(S) && He.p(S, N);
2462
+ let X = S.length;
2461
2463
  if (X > 20 || X < 3)
2462
2464
  return I;
2463
- if (jn.has(O)) {
2464
- xe.push(O, _, S), me.p(O.toLowerCase(), S);
2465
+ if (jn.has(S)) {
2466
+ xe.push(S, _, N), me.p(S.toLowerCase(), N);
2465
2467
  return;
2466
2468
  }
2467
- if (Wn.has(O)) {
2468
- xe.push(O, _, S), me.p("named", S);
2469
+ if (Wn.has(S)) {
2470
+ xe.push(S, _, N), me.p("named", N);
2469
2471
  return;
2470
2472
  }
2471
- if (Qn.has(O)) {
2472
- xe.push(O, _, S), me.p("system", S);
2473
+ if (Qn.has(S)) {
2474
+ xe.push(S, _, N), me.p("system", N);
2473
2475
  return;
2474
2476
  }
2475
2477
  return I;
2476
2478
  }
2477
2479
  case gs: {
2478
- let O = C.name, S = A(C);
2479
- if (Vn.has(O)) {
2480
- xe.push(C.text, _, S), me.p(O.toLowerCase(), S);
2480
+ let S = C.name, N = y(C);
2481
+ if (Vn.has(S)) {
2482
+ xe.push(C.text, _, N), me.p(S.toLowerCase(), N);
2481
2483
  return;
2482
2484
  }
2483
- if (Ge("gradient", O)) {
2484
- Zs.p(C.text, S);
2485
+ if (Ge("gradient", S)) {
2486
+ Zs.p(C.text, N);
2485
2487
  return;
2486
2488
  }
2487
2489
  }
2488
2490
  }
2489
2491
  });
2490
2492
  }
2491
- } else if (a.type === yr) {
2492
- let { value: N } = a, E = ll(N || "");
2493
+ } else if (a.type === Ar) {
2494
+ let { value: T } = a, E = ll(T || "");
2493
2495
  if (Er(E, "data:")) {
2494
2496
  let R = E.length, d = hl(E);
2495
2497
  h.total++, o += R;
@@ -2512,7 +2514,7 @@ function Ui(r, e, t) {
2512
2514
  }
2513
2515
  }
2514
2516
  } else if (a.type === Ii)
2515
- return Cs.p(a.name, A(a)), I;
2517
+ return Cs.p(a.name, y(a)), I;
2516
2518
  });
2517
2519
  let ti = $s.size, we = Xe.size(), Bt = Is.aggregate(), $t = Ps.aggregate(), Gt = Ds.aggregate(), si = Hs.size, b = Object.assign, ii = r.length, Yt = V.length, ri = k.aggregate(), ni = Xe.aggregate(), li = Gs.aggregate(), oi = Le.aggregate(), ai = Pt.aggregate(), hi = x.c();
2518
2520
  return {
@@ -2550,8 +2552,8 @@ function Ui(r, e, t) {
2550
2552
  uniqueWithLocations: ws.c().uniqueWithLocations
2551
2553
  } : {}
2552
2554
  ),
2553
- import: As.c(),
2554
- media: b(ys.c(), {
2555
+ import: ys.c(),
2556
+ media: b(As.c(), {
2555
2557
  browserhacks: Es.c(),
2556
2558
  features: Cs.c()
2557
2559
  }),
@@ -2581,13 +2583,13 @@ function Ui(r, e, t) {
2581
2583
  rules: {
2582
2584
  total: wt,
2583
2585
  empty: {
2584
- total: At,
2585
- ratio: H(At, wt)
2586
+ total: yt,
2587
+ ratio: H(yt, wt)
2586
2588
  },
2587
2589
  sizes: b(
2588
- yt.aggregate(),
2590
+ At.aggregate(),
2589
2591
  {
2590
- items: yt.toArray()
2592
+ items: At.toArray()
2591
2593
  },
2592
2594
  Ss.c()
2593
2595
  ),
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": "8.0.1",
4
+ "version": "8.0.2",
5
5
  "author": "Bart Veneman",
6
6
  "repository": {
7
7
  "type": "git",