Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-cerebral

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-cerebral - npm Package Compare versions

Comparing version 1.0.0-1525724201307 to 1.0.0-1526222433248

25

lib/index.js

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc