@projectwallace/css-analyzer 5.9.0 → 5.10.1

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
@@ -13,9 +13,9 @@ export function analyze(css: string): {
13
13
  };
14
14
  embeddedContent: {
15
15
  total: number;
16
- totalUnique: any;
16
+ totalUnique: number;
17
17
  unique: {
18
- [k: string]: any;
18
+ [k: string]: number;
19
19
  };
20
20
  uniquenessRatio: number;
21
21
  } & {
@@ -27,7 +27,12 @@ export function analyze(css: string): {
27
27
  total: number;
28
28
  totalUnique: number;
29
29
  uniquenessRatio: number;
30
- unique: any;
30
+ unique: {
31
+ [k: string]: {
32
+ size: number;
33
+ count: number;
34
+ };
35
+ };
31
36
  };
32
37
  };
33
38
  };
@@ -35,72 +40,74 @@ export function analyze(css: string): {
35
40
  fontface: {
36
41
  total: number;
37
42
  totalUnique: number;
38
- unique: string;
43
+ unique: {
44
+ [property: string]: string;
45
+ }[];
39
46
  uniquenessRatio: number;
40
47
  };
41
48
  import: {
42
49
  total: number;
43
- totalUnique: any;
50
+ totalUnique: number;
44
51
  unique: {
45
- [k: string]: any;
52
+ [k: string]: number;
46
53
  };
47
54
  uniquenessRatio: number;
48
55
  };
49
56
  media: {
50
57
  total: number;
51
- totalUnique: any;
58
+ totalUnique: number;
52
59
  unique: {
53
- [k: string]: any;
60
+ [k: string]: number;
54
61
  };
55
62
  uniquenessRatio: number;
56
63
  } & {
57
64
  browserhacks: {
58
65
  total: number;
59
- totalUnique: any;
66
+ totalUnique: number;
60
67
  unique: {
61
- [k: string]: any;
68
+ [k: string]: number;
62
69
  };
63
70
  uniquenessRatio: number;
64
71
  };
65
72
  };
66
73
  charset: {
67
74
  total: number;
68
- totalUnique: any;
75
+ totalUnique: number;
69
76
  unique: {
70
- [k: string]: any;
77
+ [k: string]: number;
71
78
  };
72
79
  uniquenessRatio: number;
73
80
  };
74
81
  supports: {
75
82
  total: number;
76
- totalUnique: any;
83
+ totalUnique: number;
77
84
  unique: {
78
- [k: string]: any;
85
+ [k: string]: number;
79
86
  };
80
87
  uniquenessRatio: number;
81
88
  } & {
82
89
  browserhacks: {
83
90
  total: number;
84
- totalUnique: any;
91
+ totalUnique: number;
85
92
  unique: {
86
- [k: string]: any;
93
+ [k: string]: number;
87
94
  };
88
95
  uniquenessRatio: number;
89
96
  };
90
97
  };
91
98
  keyframes: {
92
99
  total: number;
93
- totalUnique: any;
100
+ totalUnique: number;
94
101
  unique: {
95
- [k: string]: any;
102
+ [k: string]: number;
96
103
  };
97
104
  uniquenessRatio: number;
98
105
  } & {
99
106
  prefixed: {
100
107
  total: number;
101
- totalUnique: any;
108
+ totalUnique: number;
102
109
  unique: {
103
- [k: string]: any;
110
+ [k: string]: number;
104
111
  };
105
112
  uniquenessRatio: number;
106
113
  } & {
@@ -109,17 +116,17 @@ export function analyze(css: string): {
109
116
  };
110
117
  container: {
111
118
  total: number;
112
- totalUnique: any;
119
+ totalUnique: number;
113
120
  unique: {
114
- [k: string]: any;
121
+ [k: string]: number;
115
122
  };
116
123
  uniquenessRatio: number;
117
124
  };
118
125
  layer: {
119
126
  total: number;
120
- totalUnique: any;
127
+ totalUnique: number;
121
128
  unique: {
122
- [k: string]: any;
129
+ [k: string]: number;
123
130
  };
124
131
  uniquenessRatio: number;
125
132
  };
@@ -141,9 +148,9 @@ export function analyze(css: string): {
141
148
  } & {
142
149
  items: number[];
143
150
  unique: {
144
- [k: string]: any;
151
+ [k: string]: number;
145
152
  };
146
- totalUnique: any;
153
+ totalUnique: number;
147
154
  uniquenessRatio: number;
148
155
  };
149
156
  selectors: {
@@ -157,9 +164,9 @@ export function analyze(css: string): {
157
164
  } & {
158
165
  items: number[];
159
166
  unique: {
160
- [k: string]: any;
167
+ [k: string]: number;
161
168
  };
162
- totalUnique: any;
169
+ totalUnique: number;
163
170
  uniquenessRatio: number;
164
171
  };
165
172
  declarations: {
@@ -173,9 +180,9 @@ export function analyze(css: string): {
173
180
  } & {
174
181
  items: number[];
175
182
  unique: {
176
- [k: string]: any;
183
+ [k: string]: number;
177
184
  };
178
- totalUnique: any;
185
+ totalUnique: number;
179
186
  uniquenessRatio: number;
180
187
  };
181
188
  };
@@ -184,23 +191,23 @@ export function analyze(css: string): {
184
191
  totalUnique: number;
185
192
  uniquenessRatio: number;
186
193
  specificity: {
187
- /** @type [number, number, number] */
188
- min: [number, number, number];
189
- /** @type [number, number, number] */
190
- max: [number, number, number];
191
- /** @type [number, number, number] */
192
- sum: [number, number, number];
193
- /** @type [number, number, number] */
194
- mean: [number, number, number];
195
- /** @type [number, number, number] */
196
- mode: [number, number, number];
197
- /** @type [number, number, number] */
198
- median: [number, number, number];
199
- items: [number, number, number][];
194
+ /** @type Specificity */
195
+ min: Specificity;
196
+ /** @type Specificity */
197
+ max: Specificity;
198
+ /** @type Specificity */
199
+ sum: Specificity;
200
+ /** @type Specificity */
201
+ mean: Specificity;
202
+ /** @type Specificity */
203
+ mode: Specificity;
204
+ /** @type Specificity */
205
+ median: Specificity;
206
+ items: Specificity[];
200
207
  unique: {
201
- [k: string]: any;
208
+ [k: string]: number;
202
209
  };
203
- totalUnique: any;
210
+ totalUnique: number;
204
211
  uniquenessRatio: number;
205
212
  };
206
213
  complexity: {
@@ -213,9 +220,9 @@ export function analyze(css: string): {
213
220
  sum: number;
214
221
  } & {
215
222
  total: number;
216
- totalUnique: any;
223
+ totalUnique: number;
217
224
  unique: {
218
- [k: string]: any;
225
+ [k: string]: number;
219
226
  };
220
227
  uniquenessRatio: number;
221
228
  } & {
@@ -223,9 +230,9 @@ export function analyze(css: string): {
223
230
  };
224
231
  id: {
225
232
  total: number;
226
- totalUnique: any;
233
+ totalUnique: number;
227
234
  unique: {
228
- [k: string]: any;
235
+ [k: string]: number;
229
236
  };
230
237
  uniquenessRatio: number;
231
238
  } & {
@@ -233,9 +240,9 @@ export function analyze(css: string): {
233
240
  };
234
241
  accessibility: {
235
242
  total: number;
236
- totalUnique: any;
243
+ totalUnique: number;
237
244
  unique: {
238
- [k: string]: any;
245
+ [k: string]: number;
239
246
  };
240
247
  uniquenessRatio: number;
241
248
  } & {
@@ -243,17 +250,17 @@ export function analyze(css: string): {
243
250
  };
244
251
  keyframes: {
245
252
  total: number;
246
- totalUnique: any;
253
+ totalUnique: number;
247
254
  unique: {
248
- [k: string]: any;
255
+ [k: string]: number;
249
256
  };
250
257
  uniquenessRatio: number;
251
258
  };
252
259
  prefixed: {
253
260
  total: number;
254
- totalUnique: any;
261
+ totalUnique: number;
255
262
  unique: {
256
- [k: string]: any;
263
+ [k: string]: number;
257
264
  };
258
265
  uniquenessRatio: number;
259
266
  } & {
@@ -279,17 +286,17 @@ export function analyze(css: string): {
279
286
  };
280
287
  properties: {
281
288
  total: number;
282
- totalUnique: any;
289
+ totalUnique: number;
283
290
  unique: {
284
- [k: string]: any;
291
+ [k: string]: number;
285
292
  };
286
293
  uniquenessRatio: number;
287
294
  } & {
288
295
  prefixed: {
289
296
  total: number;
290
- totalUnique: any;
297
+ totalUnique: number;
291
298
  unique: {
292
- [k: string]: any;
299
+ [k: string]: number;
293
300
  };
294
301
  uniquenessRatio: number;
295
302
  } & {
@@ -297,18 +304,18 @@ export function analyze(css: string): {
297
304
  };
298
305
  custom: {
299
306
  total: number;
300
- totalUnique: any;
307
+ totalUnique: number;
301
308
  unique: {
302
- [k: string]: any;
309
+ [k: string]: number;
303
310
  };
304
311
  uniquenessRatio: number;
305
312
  } & {
306
313
  ratio: number;
307
314
  importants: {
308
315
  total: number;
309
- totalUnique: any;
316
+ totalUnique: number;
310
317
  unique: {
311
- [k: string]: any;
318
+ [k: string]: number;
312
319
  };
313
320
  uniquenessRatio: number;
314
321
  } & {
@@ -317,9 +324,9 @@ export function analyze(css: string): {
317
324
  };
318
325
  browserhacks: {
319
326
  total: number;
320
- totalUnique: any;
327
+ totalUnique: number;
321
328
  unique: {
322
- [k: string]: any;
329
+ [k: string]: number;
323
330
  };
324
331
  uniquenessRatio: number;
325
332
  } & {
@@ -338,114 +345,140 @@ export function analyze(css: string): {
338
345
  values: {
339
346
  colors: {
340
347
  total: number;
341
- totalUnique: any;
348
+ totalUnique: number;
342
349
  unique: {
343
- [k: string]: any;
350
+ [k: string]: number;
344
351
  };
345
352
  uniquenessRatio: number;
346
353
  } & {
347
- itemsPerContext: any;
354
+ itemsPerContext: {
355
+ [k: string]: {
356
+ total: number;
357
+ totalUnique: number;
358
+ unique: {
359
+ [k: string]: number;
360
+ };
361
+ uniquenessRatio: number;
362
+ };
363
+ };
348
364
  } & {
349
365
  formats: {
350
366
  total: number;
351
- totalUnique: any;
367
+ totalUnique: number;
352
368
  unique: {
353
- [k: string]: any;
369
+ [k: string]: number;
354
370
  };
355
371
  uniquenessRatio: number;
356
372
  };
357
373
  };
374
+ gradients: {
375
+ total: number;
376
+ totalUnique: number;
377
+ unique: {
378
+ [k: string]: number;
379
+ };
380
+ uniquenessRatio: number;
381
+ };
358
382
  fontFamilies: {
359
383
  total: number;
360
- totalUnique: any;
384
+ totalUnique: number;
361
385
  unique: {
362
- [k: string]: any;
386
+ [k: string]: number;
363
387
  };
364
388
  uniquenessRatio: number;
365
389
  };
366
390
  fontSizes: {
367
391
  total: number;
368
- totalUnique: any;
392
+ totalUnique: number;
369
393
  unique: {
370
- [k: string]: any;
394
+ [k: string]: number;
371
395
  };
372
396
  uniquenessRatio: number;
373
397
  };
374
398
  lineHeights: {
375
399
  total: number;
376
- totalUnique: any;
400
+ totalUnique: number;
377
401
  unique: {
378
- [k: string]: any;
402
+ [k: string]: number;
379
403
  };
380
404
  uniquenessRatio: number;
381
405
  };
382
406
  zindexes: {
383
407
  total: number;
384
- totalUnique: any;
408
+ totalUnique: number;
385
409
  unique: {
386
- [k: string]: any;
410
+ [k: string]: number;
387
411
  };
388
412
  uniquenessRatio: number;
389
413
  };
390
414
  textShadows: {
391
415
  total: number;
392
- totalUnique: any;
416
+ totalUnique: number;
393
417
  unique: {
394
- [k: string]: any;
418
+ [k: string]: number;
395
419
  };
396
420
  uniquenessRatio: number;
397
421
  };
398
422
  boxShadows: {
399
423
  total: number;
400
- totalUnique: any;
424
+ totalUnique: number;
401
425
  unique: {
402
- [k: string]: any;
426
+ [k: string]: number;
403
427
  };
404
428
  uniquenessRatio: number;
405
429
  };
406
430
  animations: {
407
431
  durations: {
408
432
  total: number;
409
- totalUnique: any;
433
+ totalUnique: number;
410
434
  unique: {
411
- [k: string]: any;
435
+ [k: string]: number;
412
436
  };
413
437
  uniquenessRatio: number;
414
438
  };
415
439
  timingFunctions: {
416
440
  total: number;
417
- totalUnique: any;
441
+ totalUnique: number;
418
442
  unique: {
419
- [k: string]: any;
443
+ [k: string]: number;
420
444
  };
421
445
  uniquenessRatio: number;
422
446
  };
423
447
  };
424
448
  prefixes: {
425
449
  total: number;
426
- totalUnique: any;
450
+ totalUnique: number;
427
451
  unique: {
428
- [k: string]: any;
452
+ [k: string]: number;
429
453
  };
430
454
  uniquenessRatio: number;
431
455
  };
432
456
  browserhacks: {
433
457
  total: number;
434
- totalUnique: any;
458
+ totalUnique: number;
435
459
  unique: {
436
- [k: string]: any;
460
+ [k: string]: number;
437
461
  };
438
462
  uniquenessRatio: number;
439
463
  };
440
464
  units: {
441
465
  total: number;
442
- totalUnique: any;
466
+ totalUnique: number;
443
467
  unique: {
444
- [k: string]: any;
468
+ [k: string]: number;
445
469
  };
446
470
  uniquenessRatio: number;
447
471
  } & {
448
- itemsPerContext: any;
472
+ itemsPerContext: {
473
+ [k: string]: {
474
+ total: number;
475
+ totalUnique: number;
476
+ unique: {
477
+ [k: string]: number;
478
+ };
479
+ uniquenessRatio: number;
480
+ };
481
+ };
449
482
  };
450
483
  };
451
484
  __meta__: {
@@ -454,5 +487,11 @@ export function analyze(css: string): {
454
487
  total: number;
455
488
  };
456
489
  };
457
- import { compareSpecificity } from "./selectors/utils.js";
458
- export { compareSpecificity };
490
+ /**
491
+ * Compare specificity A to Specificity B
492
+ * @param {Specificity} a - Specificity A
493
+ * @param {Specificity} b - Specificity B
494
+ * @returns {number} sortIndex - 0 when a==b, 1 when a<b, -1 when a>b
495
+ */
496
+ export function compareSpecificity(a: Specificity, b: Specificity): number;
497
+ export type Specificity = [number, number, number];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectwallace/css-analyzer",
3
- "version": "5.9.0",
3
+ "version": "5.10.1",
4
4
  "author": "Bart Veneman",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,7 +42,7 @@
42
42
  "metrics"
43
43
  ],
44
44
  "dependencies": {
45
- "@bramus/specificity": "^2.2.0",
45
+ "@bramus/specificity": "^2.3.0",
46
46
  "css-tree": "^2.3.1"
47
47
  },
48
48
  "devDependencies": {