From 206e4d3a486ea8a3dab627de38630282bf432cbe Mon Sep 17 00:00:00 2001 From: Simon Fisher Date: Wed, 4 Sep 2024 09:01:49 +1200 Subject: [PATCH] Update index.js --- .../ember-css-modules/lib/htmlbars-plugin/index.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/ember-css-modules/lib/htmlbars-plugin/index.js b/packages/ember-css-modules/lib/htmlbars-plugin/index.js index 783ca34..c9d510c 100644 --- a/packages/ember-css-modules/lib/htmlbars-plugin/index.js +++ b/packages/ember-css-modules/lib/htmlbars-plugin/index.js @@ -62,7 +62,7 @@ module.exports = class ClassTransformPlugin { } transformStatement(node) { - if (node.path.original === 'local-class') { + if (!this.isNodePathLiteral(node.path) && node.path.original === 'local-class') { this.transformLocalClassHelperInvocation(node); } else { this.transformPossibleComponentInvocation(node); @@ -70,7 +70,7 @@ module.exports = class ClassTransformPlugin { } transformSubexpression(node) { - if (node.path.original === 'local-class') { + if (!this.isNodePathLiteral(node.path) && node.path.original === 'local-class') { this.transformLocalClassHelperInvocation(node); } } @@ -245,4 +245,14 @@ module.exports = class ClassTransformPlugin { return parts; } + + isNodePathLiteral(path) { + return { + StringLiteral: true, + BooleanLiteral: true, + NumberLiteral: true, + UndefinedLiteral: true, + NullLiteral: true + }[path.type] ?? false; + } };