Socket
Socket
Sign inDemoInstall

babel-plugin-emotion-rename

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-emotion-rename - npm Package Compare versions

Comparing version 1.0.0-beta.14 to 1.0.0-beta.15

32

lib/index.js

@@ -172,5 +172,7 @@ "use strict";

ImportDeclaration: function ImportDeclaration(path, state) {
var isReactEmotionImport = path.node.source.value === "react-emotion";
var importPackageName = path.node.source.value;
if (isReactEmotionImport) {
if (importPackageName === "emotion") {
path.node.source = t.stringLiteral("@emotion/css");
} else if (importPackageName === "react-emotion") {
var _path$node$specifiers, _path$node$specifiers2, _styledDefaultNode$lo;

@@ -199,3 +201,3 @@

if (nonStyled.length && isReactEmotionImport) {
if (nonStyled.length) {
path.node.specifiers = path.node.specifiers.filter(function (s) {

@@ -220,12 +222,4 @@ return s.type !== "ImportDefaultSpecifier";

REP.forEach(function (_ref2) {
var original = _ref2.original,
replacement = _ref2.replacement;
var value = path.node.source.value;
if (isModule(value, original)) {
path.node.source = source(value, original, replacement);
}
});
} else if (path.node.source.value === "@emotion/styled") {
path.node.source = t.stringLiteral("@emotion/css");
} else if (importPackageName === "@emotion/styled") {
var _styledDefaultNode = path.node.specifiers.find(function (s) {

@@ -239,8 +233,14 @@ return s.type === "ImportDefaultSpecifier";

CallExpression: function CallExpression(path, state) {
REP.forEach(function (_ref3) {
var original = _ref3.original,
replacement = _ref3.replacement;
REP.forEach(function (_ref2) {
var original = _ref2.original,
replacement = _ref2.replacement;
var node = path.node;
if (node.callee.name === "require" && node.arguments && node.arguments.length === 1 && t.isStringLiteral(node.arguments[0]) && isModule(node.arguments[0].value, original)) {
/**
* @TODO
* handle commonjs require('emotion')...
*/
console.log("call-exp");
if (path.scope.bindings.styled && /(react-)?emotion/.test(node.arguments[0].value)) {

@@ -247,0 +247,0 @@ path.node.arguments = [t.stringLiteral("@emotion/styled")];

{
"name": "babel-plugin-emotion-rename",
"version": "1.0.0-beta.14",
"version": "1.0.0-beta.15",
"description": "Babel plugin to rename old Emotion 9 import to new Emotion 10+ import",

@@ -5,0 +5,0 @@ "main": "lib/index",

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