babel-plugin-cerebral
Advanced tools
Comparing version 1.0.0-1525724201307 to 1.0.0-1526222433248
@@ -17,3 +17,3 @@ 'use strict'; | ||
if (!binding) return null; | ||
if (t.isVariableDeclarator(binding.path.node)) { | ||
if (t.isVariableDeclarator(binding.path.node) && binding.path.node.init) { | ||
return getUsedVariable(binding.path.scope, binding.path.node.init.name, importedVariable); | ||
@@ -159,17 +159,8 @@ } | ||
if (tagName === 'statePath' || tagName === 'computedPath') { | ||
// Rewrite to a templateLiteral like | ||
// `foo.bar` | ||
rootMemberExpression.replaceWith(t.templateLiteral(quasis.map(function (v) { | ||
var str = v.join(''); | ||
return t.templateElement({ raw: str, cooked: str }); | ||
}), expressions)); | ||
} else { | ||
// Rewrite with a tagged template like | ||
// state`foo.bar` | ||
rootMemberExpression.replaceWith(t.taggedTemplateExpression(t.identifier(tagName), t.templateLiteral(quasis.map(function (v) { | ||
var str = v.join(''); | ||
return t.templateElement({ raw: str, cooked: str }); | ||
}), expressions))); | ||
} | ||
// Rewrite with a tagged template like | ||
// state`foo.bar` | ||
rootMemberExpression.replaceWith(t.taggedTemplateExpression(t.identifier(tagName), t.templateLiteral(quasis.map(function (v) { | ||
var str = v.join(''); | ||
return t.templateElement({ raw: str, cooked: str }); | ||
}), expressions))); | ||
} | ||
@@ -181,3 +172,3 @@ } | ||
var allowedImportPath = ['cerebral/proxy']; | ||
var allowedImportVariables = ['state', 'props', 'signal', 'statePath', 'computedPath', 'computed']; | ||
var allowedImportVariables = ['props', 'state', 'signals', 'computed', 'moduleState', 'moduleComputed', 'moduleSignals']; | ||
@@ -184,0 +175,0 @@ function isDirectImport(location) { |
{ | ||
"name": "babel-plugin-cerebral", | ||
"version": "1.0.0-1525724201307", | ||
"version": "1.0.0-1526222433248", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
7627
153