@projectwallace/css-analyzer 5.13.4 → 5.14.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/index.d.ts CHANGED
@@ -17,18 +17,21 @@ export function analyze(css: string, options?: Options): {
17
17
  total: number;
18
18
  size: number;
19
19
  };
20
- embeddedContent: {
20
+ embeddedContent: ({
21
21
  total: number;
22
22
  totalUnique: number;
23
23
  uniquenessRatio: number;
24
24
  unique: Record<string, number>;
25
+ } & ({
25
26
  __unstable__uniqueWithLocations: Record<string, {
26
27
  line: number;
27
28
  column: number;
28
29
  offset: number;
29
30
  length: number;
30
31
  }[]>;
31
- } & {
32
+ } | {
33
+ __unstable__uniqueWithLocations?: undefined;
34
+ })) & {
32
35
  size: {
33
36
  total: number;
34
37
  ratio: number;
@@ -76,99 +79,123 @@ export function analyze(css: string, options?: Options): {
76
79
  totalUnique: number;
77
80
  uniquenessRatio: number;
78
81
  unique: Record<string, number>;
82
+ } & ({
79
83
  __unstable__uniqueWithLocations: Record<string, {
80
84
  line: number;
81
85
  column: number;
82
86
  offset: number;
83
87
  length: number;
84
88
  }[]>;
85
- };
86
- media: {
89
+ } | {
90
+ __unstable__uniqueWithLocations?: undefined;
91
+ });
92
+ media: ({
87
93
  total: number;
88
94
  totalUnique: number;
89
95
  uniquenessRatio: number;
90
96
  unique: Record<string, number>;
97
+ } & ({
91
98
  __unstable__uniqueWithLocations: Record<string, {
92
99
  line: number;
93
100
  column: number;
94
101
  offset: number;
95
102
  length: number;
96
103
  }[]>;
97
- } & {
104
+ } | {
105
+ __unstable__uniqueWithLocations?: undefined;
106
+ })) & {
98
107
  browserhacks: {
99
108
  total: number;
100
109
  totalUnique: number;
101
110
  uniquenessRatio: number;
102
111
  unique: Record<string, number>;
112
+ } & ({
103
113
  __unstable__uniqueWithLocations: Record<string, {
104
114
  line: number;
105
115
  column: number;
106
116
  offset: number;
107
117
  length: number;
108
118
  }[]>;
109
- };
119
+ } | {
120
+ __unstable__uniqueWithLocations?: undefined;
121
+ });
110
122
  };
111
123
  charset: {
112
124
  total: number;
113
125
  totalUnique: number;
114
126
  uniquenessRatio: number;
115
127
  unique: Record<string, number>;
128
+ } & ({
116
129
  __unstable__uniqueWithLocations: Record<string, {
117
130
  line: number;
118
131
  column: number;
119
132
  offset: number;
120
133
  length: number;
121
134
  }[]>;
122
- };
123
- supports: {
135
+ } | {
136
+ __unstable__uniqueWithLocations?: undefined;
137
+ });
138
+ supports: ({
124
139
  total: number;
125
140
  totalUnique: number;
126
141
  uniquenessRatio: number;
127
142
  unique: Record<string, number>;
143
+ } & ({
128
144
  __unstable__uniqueWithLocations: Record<string, {
129
145
  line: number;
130
146
  column: number;
131
147
  offset: number;
132
148
  length: number;
133
149
  }[]>;
134
- } & {
150
+ } | {
151
+ __unstable__uniqueWithLocations?: undefined;
152
+ })) & {
135
153
  browserhacks: {
136
154
  total: number;
137
155
  totalUnique: number;
138
156
  uniquenessRatio: number;
139
157
  unique: Record<string, number>;
158
+ } & ({
140
159
  __unstable__uniqueWithLocations: Record<string, {
141
160
  line: number;
142
161
  column: number;
143
162
  offset: number;
144
163
  length: number;
145
164
  }[]>;
146
- };
165
+ } | {
166
+ __unstable__uniqueWithLocations?: undefined;
167
+ });
147
168
  };
148
- keyframes: {
169
+ keyframes: ({
149
170
  total: number;
150
171
  totalUnique: number;
151
172
  uniquenessRatio: number;
152
173
  unique: Record<string, number>;
174
+ } & ({
153
175
  __unstable__uniqueWithLocations: Record<string, {
154
176
  line: number;
155
177
  column: number;
156
178
  offset: number;
157
179
  length: number;
158
180
  }[]>;
159
- } & {
160
- prefixed: {
181
+ } | {
182
+ __unstable__uniqueWithLocations?: undefined;
183
+ })) & {
184
+ prefixed: ({
161
185
  total: number;
162
186
  totalUnique: number;
163
187
  uniquenessRatio: number;
164
188
  unique: Record<string, number>;
189
+ } & ({
165
190
  __unstable__uniqueWithLocations: Record<string, {
166
191
  line: number;
167
192
  column: number;
168
193
  offset: number;
169
194
  length: number;
170
195
  }[]>;
171
- } & {
196
+ } | {
197
+ __unstable__uniqueWithLocations?: undefined;
198
+ })) & {
172
199
  ratio: number;
173
200
  };
174
201
  };
@@ -177,37 +204,46 @@ export function analyze(css: string, options?: Options): {
177
204
  totalUnique: number;
178
205
  uniquenessRatio: number;
179
206
  unique: Record<string, number>;
207
+ } & ({
180
208
  __unstable__uniqueWithLocations: Record<string, {
181
209
  line: number;
182
210
  column: number;
183
211
  offset: number;
184
212
  length: number;
185
213
  }[]>;
186
- };
214
+ } | {
215
+ __unstable__uniqueWithLocations?: undefined;
216
+ });
187
217
  layer: {
188
218
  total: number;
189
219
  totalUnique: number;
190
220
  uniquenessRatio: number;
191
221
  unique: Record<string, number>;
222
+ } & ({
192
223
  __unstable__uniqueWithLocations: Record<string, {
193
224
  line: number;
194
225
  column: number;
195
226
  offset: number;
196
227
  length: number;
197
228
  }[]>;
198
- };
229
+ } | {
230
+ __unstable__uniqueWithLocations?: undefined;
231
+ });
199
232
  property: {
200
233
  total: number;
201
234
  totalUnique: number;
202
235
  uniquenessRatio: number;
203
236
  unique: Record<string, number>;
237
+ } & ({
204
238
  __unstable__uniqueWithLocations: Record<string, {
205
239
  line: number;
206
240
  column: number;
207
241
  offset: number;
208
242
  length: number;
209
243
  }[]>;
210
- };
244
+ } | {
245
+ __unstable__uniqueWithLocations?: undefined;
246
+ });
211
247
  total: number;
212
248
  complexity: {
213
249
  min: number;
@@ -235,18 +271,21 @@ export function analyze(css: string, options?: Options): {
235
271
  sum: number;
236
272
  } & {
237
273
  items: number[];
238
- } & {
274
+ } & ({
239
275
  total: number;
240
276
  totalUnique: number;
241
277
  uniquenessRatio: number;
242
278
  unique: Record<string, number>;
279
+ } & ({
243
280
  __unstable__uniqueWithLocations: Record<string, {
244
281
  line: number;
245
282
  column: number;
246
283
  offset: number;
247
284
  length: number;
248
285
  }[]>;
249
- };
286
+ } | {
287
+ __unstable__uniqueWithLocations?: undefined;
288
+ }));
250
289
  selectors: {
251
290
  min: number;
252
291
  max: number;
@@ -257,18 +296,21 @@ export function analyze(css: string, options?: Options): {
257
296
  sum: number;
258
297
  } & {
259
298
  items: number[];
260
- } & {
299
+ } & ({
261
300
  total: number;
262
301
  totalUnique: number;
263
302
  uniquenessRatio: number;
264
303
  unique: Record<string, number>;
304
+ } & ({
265
305
  __unstable__uniqueWithLocations: Record<string, {
266
306
  line: number;
267
307
  column: number;
268
308
  offset: number;
269
309
  length: number;
270
310
  }[]>;
271
- };
311
+ } | {
312
+ __unstable__uniqueWithLocations?: undefined;
313
+ }));
272
314
  declarations: {
273
315
  min: number;
274
316
  max: number;
@@ -279,18 +321,21 @@ export function analyze(css: string, options?: Options): {
279
321
  sum: number;
280
322
  } & {
281
323
  items: number[];
282
- } & {
324
+ } & ({
283
325
  total: number;
284
326
  totalUnique: number;
285
327
  uniquenessRatio: number;
286
328
  unique: Record<string, number>;
329
+ } & ({
287
330
  __unstable__uniqueWithLocations: Record<string, {
288
331
  line: number;
289
332
  column: number;
290
333
  offset: number;
291
334
  length: number;
292
335
  }[]>;
293
- };
336
+ } | {
337
+ __unstable__uniqueWithLocations?: undefined;
338
+ }));
294
339
  };
295
340
  selectors: {
296
341
  total: number;
@@ -310,18 +355,21 @@ export function analyze(css: string, options?: Options): {
310
355
  /** @type Specificity */
311
356
  median: Specificity;
312
357
  items: Specificity[];
313
- } & {
358
+ } & ({
314
359
  total: number;
315
360
  totalUnique: number;
316
361
  uniquenessRatio: number;
317
362
  unique: Record<string, number>;
363
+ } & ({
318
364
  __unstable__uniqueWithLocations: Record<string, {
319
365
  line: number;
320
366
  column: number;
321
367
  offset: number;
322
368
  length: number;
323
369
  }[]>;
324
- };
370
+ } | {
371
+ __unstable__uniqueWithLocations?: undefined;
372
+ }));
325
373
  complexity: {
326
374
  min: number;
327
375
  max: number;
@@ -330,46 +378,55 @@ export function analyze(css: string, options?: Options): {
330
378
  median: number;
331
379
  range: number;
332
380
  sum: number;
333
- } & {
381
+ } & ({
334
382
  total: number;
335
383
  totalUnique: number;
336
384
  uniquenessRatio: number;
337
385
  unique: Record<string, number>;
386
+ } & ({
338
387
  __unstable__uniqueWithLocations: Record<string, {
339
388
  line: number;
340
389
  column: number;
341
390
  offset: number;
342
391
  length: number;
343
392
  }[]>;
344
- } & {
393
+ } | {
394
+ __unstable__uniqueWithLocations?: undefined;
395
+ })) & {
345
396
  items: number[];
346
397
  };
347
- id: {
398
+ id: ({
348
399
  total: number;
349
400
  totalUnique: number;
350
401
  uniquenessRatio: number;
351
402
  unique: Record<string, number>;
403
+ } & ({
352
404
  __unstable__uniqueWithLocations: Record<string, {
353
405
  line: number;
354
406
  column: number;
355
407
  offset: number;
356
408
  length: number;
357
409
  }[]>;
358
- } & {
410
+ } | {
411
+ __unstable__uniqueWithLocations?: undefined;
412
+ })) & {
359
413
  ratio: number;
360
414
  };
361
- accessibility: {
415
+ accessibility: ({
362
416
  total: number;
363
417
  totalUnique: number;
364
418
  uniquenessRatio: number;
365
419
  unique: Record<string, number>;
420
+ } & ({
366
421
  __unstable__uniqueWithLocations: Record<string, {
367
422
  line: number;
368
423
  column: number;
369
424
  offset: number;
370
425
  length: number;
371
426
  }[]>;
372
- } & {
427
+ } | {
428
+ __unstable__uniqueWithLocations?: undefined;
429
+ })) & {
373
430
  ratio: number;
374
431
  };
375
432
  keyframes: {
@@ -377,25 +434,31 @@ export function analyze(css: string, options?: Options): {
377
434
  totalUnique: number;
378
435
  uniquenessRatio: number;
379
436
  unique: Record<string, number>;
437
+ } & ({
380
438
  __unstable__uniqueWithLocations: Record<string, {
381
439
  line: number;
382
440
  column: number;
383
441
  offset: number;
384
442
  length: number;
385
443
  }[]>;
386
- };
387
- prefixed: {
444
+ } | {
445
+ __unstable__uniqueWithLocations?: undefined;
446
+ });
447
+ prefixed: ({
388
448
  total: number;
389
449
  totalUnique: number;
390
450
  uniquenessRatio: number;
391
451
  unique: Record<string, number>;
452
+ } & ({
392
453
  __unstable__uniqueWithLocations: Record<string, {
393
454
  line: number;
394
455
  column: number;
395
456
  offset: number;
396
457
  length: number;
397
458
  }[]>;
398
- } & {
459
+ } | {
460
+ __unstable__uniqueWithLocations?: undefined;
461
+ })) & {
399
462
  ratio: number;
400
463
  };
401
464
  combinators: {
@@ -403,13 +466,16 @@ export function analyze(css: string, options?: Options): {
403
466
  totalUnique: number;
404
467
  uniquenessRatio: number;
405
468
  unique: Record<string, number>;
469
+ } & ({
406
470
  __unstable__uniqueWithLocations: Record<string, {
407
471
  line: number;
408
472
  column: number;
409
473
  offset: number;
410
474
  length: number;
411
475
  }[]>;
412
- };
476
+ } | {
477
+ __unstable__uniqueWithLocations?: undefined;
478
+ });
413
479
  };
414
480
  declarations: {
415
481
  total: number;
@@ -437,72 +503,87 @@ export function analyze(css: string, options?: Options): {
437
503
  sum: number;
438
504
  };
439
505
  };
440
- properties: {
506
+ properties: ({
441
507
  total: number;
442
508
  totalUnique: number;
443
509
  uniquenessRatio: number;
444
510
  unique: Record<string, number>;
511
+ } & ({
445
512
  __unstable__uniqueWithLocations: Record<string, {
446
513
  line: number;
447
514
  column: number;
448
515
  offset: number;
449
516
  length: number;
450
517
  }[]>;
451
- } & {
452
- prefixed: {
518
+ } | {
519
+ __unstable__uniqueWithLocations?: undefined;
520
+ })) & {
521
+ prefixed: ({
453
522
  total: number;
454
523
  totalUnique: number;
455
524
  uniquenessRatio: number;
456
525
  unique: Record<string, number>;
526
+ } & ({
457
527
  __unstable__uniqueWithLocations: Record<string, {
458
528
  line: number;
459
529
  column: number;
460
530
  offset: number;
461
531
  length: number;
462
532
  }[]>;
463
- } & {
533
+ } | {
534
+ __unstable__uniqueWithLocations?: undefined;
535
+ })) & {
464
536
  ratio: number;
465
537
  };
466
- custom: {
538
+ custom: ({
467
539
  total: number;
468
540
  totalUnique: number;
469
541
  uniquenessRatio: number;
470
542
  unique: Record<string, number>;
543
+ } & ({
471
544
  __unstable__uniqueWithLocations: Record<string, {
472
545
  line: number;
473
546
  column: number;
474
547
  offset: number;
475
548
  length: number;
476
549
  }[]>;
477
- } & {
550
+ } | {
551
+ __unstable__uniqueWithLocations?: undefined;
552
+ })) & {
478
553
  ratio: number;
479
- importants: {
554
+ importants: ({
480
555
  total: number;
481
556
  totalUnique: number;
482
557
  uniquenessRatio: number;
483
558
  unique: Record<string, number>;
559
+ } & ({
484
560
  __unstable__uniqueWithLocations: Record<string, {
485
561
  line: number;
486
562
  column: number;
487
563
  offset: number;
488
564
  length: number;
489
565
  }[]>;
490
- } & {
566
+ } | {
567
+ __unstable__uniqueWithLocations?: undefined;
568
+ })) & {
491
569
  ratio: number;
492
570
  };
493
571
  };
494
- browserhacks: {
572
+ browserhacks: ({
495
573
  total: number;
496
574
  totalUnique: number;
497
575
  uniquenessRatio: number;
498
576
  unique: Record<string, number>;
577
+ } & ({
499
578
  __unstable__uniqueWithLocations: Record<string, {
500
579
  line: number;
501
580
  column: number;
502
581
  offset: number;
503
582
  length: number;
504
583
  }[]>;
505
- } & {
584
+ } | {
585
+ __unstable__uniqueWithLocations?: undefined;
586
+ })) & {
506
587
  ratio: number;
507
588
  };
508
589
  complexity: {
@@ -516,18 +597,21 @@ export function analyze(css: string, options?: Options): {
516
597
  };
517
598
  };
518
599
  values: {
519
- colors: {
600
+ colors: (({
520
601
  total: number;
521
602
  totalUnique: number;
522
603
  uniquenessRatio: number;
523
604
  unique: Record<string, number>;
605
+ } & ({
524
606
  __unstable__uniqueWithLocations: Record<string, {
525
607
  line: number;
526
608
  column: number;
527
609
  offset: number;
528
610
  length: number;
529
611
  }[]>;
530
- } & {
612
+ } | {
613
+ __unstable__uniqueWithLocations?: undefined;
614
+ })) & {
531
615
  itemsPerContext: {
532
616
  [k: string]: {
533
617
  total: number;
@@ -536,166 +620,205 @@ export function analyze(css: string, options?: Options): {
536
620
  uniquenessRatio: number;
537
621
  };
538
622
  };
539
- } & {
623
+ }) & {
540
624
  formats: {
541
625
  total: number;
542
626
  totalUnique: number;
543
627
  uniquenessRatio: number;
544
628
  unique: Record<string, number>;
629
+ } & ({
545
630
  __unstable__uniqueWithLocations: Record<string, {
546
631
  line: number;
547
632
  column: number;
548
633
  offset: number;
549
634
  length: number;
550
635
  }[]>;
551
- };
636
+ } | {
637
+ __unstable__uniqueWithLocations?: undefined;
638
+ });
552
639
  };
553
640
  gradients: {
554
641
  total: number;
555
642
  totalUnique: number;
556
643
  uniquenessRatio: number;
557
644
  unique: Record<string, number>;
645
+ } & ({
558
646
  __unstable__uniqueWithLocations: Record<string, {
559
647
  line: number;
560
648
  column: number;
561
649
  offset: number;
562
650
  length: number;
563
651
  }[]>;
564
- };
652
+ } | {
653
+ __unstable__uniqueWithLocations?: undefined;
654
+ });
565
655
  fontFamilies: {
566
656
  total: number;
567
657
  totalUnique: number;
568
658
  uniquenessRatio: number;
569
659
  unique: Record<string, number>;
660
+ } & ({
570
661
  __unstable__uniqueWithLocations: Record<string, {
571
662
  line: number;
572
663
  column: number;
573
664
  offset: number;
574
665
  length: number;
575
666
  }[]>;
576
- };
667
+ } | {
668
+ __unstable__uniqueWithLocations?: undefined;
669
+ });
577
670
  fontSizes: {
578
671
  total: number;
579
672
  totalUnique: number;
580
673
  uniquenessRatio: number;
581
674
  unique: Record<string, number>;
675
+ } & ({
582
676
  __unstable__uniqueWithLocations: Record<string, {
583
677
  line: number;
584
678
  column: number;
585
679
  offset: number;
586
680
  length: number;
587
681
  }[]>;
588
- };
682
+ } | {
683
+ __unstable__uniqueWithLocations?: undefined;
684
+ });
589
685
  lineHeights: {
590
686
  total: number;
591
687
  totalUnique: number;
592
688
  uniquenessRatio: number;
593
689
  unique: Record<string, number>;
690
+ } & ({
594
691
  __unstable__uniqueWithLocations: Record<string, {
595
692
  line: number;
596
693
  column: number;
597
694
  offset: number;
598
695
  length: number;
599
696
  }[]>;
600
- };
697
+ } | {
698
+ __unstable__uniqueWithLocations?: undefined;
699
+ });
601
700
  zindexes: {
602
701
  total: number;
603
702
  totalUnique: number;
604
703
  uniquenessRatio: number;
605
704
  unique: Record<string, number>;
705
+ } & ({
606
706
  __unstable__uniqueWithLocations: Record<string, {
607
707
  line: number;
608
708
  column: number;
609
709
  offset: number;
610
710
  length: number;
611
711
  }[]>;
612
- };
712
+ } | {
713
+ __unstable__uniqueWithLocations?: undefined;
714
+ });
613
715
  textShadows: {
614
716
  total: number;
615
717
  totalUnique: number;
616
718
  uniquenessRatio: number;
617
719
  unique: Record<string, number>;
720
+ } & ({
618
721
  __unstable__uniqueWithLocations: Record<string, {
619
722
  line: number;
620
723
  column: number;
621
724
  offset: number;
622
725
  length: number;
623
726
  }[]>;
624
- };
727
+ } | {
728
+ __unstable__uniqueWithLocations?: undefined;
729
+ });
625
730
  boxShadows: {
626
731
  total: number;
627
732
  totalUnique: number;
628
733
  uniquenessRatio: number;
629
734
  unique: Record<string, number>;
735
+ } & ({
630
736
  __unstable__uniqueWithLocations: Record<string, {
631
737
  line: number;
632
738
  column: number;
633
739
  offset: number;
634
740
  length: number;
635
741
  }[]>;
636
- };
742
+ } | {
743
+ __unstable__uniqueWithLocations?: undefined;
744
+ });
637
745
  animations: {
638
746
  durations: {
639
747
  total: number;
640
748
  totalUnique: number;
641
749
  uniquenessRatio: number;
642
750
  unique: Record<string, number>;
751
+ } & ({
643
752
  __unstable__uniqueWithLocations: Record<string, {
644
753
  line: number;
645
754
  column: number;
646
755
  offset: number;
647
756
  length: number;
648
757
  }[]>;
649
- };
758
+ } | {
759
+ __unstable__uniqueWithLocations?: undefined;
760
+ });
650
761
  timingFunctions: {
651
762
  total: number;
652
763
  totalUnique: number;
653
764
  uniquenessRatio: number;
654
765
  unique: Record<string, number>;
766
+ } & ({
655
767
  __unstable__uniqueWithLocations: Record<string, {
656
768
  line: number;
657
769
  column: number;
658
770
  offset: number;
659
771
  length: number;
660
772
  }[]>;
661
- };
773
+ } | {
774
+ __unstable__uniqueWithLocations?: undefined;
775
+ });
662
776
  };
663
777
  prefixes: {
664
778
  total: number;
665
779
  totalUnique: number;
666
780
  uniquenessRatio: number;
667
781
  unique: Record<string, number>;
782
+ } & ({
668
783
  __unstable__uniqueWithLocations: Record<string, {
669
784
  line: number;
670
785
  column: number;
671
786
  offset: number;
672
787
  length: number;
673
788
  }[]>;
674
- };
789
+ } | {
790
+ __unstable__uniqueWithLocations?: undefined;
791
+ });
675
792
  browserhacks: {
676
793
  total: number;
677
794
  totalUnique: number;
678
795
  uniquenessRatio: number;
679
796
  unique: Record<string, number>;
797
+ } & ({
680
798
  __unstable__uniqueWithLocations: Record<string, {
681
799
  line: number;
682
800
  column: number;
683
801
  offset: number;
684
802
  length: number;
685
803
  }[]>;
686
- };
687
- units: {
804
+ } | {
805
+ __unstable__uniqueWithLocations?: undefined;
806
+ });
807
+ units: ({
688
808
  total: number;
689
809
  totalUnique: number;
690
810
  uniquenessRatio: number;
691
811
  unique: Record<string, number>;
812
+ } & ({
692
813
  __unstable__uniqueWithLocations: Record<string, {
693
814
  line: number;
694
815
  column: number;
695
816
  offset: number;
696
817
  length: number;
697
818
  }[]>;
698
- } & {
819
+ } | {
820
+ __unstable__uniqueWithLocations?: undefined;
821
+ })) & {
699
822
  itemsPerContext: {
700
823
  [k: string]: {
701
824
  total: number;
@@ -714,6 +837,21 @@ export function analyze(css: string, options?: Options): {
714
837
  range: number;
715
838
  sum: number;
716
839
  };
840
+ keywords: {
841
+ total: number;
842
+ totalUnique: number;
843
+ uniquenessRatio: number;
844
+ unique: Record<string, number>;
845
+ } & ({
846
+ __unstable__uniqueWithLocations: Record<string, {
847
+ line: number;
848
+ column: number;
849
+ offset: number;
850
+ length: number;
851
+ }[]>;
852
+ } | {
853
+ __unstable__uniqueWithLocations?: undefined;
854
+ });
717
855
  };
718
856
  __meta__: {
719
857
  parseTime: number;