Skip to content

Commit 298cc81

Browse files
Fix .original deprecation
1 parent 52b11e4 commit 298cc81

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

packages/ember-css-modules/lib/htmlbars-plugin/index.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ module.exports = class ClassTransformPlugin {
6262
}
6363

6464
transformStatement(node) {
65-
if (node.path.original === 'local-class') {
65+
if (getValue(node.path) === 'local-class') {
6666
this.transformLocalClassHelperInvocation(node);
6767
} else {
6868
this.transformPossibleComponentInvocation(node);
6969
}
7070
}
7171

7272
transformSubexpression(node) {
73-
if (node.path.original === 'local-class') {
73+
if (getValue(node.path) === 'local-class') {
7474
this.transformLocalClassHelperInvocation(node);
7575
}
7676
}
@@ -246,3 +246,17 @@ module.exports = class ClassTransformPlugin {
246246
return parts;
247247
}
248248
};
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+
}

packages/ember-css-modules/lib/htmlbars-plugin/utils.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function updateStringValue(node, updater) {
2121
node.chars = updater(node.chars);
2222
} else if (node.type === 'StringLiteral') {
2323
node.value = updater(node.value);
24-
node.original = updater(node.original);
24+
getValue(node) = updater(getValue(node));
2525
} else {
2626
throw new Error('Unknown node type ' + node.type + ' (not a string?)');
2727
}
@@ -76,6 +76,20 @@ function pushAll(target, arr) {
7676
return target;
7777
}
7878

79+
function getValue(path) {
80+
if (!path) return;
81+
82+
if ('value' in path) {
83+
return path.value;
84+
}
85+
86+
/**
87+
* Deprecated in ember 5.9+
88+
* (so we use the above for newer embers)
89+
*/
90+
return path.original;
91+
}
92+
7993
module.exports = {
8094
pushAll: pushAll,
8195
getPair: getPair,

0 commit comments

Comments
 (0)