@projectwallace/css-analyzer 5.11.0-alpha.1 → 5.11.0-alpha.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.
package/dist/index.d.ts CHANGED
@@ -1,9 +1,13 @@
1
- export type Specificity = [number, number, number];
1
+ /**
2
+ * @typedef Options
3
+ * @property {boolean} useUnstableLocations **WARNING: EXPERIMENTAL!** Use Locations (`{ 'item': [{ line, column, offset, length }] }`) instead of a regular count per occurrence (`{ 'item': 3 }`)
4
+ */
2
5
  /**
3
6
  * Analyze CSS
4
7
  * @param {string} css
8
+ * @param {Options} options
5
9
  */
6
- export function analyze(css: string, options?: {}): {
10
+ export function analyze(css: string, options?: Options): {
7
11
  stylesheet: {
8
12
  sourceLinesOfCode: number;
9
13
  linesOfCode: number;
@@ -375,6 +379,19 @@ export function analyze(css: string, options?: {}): {
375
379
  }) & {
376
380
  ratio: number;
377
381
  };
382
+ combinators: {
383
+ total: number;
384
+ totalUnique: number;
385
+ unique: {};
386
+ uniquenessRatio: number;
387
+ __unstable__uniqueWithLocations: any;
388
+ } | {
389
+ total: number;
390
+ totalUnique: number;
391
+ unique: {};
392
+ uniquenessRatio: number;
393
+ __unstable__uniqueWithLocations?: undefined;
394
+ };
378
395
  };
379
396
  declarations: {
380
397
  total: number;
@@ -494,7 +511,9 @@ export function analyze(css: string, options?: {}): {
494
511
  [k: string]: {
495
512
  total: number;
496
513
  totalUnique: number;
497
- unique: {};
514
+ unique: {
515
+ [k: string]: number;
516
+ };
498
517
  uniquenessRatio: number;
499
518
  };
500
519
  };
@@ -675,7 +694,9 @@ export function analyze(css: string, options?: {}): {
675
694
  [k: string]: {
676
695
  total: number;
677
696
  totalUnique: number;
678
- unique: {};
697
+ unique: {
698
+ [k: string]: number;
699
+ };
679
700
  uniquenessRatio: number;
680
701
  };
681
702
  };
@@ -687,5 +708,17 @@ export function analyze(css: string, options?: {}): {
687
708
  total: number;
688
709
  };
689
710
  };
690
- import { compareSpecificity } from "./selectors/utils.js";
691
- export { compareSpecificity };
711
+ /**
712
+ * Compare specificity A to Specificity B
713
+ * @param {Specificity} a - Specificity A
714
+ * @param {Specificity} b - Specificity B
715
+ * @returns {number} sortIndex - 0 when a==b, 1 when a<b, -1 when a>b
716
+ */
717
+ export function compareSpecificity(a: Specificity, b: Specificity): number;
718
+ export type Specificity = [number, number, number];
719
+ export type Options = {
720
+ /**
721
+ * **WARNING: EXPERIMENTAL!** Use Locations (`{ 'item': [{ line, column, offset, length }] }`) instead of a regular count per occurrence (`{ 'item': 3 }`)
722
+ */
723
+ useUnstableLocations: boolean;
724
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectwallace/css-analyzer",
3
- "version": "5.11.0-alpha.1",
3
+ "version": "5.11.0-alpha.3",
4
4
  "author": "Bart Veneman",
5
5
  "repository": {
6
6
  "type": "git",