babel-plugin-emotion
Advanced tools
Comparing version 10.0.8 to 10.0.9
@@ -192,2 +192,3 @@ 'use strict'; | ||
} | ||
var pascalCaseRegex = /^[A-Z][A-Za-z]+/; | ||
@@ -197,5 +198,41 @@ function getDeclaratorName(path, t) { | ||
var parent = path.findParent(function (p) { | ||
return p.isVariableDeclarator() || p.isFunctionDeclaration() || p.isFunctionExpression() || p.isArrowFunctionExpression(); | ||
}); | ||
if (!parent) { | ||
return ''; | ||
} | ||
if (parent.isVariableDeclarator()) { | ||
// we probably have a css call assigned to a variable | ||
// so we'll just return the variable name | ||
return parent.node.id.name; | ||
} // we probably have an inline css prop usage | ||
if (parent.isFunctionDeclaration()) { | ||
var _name = parent.node.id.name; | ||
if (pascalCaseRegex.test(_name)) { | ||
return _name; | ||
} | ||
return ''; | ||
} | ||
var variableDeclarator = path.findParent(function (p) { | ||
return p.isVariableDeclarator(); | ||
}); | ||
return parent && t.isIdentifier(parent.node.id) ? parent.node.id.name : ''; | ||
if (!variableDeclarator) { | ||
return ''; | ||
} | ||
var name = variableDeclarator.node.id.name; | ||
if (pascalCaseRegex.test(name)) { | ||
return name; | ||
} | ||
return ''; | ||
} | ||
@@ -202,0 +239,0 @@ |
@@ -156,7 +156,24 @@ "use strict"; | ||
} | ||
var pascalCaseRegex = /^[A-Z][A-Za-z]+/; | ||
function getDeclaratorName(path, t) { | ||
var parent = path.findParent(function(p) { | ||
return ( | ||
p.isVariableDeclarator() || | ||
p.isFunctionDeclaration() || | ||
p.isFunctionExpression() || | ||
p.isArrowFunctionExpression() | ||
); | ||
}); | ||
if (!parent) return ""; | ||
if (parent.isVariableDeclarator()) return parent.node.id.name; | ||
if (parent.isFunctionDeclaration()) { | ||
var _name = parent.node.id.name; | ||
return pascalCaseRegex.test(_name) ? _name : ""; | ||
} | ||
var variableDeclarator = path.findParent(function(p) { | ||
return p.isVariableDeclarator(); | ||
}); | ||
return parent && t.isIdentifier(parent.node.id) ? parent.node.id.name : ""; | ||
if (!variableDeclarator) return ""; | ||
var name = variableDeclarator.node.id.name; | ||
return pascalCaseRegex.test(name) ? name : ""; | ||
} | ||
@@ -163,0 +180,0 @@ function getIdentifierName(path, t) { |
{ | ||
"name": "babel-plugin-emotion", | ||
"version": "10.0.8", | ||
"version": "10.0.9", | ||
"description": "A recommended babel preprocessing plugin for emotion, The Next Generation of CSS-in-JS.", | ||
@@ -15,3 +15,3 @@ "main": "dist/babel-plugin-emotion.cjs.js", | ||
"@emotion/memoize": "0.7.1", | ||
"@emotion/serialize": "^0.11.5", | ||
"@emotion/serialize": "^0.11.6", | ||
"babel-plugin-macros": "^2.0.0", | ||
@@ -18,0 +18,0 @@ "babel-plugin-syntax-jsx": "^6.18.0", |
@@ -187,3 +187,2 @@ // @flow | ||
let expressionPath = path.get('value.expression') | ||
let sourceMap = | ||
@@ -190,0 +189,0 @@ state.emotionSourceMap && path.node.loc !== undefined |
102217
2666
- Removed@babel/code-frame@7.24.6(transitive)
- Removed@babel/helper-module-imports@7.24.6(transitive)
- Removed@babel/helper-string-parser@7.24.6(transitive)
- Removed@babel/helper-validator-identifier@7.24.6(transitive)
- Removed@babel/highlight@7.24.6(transitive)
- Removed@babel/runtime@7.24.6(transitive)
- Removed@babel/types@7.24.6(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedpicocolors@1.0.1(transitive)
- Removedregenerator-runtime@0.14.1(transitive)
- Removedsupports-color@5.5.0(transitive)
- Removedto-fast-properties@2.0.0(transitive)
Updated@emotion/serialize@^0.11.6