happy-css-modules 3.0.1 → 3.1.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.
Files changed (37) hide show
  1. package/dist/emitter/dts.js +34 -17
  2. package/dist/emitter/dts.js.map +1 -1
  3. package/dist/emitter/dts.test.js +3 -3
  4. package/dist/emitter/dts.test.js.map +1 -1
  5. package/dist/emitter/index.test.js +3 -3
  6. package/dist/emitter/index.test.js.map +1 -1
  7. package/dist/locator/index.d.ts +4 -2
  8. package/dist/locator/index.js +41 -15
  9. package/dist/locator/index.js.map +1 -1
  10. package/dist/locator/index.test.js +142 -48
  11. package/dist/locator/index.test.js.map +1 -1
  12. package/dist/locator/postcss.d.ts +41 -3
  13. package/dist/locator/postcss.js +104 -32
  14. package/dist/locator/postcss.js.map +1 -1
  15. package/dist/locator/postcss.test.js +86 -26
  16. package/dist/locator/postcss.test.js.map +1 -1
  17. package/dist/test-util/util.d.ts +3 -2
  18. package/dist/test-util/util.js +22 -18
  19. package/dist/test-util/util.js.map +1 -1
  20. package/dist/transformer/less-transformer.test.js +25 -15
  21. package/dist/transformer/less-transformer.test.js.map +1 -1
  22. package/dist/transformer/postcss-transformer.test.js +5 -3
  23. package/dist/transformer/postcss-transformer.test.js.map +1 -1
  24. package/dist/transformer/scss-transformer.test.js +38 -19
  25. package/dist/transformer/scss-transformer.test.js.map +1 -1
  26. package/package.json +1 -1
  27. package/src/emitter/dts.test.ts +3 -3
  28. package/src/emitter/dts.ts +59 -37
  29. package/src/emitter/index.test.ts +3 -3
  30. package/src/locator/index.test.ts +143 -48
  31. package/src/locator/index.ts +51 -23
  32. package/src/locator/postcss.test.ts +135 -26
  33. package/src/locator/postcss.ts +120 -36
  34. package/src/test-util/util.ts +23 -18
  35. package/src/transformer/less-transformer.test.ts +25 -15
  36. package/src/transformer/postcss-transformer.test.ts +5 -3
  37. package/src/transformer/scss-transformer.test.ts +38 -19
@@ -42,33 +42,43 @@ test('handles less features', async () => {
42
42
  tokens: [
43
43
  {
44
44
  name: "b_1",
45
- originalLocations: [
46
- { filePath: "<fixtures>/test/2.less", start: { line: 1, column: 1 }, end: { line: 1, column: 4 } },
47
- ],
45
+ originalLocation: {
46
+ filePath: "<fixtures>/test/2.less",
47
+ start: { line: 1, column: 1 },
48
+ end: { line: 1, column: 4 },
49
+ },
48
50
  },
49
51
  {
50
52
  name: "a_1",
51
- originalLocations: [
52
- { filePath: "<fixtures>/test/1.less", start: { line: 2, column: 1 }, end: { line: 2, column: 4 } },
53
- ],
53
+ originalLocation: {
54
+ filePath: "<fixtures>/test/1.less",
55
+ start: { line: 2, column: 1 },
56
+ end: { line: 2, column: 4 },
57
+ },
54
58
  },
55
59
  {
56
60
  name: "a_2",
57
- originalLocations: [
58
- { filePath: "<fixtures>/test/1.less", start: { line: 3, column: 1 }, end: { line: 3, column: 4 } },
59
- ],
61
+ originalLocation: {
62
+ filePath: "<fixtures>/test/1.less",
63
+ start: { line: 3, column: 1 },
64
+ end: { line: 3, column: 4 },
65
+ },
60
66
  },
61
67
  {
62
68
  name: "a_2_1",
63
- originalLocations: [
64
- { filePath: "<fixtures>/test/1.less", start: { line: 6, column: 3 }, end: { line: 6, column: 8 } },
65
- ],
69
+ originalLocation: {
70
+ filePath: "<fixtures>/test/1.less",
71
+ start: { line: 6, column: 3 },
72
+ end: { line: 6, column: 8 },
73
+ },
66
74
  },
67
75
  {
68
76
  name: "a_2_2",
69
- originalLocations: [
70
- { filePath: "<fixtures>/test/1.less", start: { line: 7, column: 3 }, end: { line: 7, column: 8 } },
71
- ],
77
+ originalLocation: {
78
+ filePath: "<fixtures>/test/1.less",
79
+ start: { line: 7, column: 3 },
80
+ end: { line: 7, column: 8 },
81
+ },
72
82
  },
73
83
  ],
74
84
  }
@@ -41,9 +41,11 @@ test('handles postcss features', async () => {
41
41
  tokens: [
42
42
  {
43
43
  name: "foo_bar",
44
- originalLocations: [
45
- { filePath: "<fixtures>/test/1.css", start: { line: 2, column: 1 }, end: { line: 2, column: 8 } },
46
- ],
44
+ originalLocation: {
45
+ filePath: "<fixtures>/test/1.css",
46
+ start: { line: 2, column: 1 },
47
+ end: { line: 2, column: 8 },
48
+ },
47
49
  },
48
50
  ],
49
51
  }
@@ -48,40 +48,59 @@ test('handles sass features', async () => {
48
48
  tokens: [
49
49
  {
50
50
  name: "b_1",
51
- originalLocations: [
52
- { filePath: "<fixtures>/test/2.scss", start: { line: 1, column: 1 }, end: { line: 1, column: 4 } },
53
- ],
51
+ originalLocation: {
52
+ filePath: "<fixtures>/test/2.scss",
53
+ start: { line: 1, column: 1 },
54
+ end: { line: 1, column: 4 },
55
+ },
54
56
  },
55
57
  {
56
58
  name: "c",
57
- originalLocations: [
58
- { filePath: "<fixtures>/test/3.scss", start: { line: 1, column: 1 }, end: { line: 1, column: 2 } },
59
- ],
59
+ originalLocation: {
60
+ filePath: "<fixtures>/test/3.scss",
61
+ start: { line: 1, column: 1 },
62
+ end: { line: 1, column: 2 },
63
+ },
60
64
  },
61
65
  {
62
66
  name: "a_1",
63
- originalLocations: [
64
- { filePath: "<fixtures>/test/1.scss", start: { line: 3, column: 1 }, end: { line: 3, column: 4 } },
65
- ],
67
+ originalLocation: {
68
+ filePath: "<fixtures>/test/1.scss",
69
+ start: { line: 3, column: 1 },
70
+ end: { line: 3, column: 4 },
71
+ },
66
72
  },
67
73
  {
68
74
  name: "a_2",
69
- originalLocations: [
70
- { filePath: "<fixtures>/test/1.scss", start: { line: 4, column: 1 }, end: { line: 4, column: 4 } },
71
- { filePath: "<fixtures>/test/1.scss", start: { line: 7, column: 3 }, end: { line: 7, column: 6 } },
72
- ],
75
+ originalLocation: {
76
+ filePath: "<fixtures>/test/1.scss",
77
+ start: { line: 4, column: 1 },
78
+ end: { line: 4, column: 4 },
79
+ },
80
+ },
81
+ {
82
+ name: "a_2",
83
+ originalLocation: {
84
+ filePath: "<fixtures>/test/1.scss",
85
+ start: { line: 7, column: 3 },
86
+ end: { line: 7, column: 6 },
87
+ },
73
88
  },
74
89
  {
75
90
  name: "a_2_1",
76
- originalLocations: [
77
- { filePath: "<fixtures>/test/1.scss", start: { line: 7, column: 3 }, end: { line: 7, column: 8 } },
78
- ],
91
+ originalLocation: {
92
+ filePath: "<fixtures>/test/1.scss",
93
+ start: { line: 7, column: 3 },
94
+ end: { line: 7, column: 8 },
95
+ },
79
96
  },
80
97
  {
81
98
  name: "a_2_2",
82
- originalLocations: [
83
- { filePath: "<fixtures>/test/1.scss", start: { line: 8, column: 3 }, end: { line: 8, column: 8 } },
84
- ],
99
+ originalLocation: {
100
+ filePath: "<fixtures>/test/1.scss",
101
+ start: { line: 8, column: 3 },
102
+ end: { line: 8, column: 8 },
103
+ },
85
104
  },
86
105
  ],
87
106
  }