Skip to content

Commit d0b8742

Browse files
authored
Merge pull request #323 from RobbieTheWagner/master
Fix .original deprecation
2 parents 52b11e4 + f4f5fb2 commit d0b8742

File tree

5 files changed

+27
-5
lines changed

5 files changed

+27
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
66

77
## Unreleased
88

9+
## 2.1.1 (April 4, 2019)
10+
### Fixed
11+
- Remove usage of .original in Ember 5.9+ to fix deprecation warnings.
12+
913
## 2.1.0 (April 2, 2024)
1014

1115
### Added

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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ 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+
// 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+
}
2529
} else {
2630
throw new Error('Unknown node type ' + node.type + ' (not a string?)');
2731
}

packages/ember-css-modules/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ember-css-modules",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "CSS Modules for ambitious applications",
55
"scripts": {
66
"build": "ember build --environment=production",

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5873,7 +5873,7 @@ ember-compatibility-helpers@^1.1.2, ember-compatibility-helpers@^1.2.0, ember-co
58735873
semver "^5.4.1"
58745874

58755875
"ember-css-modules@link:packages/ember-css-modules":
5876-
version "2.0.1"
5876+
version "2.1.1"
58775877
dependencies:
58785878
broccoli-bridge "^1.0.0"
58795879
broccoli-concat "^4.2.5"

0 commit comments

Comments
 (0)