babel-plugin-react-cssmoduleify
Advanced tools
Comparing version 1.0.0-beta.7 to 1.0.0-beta.8
@@ -84,2 +84,6 @@ "use strict"; | ||
var maybeCSSModuleExpression = function maybeCSSModuleExpression(node, cssmodule) { | ||
return t.logicalExpression("||", t.memberExpression(cssmodule, node, true), node); | ||
}; | ||
var computeClassName = function computeClassName(value, cssmodule) { | ||
@@ -153,3 +157,3 @@ if (t.isStringLiteral(value)) { | ||
if (t.isIdentifier(arrayExpressionPath)) { | ||
arrayExpressionPath.parent.object = t.callExpression(t.memberExpression(arrayExpressionPath.node, t.identifier("map"), false), [t.arrowFunctionExpression([t.identifier("i")], t.memberExpression(cssmodule, t.identifier("i"), true))]); | ||
arrayExpressionPath.parent.object = t.callExpression(t.memberExpression(arrayExpressionPath.node, t.identifier("map"), false), [t.arrowFunctionExpression([t.identifier("i")], maybeCSSModuleExpression(t.identifier("i"), cssmodule))]); | ||
return; | ||
@@ -222,3 +226,3 @@ } | ||
// this is just mean | ||
callExpression.replaceWith(t.callExpression(t.memberExpression(t.callExpression(t.memberExpression(t.callExpression(t.memberExpression(callExpression.node, t.identifier("split"), false), [t.stringLiteral(" ")]), t.identifier("map")), [t.arrowFunctionExpression([t.identifier("i")], t.memberExpression(cssmodule, t.identifier("i"), true))]), t.identifier("join"), false), [t.stringLiteral(" ")])); | ||
callExpression.replaceWith(t.callExpression(t.memberExpression(t.callExpression(t.memberExpression(t.callExpression(t.memberExpression(callExpression.node, t.identifier("split"), false), [t.stringLiteral(" ")]), t.identifier("map")), [t.arrowFunctionExpression([t.identifier("i")], maybeCSSModuleExpression(t.identifier("i"), cssmodule))]), t.identifier("join"), false), [t.stringLiteral(" ")])); | ||
}; | ||
@@ -225,0 +229,0 @@ |
{ | ||
"name": "babel-plugin-react-cssmoduleify", | ||
"version": "1.0.0-beta.7", | ||
"version": "1.0.0-beta.8", | ||
"description": "Babel plugin to transform traditional classNames to CSS Modules", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -86,2 +86,9 @@ /* eslint no-extra-parens: 0 */ | ||
const maybeCSSModuleExpression = (node, cssmodule) => | ||
t.logicalExpression( | ||
"||", | ||
t.memberExpression(cssmodule, node, true), | ||
node | ||
); | ||
const computeClassName = (value, cssmodule) => { | ||
@@ -173,3 +180,3 @@ if (t.isStringLiteral(value)) { | ||
[t.identifier("i")], | ||
t.memberExpression(cssmodule, t.identifier("i"), true) | ||
maybeCSSModuleExpression(t.identifier("i"), cssmodule) | ||
)] | ||
@@ -256,3 +263,3 @@ ); | ||
[t.identifier("i")], | ||
t.memberExpression(cssmodule, t.identifier("i"), true) | ||
maybeCSSModuleExpression(t.identifier("i"), cssmodule) | ||
)] | ||
@@ -259,0 +266,0 @@ ), |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33499
714