@projectwallace/css-analyzer 5.0.0-alpha.1 → 5.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 (48) hide show
  1. package/dist/analyzer.cjs +1 -1
  2. package/dist/analyzer.cjs.map +1 -1
  3. package/dist/analyzer.modern.js +2 -0
  4. package/dist/analyzer.modern.js.map +1 -0
  5. package/dist/analyzer.module.js +1 -1
  6. package/dist/analyzer.module.js.map +1 -1
  7. package/dist/analyzer.umd.js +1 -1
  8. package/dist/analyzer.umd.js.map +1 -1
  9. package/package.json +10 -10
  10. package/dist/analyzer.js +0 -2
  11. package/dist/analyzer.js.map +0 -1
  12. package/src/aggregate-collection.js +0 -113
  13. package/src/aggregate-collection.test.js +0 -47
  14. package/src/atrules/atrules.js +0 -76
  15. package/src/atrules/atrules.test.js +0 -289
  16. package/src/context-collection.js +0 -36
  17. package/src/countable-collection.js +0 -46
  18. package/src/declarations/declarations.js +0 -46
  19. package/src/declarations/declarations.test.js +0 -113
  20. package/src/index.js +0 -259
  21. package/src/index.test.js +0 -60
  22. package/src/properties/properties.js +0 -48
  23. package/src/properties/properties.test.js +0 -138
  24. package/src/rules/rules.js +0 -57
  25. package/src/rules/rules.test.js +0 -247
  26. package/src/selectors/complexity.test.js +0 -123
  27. package/src/selectors/selectors.js +0 -122
  28. package/src/selectors/selectors.test.js +0 -189
  29. package/src/selectors/specificity.js +0 -201
  30. package/src/selectors/specificity.test.js +0 -247
  31. package/src/smoke.test.js +0 -39
  32. package/src/stylesheet/stylesheet.test.js +0 -88
  33. package/src/values/animations.js +0 -53
  34. package/src/values/animations.test.js +0 -154
  35. package/src/values/box-shadows.test.js +0 -82
  36. package/src/values/colors.js +0 -192
  37. package/src/values/colors.test.js +0 -804
  38. package/src/values/font-families.js +0 -98
  39. package/src/values/font-families.test.js +0 -119
  40. package/src/values/font-sizes.js +0 -92
  41. package/src/values/font-sizes.test.js +0 -120
  42. package/src/values/text-shadows.test.js +0 -93
  43. package/src/values/units.test.js +0 -72
  44. package/src/values/values.js +0 -30
  45. package/src/values/vendor-prefix.js +0 -45
  46. package/src/values/vendor-prefix.test.js +0 -64
  47. package/src/values/z-index.test.js +0 -54
  48. package/src/vendor-prefix.js +0 -16
@@ -1,64 +0,0 @@
1
- import { suite } from 'uvu'
2
- import * as assert from 'uvu/assert'
3
- import { analyze } from '../index.js'
4
-
5
- const VendorPrefix = suite('VendorPrefixedValue')
6
-
7
- VendorPrefix('finds simple prefixes', () => {
8
- const fixture = `
9
- value-vendor-prefix-simple {
10
- width: -moz-max-content;
11
- width: -webkit-max-content;
12
- box-shadow: 0 0 0 3px -moz-mac-focusring;
13
- position: -webkit-sticky;
14
- }
15
-
16
- false-positive {
17
- background: var(--test);
18
- }
19
- `
20
- const actual = analyze(fixture).values.prefixes
21
- const expected = {
22
- total: 4,
23
- totalUnique: 4,
24
- unique: {
25
- '-moz-max-content': 1,
26
- '-webkit-max-content': 1,
27
- '0 0 0 3px -moz-mac-focusring': 1,
28
- '-webkit-sticky': 1,
29
- },
30
- uniquenessRatio: 1
31
- }
32
-
33
- assert.equal(actual, expected)
34
- })
35
-
36
- VendorPrefix('finds nested prefixes', () => {
37
- const fixture = `
38
- value-vendor-prefix-nested {
39
- background-image: -khtml-linear-gradient(90deg, red, green);
40
- background:
41
- red,
42
- -webkit-linear-gradient(transparent, transparent),
43
- -moz-linear-gradient(transparent, transparent),
44
- -ms-linear-gradient(transparent, transparent),
45
- -o-linear-gradient(transparent, transparent);
46
- grid-template-columns: repeat(3, max(-webkit-max-content, 100vw));
47
- }
48
- `
49
- const actual = analyze(fixture).values.prefixes
50
- const expected = {
51
- total: 3,
52
- totalUnique: 3,
53
- unique: {
54
- '-khtml-linear-gradient(90deg, red, green)': 1,
55
- 'red,\n -webkit-linear-gradient(transparent, transparent),\n -moz-linear-gradient(transparent, transparent),\n -ms-linear-gradient(transparent, transparent),\n -o-linear-gradient(transparent, transparent)': 1,
56
- 'repeat(3, max(-webkit-max-content, 100vw))': 1,
57
- },
58
- uniquenessRatio: 1
59
- }
60
-
61
- assert.equal(actual, expected)
62
- })
63
-
64
- VendorPrefix.run()
@@ -1,54 +0,0 @@
1
- import { suite } from 'uvu'
2
- import * as assert from 'uvu/assert'
3
- import { analyze } from '../index.js'
4
-
5
- const ZIndex = suite('Z-index')
6
-
7
- ZIndex('finds simple values', () => {
8
- const fixture = `
9
- test {
10
- z-index: 1;
11
- z-index: 0;
12
- z-index: -1;
13
- z-index: 99999;
14
- z-index: -100;
15
- z-index: 0;
16
- }
17
- `
18
- const actual = analyze(fixture).values.zindexes
19
- const expected = {
20
- total: 6,
21
- totalUnique: 5,
22
- unique: {
23
- '0': 2,
24
- '1': 1,
25
- '99999': 1,
26
- '-1': 1,
27
- '-100': 1,
28
- },
29
- uniquenessRatio: 5 / 6
30
- }
31
-
32
- assert.equal(actual, expected)
33
- })
34
-
35
- ZIndex('ignores global CSS keywords', () => {
36
- const fixture = `
37
- test {
38
- z-index: auto;
39
- z-index: inherit;
40
- z-index: initial;
41
- }
42
- `
43
- const actual = analyze(fixture).values.zindexes
44
- const expected = {
45
- total: 0,
46
- totalUnique: 0,
47
- unique: {},
48
- uniquenessRatio: 0
49
- }
50
-
51
- assert.equal(actual, expected)
52
- })
53
-
54
- ZIndex.run()
@@ -1,16 +0,0 @@
1
- const HYPHENMINUS = 45; // '-'.charCodeAt()
2
-
3
- function hasVendorPrefix(keyword) {
4
- if (keyword.charCodeAt(0) === HYPHENMINUS && keyword.charCodeAt(1) !== HYPHENMINUS) {
5
- // String must have a 2nd occurrence of '-', at least at position 3 (offset=2)
6
- if (keyword.indexOf('-', 2) !== -1) {
7
- return true
8
- }
9
- }
10
-
11
- return false
12
- }
13
-
14
- export {
15
- hasVendorPrefix
16
- }