ember-css-modules 2.0.1 → 2.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.
|
@@ -62,7 +62,7 @@ module.exports = class ClassTransformPlugin {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
transformStatement(node) {
|
|
65
|
-
if (node.path
|
|
65
|
+
if (getValue(node.path) === 'local-class') {
|
|
66
66
|
this.transformLocalClassHelperInvocation(node);
|
|
67
67
|
} else {
|
|
68
68
|
this.transformPossibleComponentInvocation(node);
|
|
@@ -70,7 +70,7 @@ module.exports = class ClassTransformPlugin {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
transformSubexpression(node) {
|
|
73
|
-
if (node.path
|
|
73
|
+
if (getValue(node.path) === 'local-class') {
|
|
74
74
|
this.transformLocalClassHelperInvocation(node);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -246,3 +246,17 @@ module.exports = class ClassTransformPlugin {
|
|
|
246
246
|
return parts;
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
|
+
|
|
250
|
+
function getValue(path) {
|
|
251
|
+
if (!path) return;
|
|
252
|
+
|
|
253
|
+
if ('value' in path) {
|
|
254
|
+
return path.value;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Deprecated in ember 5.9+
|
|
259
|
+
* (so we use the above for newer embers)
|
|
260
|
+
*/
|
|
261
|
+
return path.original;
|
|
262
|
+
}
|
|
@@ -21,7 +21,11 @@ function updateStringValue(node, updater) {
|
|
|
21
21
|
node.chars = updater(node.chars);
|
|
22
22
|
} else if (node.type === 'StringLiteral') {
|
|
23
23
|
node.value = updater(node.value);
|
|
24
|
-
|
|
24
|
+
// Avoid `original` deprecation in Ember 5.9+
|
|
25
|
+
let originalDesc = Object.getOwnPropertyDescriptor(node, 'original');
|
|
26
|
+
if (originalDesc && originalDesc.value) {
|
|
27
|
+
node.original = updater(node.original);
|
|
28
|
+
}
|
|
25
29
|
} else {
|
|
26
30
|
throw new Error('Unknown node type ' + node.type + ' (not a string?)');
|
|
27
31
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HelperLike } from '@glint/template';
|
|
2
|
+
|
|
3
|
+
interface Signature {
|
|
4
|
+
Args: {
|
|
5
|
+
Positional: [string];
|
|
6
|
+
Named: {
|
|
7
|
+
from?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
Return: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default interface EmberCssModulesRegistry {
|
|
14
|
+
'local-class': HelperLike<Signature>;
|
|
15
|
+
}
|