babel-plugin-styled-components
Advanced tools
Comparing version 1.7.1 to 1.8.0-0
@@ -24,2 +24,7 @@ "use strict"; | ||
visitor: { | ||
CallExpression(path, state) { | ||
(0, _displayNameAndId.default)(t)(path, state); | ||
(0, _pure.default)(t)(path, state); | ||
}, | ||
TaggedTemplateExpression(path, state) { | ||
@@ -26,0 +31,0 @@ (0, _minify.default)(t)(path, state); |
@@ -38,6 +38,10 @@ "use strict"; | ||
withConfigProps.push(t.objectProperty(t.identifier('componentId'), t.stringLiteral(componentId))); | ||
} // Replace x`...` with x.withConfig({ })`...` | ||
} | ||
path.node.tag = t.callExpression(t.memberExpression(path.node.tag, t.identifier('withConfig')), [t.objectExpression(withConfigProps)]); | ||
if (path.node.tag) { | ||
// Replace x`...` with x.withConfig({ })`...` | ||
path.node.tag = t.callExpression(t.memberExpression(path.node.tag, t.identifier('withConfig')), [t.objectExpression(withConfigProps)]); | ||
} else { | ||
path.replaceWith(t.callExpression(t.callExpression(t.memberExpression(path.node.callee, t.identifier('withConfig')), [t.objectExpression(withConfigProps)]), path.node.arguments)); | ||
} | ||
}; | ||
@@ -132,3 +136,3 @@ }; | ||
return function (path, state) { | ||
if ((0, _detectors.isStyled)(t)(path.node.tag, state)) { | ||
if (path.node.tag ? (0, _detectors.isStyled)(t)(path.node.tag, state) : (0, _detectors.isStyled)(t)(path.node.callee, state) && path.node.callee.property && path.node.callee.property.name !== 'withConfig' && t.isObjectExpression(path.node.arguments[0])) { | ||
var displayName = (0, _options.useDisplayName)(state) && getDisplayName(t)(path, (0, _options.useFileName)(state) && state); | ||
@@ -135,0 +139,0 @@ addConfig(t)(path, displayName && displayName.replace(/[^_a-zA-Z0-9-]/g, ''), (0, _options.useSSR)(state) && getComponentId(state)); |
@@ -19,4 +19,4 @@ "use strict"; | ||
if ((0, _options.usePureAnnotation)(state)) { | ||
if ((0, _detectors.isStyled)(path.node, state) || (0, _detectors.isStyled)(path.node.callee, state) || (0, _detectors.isPureHelper)(path.node.callee, state)) { | ||
if (path.parent.type == 'VariableDeclarator' || path.parent.type == 'TaggedTemplateExpression') { | ||
if ((0, _detectors.isStyled)(t)(path.node, state) || (0, _detectors.isStyled)(t)(path.node.callee, state) || (0, _detectors.isPureHelper)(t)(path.node.tag || path.node.callee, state)) { | ||
if (path.parent.type === 'VariableDeclarator' || path.parent.type === 'TaggedTemplateExpression') { | ||
(0, _helperAnnotateAsPure.default)(path); | ||
@@ -23,0 +23,0 @@ } |
{ | ||
"version": "1.7.1", | ||
"version": "1.8.0-0", | ||
"name": "babel-plugin-styled-components", | ||
@@ -4,0 +4,0 @@ "description": "Improve the debugging experience and add server-side rendering support to styled-components", |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
31117
606
2