Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## Unreleased

## 2.1.1 (April 4, 2019)
### Fixed
- Remove usage of .original in Ember 5.9+ to fix deprecation warnings.

## 2.1.0 (April 2, 2024)

### Added
Expand Down
18 changes: 16 additions & 2 deletions packages/ember-css-modules/lib/htmlbars-plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ module.exports = class ClassTransformPlugin {
}

transformStatement(node) {
if (node.path.original === 'local-class') {
if (getValue(node.path) === 'local-class') {
this.transformLocalClassHelperInvocation(node);
} else {
this.transformPossibleComponentInvocation(node);
}
}

transformSubexpression(node) {
if (node.path.original === 'local-class') {
if (getValue(node.path) === 'local-class') {
this.transformLocalClassHelperInvocation(node);
}
}
Expand Down Expand Up @@ -246,3 +246,17 @@ module.exports = class ClassTransformPlugin {
return parts;
}
};

function getValue(path) {
if (!path) return;

if ('value' in path) {
return path.value;
}

/**
* Deprecated in ember 5.9+
* (so we use the above for newer embers)
*/
return path.original;
}
30 changes: 29 additions & 1 deletion packages/ember-css-modules/lib/htmlbars-plugin/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function updateStringValue(node, updater) {
node.chars = updater(node.chars);
} else if (node.type === 'StringLiteral') {
node.value = updater(node.value);
node.original = updater(node.original);
setValue(node, updater(getValue(node)));
} else {
throw new Error('Unknown node type ' + node.type + ' (not a string?)');
}
Expand Down Expand Up @@ -76,6 +76,34 @@ function pushAll(target, arr) {
return target;
}

function getValue(path) {
if (!path) return;

if ('value' in path) {
return path.value;
}

/**
* Deprecated in ember 5.9+
* (so we use the above for newer embers)
*/
return path.original;
}

function setValue(node, value) {
if (!node) return;

if ('value' in node) {
node.value = value;
} else {
/**
* Deprecated in ember 5.9+
* (so we use the above for newer embers)
*/
path.original = value;
}
}

module.exports = {
pushAll: pushAll,
getPair: getPair,
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-css-modules/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ember-css-modules",
"version": "2.1.0",
"version": "2.1.1",
"description": "CSS Modules for ambitious applications",
"scripts": {
"build": "ember build --environment=production",
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5873,7 +5873,7 @@ ember-compatibility-helpers@^1.1.2, ember-compatibility-helpers@^1.2.0, ember-co
semver "^5.4.1"

"ember-css-modules@link:packages/ember-css-modules":
version "2.0.1"
version "2.1.1"
dependencies:
broccoli-bridge "^1.0.0"
broccoli-concat "^4.2.5"
Expand Down