@projectwallace/css-analyzer 5.14.0 → 5.15.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/analyzer.cjs +1 -1
- package/dist/analyzer.cjs.map +1 -1
- package/dist/analyzer.modern.js +1 -1
- package/dist/analyzer.modern.js.map +1 -1
- package/dist/analyzer.module.js +1 -1
- package/dist/analyzer.module.js.map +1 -1
- package/dist/analyzer.umd.js +1 -1
- package/dist/analyzer.umd.js.map +1 -1
- package/dist/index.d.ts +68 -1
- package/package.json +5 -4
- package/readme.md +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
30
30
|
length: number;
|
|
31
31
|
}[]>;
|
|
32
32
|
} | {
|
|
33
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
33
34
|
__unstable__uniqueWithLocations?: undefined;
|
|
34
35
|
})) & {
|
|
35
36
|
size: {
|
|
@@ -87,6 +88,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
87
88
|
length: number;
|
|
88
89
|
}[]>;
|
|
89
90
|
} | {
|
|
91
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
90
92
|
__unstable__uniqueWithLocations?: undefined;
|
|
91
93
|
});
|
|
92
94
|
media: ({
|
|
@@ -102,6 +104,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
102
104
|
length: number;
|
|
103
105
|
}[]>;
|
|
104
106
|
} | {
|
|
107
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
105
108
|
__unstable__uniqueWithLocations?: undefined;
|
|
106
109
|
})) & {
|
|
107
110
|
browserhacks: {
|
|
@@ -117,6 +120,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
117
120
|
length: number;
|
|
118
121
|
}[]>;
|
|
119
122
|
} | {
|
|
123
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
120
124
|
__unstable__uniqueWithLocations?: undefined;
|
|
121
125
|
});
|
|
122
126
|
};
|
|
@@ -133,6 +137,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
133
137
|
length: number;
|
|
134
138
|
}[]>;
|
|
135
139
|
} | {
|
|
140
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
136
141
|
__unstable__uniqueWithLocations?: undefined;
|
|
137
142
|
});
|
|
138
143
|
supports: ({
|
|
@@ -148,6 +153,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
148
153
|
length: number;
|
|
149
154
|
}[]>;
|
|
150
155
|
} | {
|
|
156
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
151
157
|
__unstable__uniqueWithLocations?: undefined;
|
|
152
158
|
})) & {
|
|
153
159
|
browserhacks: {
|
|
@@ -163,6 +169,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
163
169
|
length: number;
|
|
164
170
|
}[]>;
|
|
165
171
|
} | {
|
|
172
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
166
173
|
__unstable__uniqueWithLocations?: undefined;
|
|
167
174
|
});
|
|
168
175
|
};
|
|
@@ -179,6 +186,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
179
186
|
length: number;
|
|
180
187
|
}[]>;
|
|
181
188
|
} | {
|
|
189
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
182
190
|
__unstable__uniqueWithLocations?: undefined;
|
|
183
191
|
})) & {
|
|
184
192
|
prefixed: ({
|
|
@@ -194,6 +202,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
194
202
|
length: number;
|
|
195
203
|
}[]>;
|
|
196
204
|
} | {
|
|
205
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
197
206
|
__unstable__uniqueWithLocations?: undefined;
|
|
198
207
|
})) & {
|
|
199
208
|
ratio: number;
|
|
@@ -212,6 +221,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
212
221
|
length: number;
|
|
213
222
|
}[]>;
|
|
214
223
|
} | {
|
|
224
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
215
225
|
__unstable__uniqueWithLocations?: undefined;
|
|
216
226
|
});
|
|
217
227
|
layer: {
|
|
@@ -227,6 +237,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
227
237
|
length: number;
|
|
228
238
|
}[]>;
|
|
229
239
|
} | {
|
|
240
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
230
241
|
__unstable__uniqueWithLocations?: undefined;
|
|
231
242
|
});
|
|
232
243
|
property: {
|
|
@@ -242,6 +253,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
242
253
|
length: number;
|
|
243
254
|
}[]>;
|
|
244
255
|
} | {
|
|
256
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
245
257
|
__unstable__uniqueWithLocations?: undefined;
|
|
246
258
|
});
|
|
247
259
|
total: number;
|
|
@@ -284,6 +296,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
284
296
|
length: number;
|
|
285
297
|
}[]>;
|
|
286
298
|
} | {
|
|
299
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
287
300
|
__unstable__uniqueWithLocations?: undefined;
|
|
288
301
|
}));
|
|
289
302
|
selectors: {
|
|
@@ -309,6 +322,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
309
322
|
length: number;
|
|
310
323
|
}[]>;
|
|
311
324
|
} | {
|
|
325
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
312
326
|
__unstable__uniqueWithLocations?: undefined;
|
|
313
327
|
}));
|
|
314
328
|
declarations: {
|
|
@@ -334,6 +348,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
334
348
|
length: number;
|
|
335
349
|
}[]>;
|
|
336
350
|
} | {
|
|
351
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
337
352
|
__unstable__uniqueWithLocations?: undefined;
|
|
338
353
|
}));
|
|
339
354
|
};
|
|
@@ -368,6 +383,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
368
383
|
length: number;
|
|
369
384
|
}[]>;
|
|
370
385
|
} | {
|
|
386
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
371
387
|
__unstable__uniqueWithLocations?: undefined;
|
|
372
388
|
}));
|
|
373
389
|
complexity: {
|
|
@@ -391,6 +407,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
391
407
|
length: number;
|
|
392
408
|
}[]>;
|
|
393
409
|
} | {
|
|
410
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
394
411
|
__unstable__uniqueWithLocations?: undefined;
|
|
395
412
|
})) & {
|
|
396
413
|
items: number[];
|
|
@@ -408,6 +425,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
408
425
|
length: number;
|
|
409
426
|
}[]>;
|
|
410
427
|
} | {
|
|
428
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
411
429
|
__unstable__uniqueWithLocations?: undefined;
|
|
412
430
|
})) & {
|
|
413
431
|
ratio: number;
|
|
@@ -425,6 +443,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
425
443
|
length: number;
|
|
426
444
|
}[]>;
|
|
427
445
|
} | {
|
|
446
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
428
447
|
__unstable__uniqueWithLocations?: undefined;
|
|
429
448
|
})) & {
|
|
430
449
|
ratio: number;
|
|
@@ -442,6 +461,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
442
461
|
length: number;
|
|
443
462
|
}[]>;
|
|
444
463
|
} | {
|
|
464
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
445
465
|
__unstable__uniqueWithLocations?: undefined;
|
|
446
466
|
});
|
|
447
467
|
prefixed: ({
|
|
@@ -457,6 +477,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
457
477
|
length: number;
|
|
458
478
|
}[]>;
|
|
459
479
|
} | {
|
|
480
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
460
481
|
__unstable__uniqueWithLocations?: undefined;
|
|
461
482
|
})) & {
|
|
462
483
|
ratio: number;
|
|
@@ -474,6 +495,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
474
495
|
length: number;
|
|
475
496
|
}[]>;
|
|
476
497
|
} | {
|
|
498
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
477
499
|
__unstable__uniqueWithLocations?: undefined;
|
|
478
500
|
});
|
|
479
501
|
};
|
|
@@ -516,6 +538,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
516
538
|
length: number;
|
|
517
539
|
}[]>;
|
|
518
540
|
} | {
|
|
541
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
519
542
|
__unstable__uniqueWithLocations?: undefined;
|
|
520
543
|
})) & {
|
|
521
544
|
prefixed: ({
|
|
@@ -531,6 +554,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
531
554
|
length: number;
|
|
532
555
|
}[]>;
|
|
533
556
|
} | {
|
|
557
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
534
558
|
__unstable__uniqueWithLocations?: undefined;
|
|
535
559
|
})) & {
|
|
536
560
|
ratio: number;
|
|
@@ -548,6 +572,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
548
572
|
length: number;
|
|
549
573
|
}[]>;
|
|
550
574
|
} | {
|
|
575
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
551
576
|
__unstable__uniqueWithLocations?: undefined;
|
|
552
577
|
})) & {
|
|
553
578
|
ratio: number;
|
|
@@ -564,6 +589,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
564
589
|
length: number;
|
|
565
590
|
}[]>;
|
|
566
591
|
} | {
|
|
592
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
567
593
|
__unstable__uniqueWithLocations?: undefined;
|
|
568
594
|
})) & {
|
|
569
595
|
ratio: number;
|
|
@@ -582,6 +608,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
582
608
|
length: number;
|
|
583
609
|
}[]>;
|
|
584
610
|
} | {
|
|
611
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
585
612
|
__unstable__uniqueWithLocations?: undefined;
|
|
586
613
|
})) & {
|
|
587
614
|
ratio: number;
|
|
@@ -610,6 +637,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
610
637
|
length: number;
|
|
611
638
|
}[]>;
|
|
612
639
|
} | {
|
|
640
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
613
641
|
__unstable__uniqueWithLocations?: undefined;
|
|
614
642
|
})) & {
|
|
615
643
|
itemsPerContext: {
|
|
@@ -634,6 +662,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
634
662
|
length: number;
|
|
635
663
|
}[]>;
|
|
636
664
|
} | {
|
|
665
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
637
666
|
__unstable__uniqueWithLocations?: undefined;
|
|
638
667
|
});
|
|
639
668
|
};
|
|
@@ -650,6 +679,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
650
679
|
length: number;
|
|
651
680
|
}[]>;
|
|
652
681
|
} | {
|
|
682
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
653
683
|
__unstable__uniqueWithLocations?: undefined;
|
|
654
684
|
});
|
|
655
685
|
fontFamilies: {
|
|
@@ -665,6 +695,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
665
695
|
length: number;
|
|
666
696
|
}[]>;
|
|
667
697
|
} | {
|
|
698
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
668
699
|
__unstable__uniqueWithLocations?: undefined;
|
|
669
700
|
});
|
|
670
701
|
fontSizes: {
|
|
@@ -680,6 +711,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
680
711
|
length: number;
|
|
681
712
|
}[]>;
|
|
682
713
|
} | {
|
|
714
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
683
715
|
__unstable__uniqueWithLocations?: undefined;
|
|
684
716
|
});
|
|
685
717
|
lineHeights: {
|
|
@@ -695,6 +727,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
695
727
|
length: number;
|
|
696
728
|
}[]>;
|
|
697
729
|
} | {
|
|
730
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
698
731
|
__unstable__uniqueWithLocations?: undefined;
|
|
699
732
|
});
|
|
700
733
|
zindexes: {
|
|
@@ -710,6 +743,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
710
743
|
length: number;
|
|
711
744
|
}[]>;
|
|
712
745
|
} | {
|
|
746
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
713
747
|
__unstable__uniqueWithLocations?: undefined;
|
|
714
748
|
});
|
|
715
749
|
textShadows: {
|
|
@@ -725,6 +759,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
725
759
|
length: number;
|
|
726
760
|
}[]>;
|
|
727
761
|
} | {
|
|
762
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
728
763
|
__unstable__uniqueWithLocations?: undefined;
|
|
729
764
|
});
|
|
730
765
|
boxShadows: {
|
|
@@ -740,8 +775,34 @@ export function analyze(css: string, options?: Options): {
|
|
|
740
775
|
length: number;
|
|
741
776
|
}[]>;
|
|
742
777
|
} | {
|
|
778
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
743
779
|
__unstable__uniqueWithLocations?: undefined;
|
|
744
780
|
});
|
|
781
|
+
borderRadiuses: ({
|
|
782
|
+
total: number;
|
|
783
|
+
totalUnique: number;
|
|
784
|
+
uniquenessRatio: number;
|
|
785
|
+
unique: Record<string, number>;
|
|
786
|
+
} & ({
|
|
787
|
+
__unstable__uniqueWithLocations: Record<string, {
|
|
788
|
+
line: number;
|
|
789
|
+
column: number;
|
|
790
|
+
offset: number;
|
|
791
|
+
length: number;
|
|
792
|
+
}[]>;
|
|
793
|
+
} | {
|
|
794
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
795
|
+
__unstable__uniqueWithLocations?: undefined;
|
|
796
|
+
})) & {
|
|
797
|
+
itemsPerContext: {
|
|
798
|
+
[k: string]: {
|
|
799
|
+
total: number;
|
|
800
|
+
totalUnique: number;
|
|
801
|
+
unique: Record<string, number>;
|
|
802
|
+
uniquenessRatio: number;
|
|
803
|
+
};
|
|
804
|
+
};
|
|
805
|
+
};
|
|
745
806
|
animations: {
|
|
746
807
|
durations: {
|
|
747
808
|
total: number;
|
|
@@ -756,6 +817,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
756
817
|
length: number;
|
|
757
818
|
}[]>;
|
|
758
819
|
} | {
|
|
820
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
759
821
|
__unstable__uniqueWithLocations?: undefined;
|
|
760
822
|
});
|
|
761
823
|
timingFunctions: {
|
|
@@ -771,6 +833,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
771
833
|
length: number;
|
|
772
834
|
}[]>;
|
|
773
835
|
} | {
|
|
836
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
774
837
|
__unstable__uniqueWithLocations?: undefined;
|
|
775
838
|
});
|
|
776
839
|
};
|
|
@@ -787,6 +850,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
787
850
|
length: number;
|
|
788
851
|
}[]>;
|
|
789
852
|
} | {
|
|
853
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
790
854
|
__unstable__uniqueWithLocations?: undefined;
|
|
791
855
|
});
|
|
792
856
|
browserhacks: {
|
|
@@ -802,6 +866,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
802
866
|
length: number;
|
|
803
867
|
}[]>;
|
|
804
868
|
} | {
|
|
869
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
805
870
|
__unstable__uniqueWithLocations?: undefined;
|
|
806
871
|
});
|
|
807
872
|
units: ({
|
|
@@ -817,6 +882,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
817
882
|
length: number;
|
|
818
883
|
}[]>;
|
|
819
884
|
} | {
|
|
885
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
820
886
|
__unstable__uniqueWithLocations?: undefined;
|
|
821
887
|
})) & {
|
|
822
888
|
itemsPerContext: {
|
|
@@ -850,6 +916,7 @@ export function analyze(css: string, options?: Options): {
|
|
|
850
916
|
length: number;
|
|
851
917
|
}[]>;
|
|
852
918
|
} | {
|
|
919
|
+
/** @typedef {[number, number, number]} Specificity */
|
|
853
920
|
__unstable__uniqueWithLocations?: undefined;
|
|
854
921
|
});
|
|
855
922
|
};
|
|
@@ -870,12 +937,12 @@ export { isBrowserhack as isValueBrowserhack } from "./values/browserhacks.js";
|
|
|
870
937
|
export { isHack as isPropertyHack } from "./properties/property-utils.js";
|
|
871
938
|
export { isValuePrefixed } from "./values/vendor-prefix.js";
|
|
872
939
|
export { hasVendorPrefix } from "./vendor-prefix.js";
|
|
873
|
-
export type Specificity = [number, number, number];
|
|
874
940
|
export type Options = {
|
|
875
941
|
/**
|
|
876
942
|
* **WARNING: EXPERIMENTAL!** Use Locations (`{ 'item': [{ line, column, offset, length }] }`) instead of a regular count per occurrence (`{ 'item': 3 }`)
|
|
877
943
|
*/
|
|
878
944
|
useUnstableLocations: boolean;
|
|
879
945
|
};
|
|
946
|
+
export type Specificity = [number, number, number];
|
|
880
947
|
export { getComplexity as selectorComplexity, isPrefixed as isSelectorPrefixed, isAccessibility as isAccessibilitySelector } from "./selectors/utils.js";
|
|
881
948
|
export { isSupportsBrowserhack, isMediaBrowserhack } from "./atrules/atrules.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@projectwallace/css-analyzer",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.15.0",
|
|
4
4
|
"author": "Bart Veneman",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"module": "./dist/analyzer.module.js",
|
|
19
19
|
"unpkg": "./dist/analyzer.umd.js",
|
|
20
20
|
"exports": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
21
22
|
"require": "./dist/analyzer.cjs",
|
|
22
|
-
"default": "./dist/analyzer.modern.js"
|
|
23
|
-
"types": "./dist/index.d.ts"
|
|
23
|
+
"default": "./dist/analyzer.modern.js"
|
|
24
24
|
},
|
|
25
25
|
"types": "./dist/index.d.ts",
|
|
26
26
|
"engines": {
|
|
@@ -53,8 +53,9 @@
|
|
|
53
53
|
"css-tree": "^2.3.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
+
"@codecov/vite-plugin": "^0.0.1-beta.8",
|
|
57
|
+
"c8": "^9.1.0",
|
|
56
58
|
"microbundle": "^0.15.1",
|
|
57
|
-
"oxlint": "^0.0.22",
|
|
58
59
|
"uvu": "^0.5.6"
|
|
59
60
|
},
|
|
60
61
|
"mangle": {
|
package/readme.md
CHANGED
|
@@ -415,5 +415,3 @@ const isSpecificityEqual = compareSpecificity(
|
|
|
415
415
|
- [Constyble](https://github.com/projectwallace/constyble) - CSS Complexity linter
|
|
416
416
|
- [Color Sorter](https://github.com/projectwallace/color-sorter) - Sort CSS colors
|
|
417
417
|
by hue, saturation, lightness and opacity
|
|
418
|
-
- [CSS Diff Github Action](https://github.com/projectwallace/css-diff-action) - A
|
|
419
|
-
GitHub action that comments on your PR to tell you how your code quality has changed
|