Socket
Socket
Sign inDemoInstall

babel-plugin-emotion-rename

Package Overview
Dependencies
17
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-beta.11 to 1.0.0-beta.12

34

lib/index.js

@@ -63,17 +63,20 @@ "use strict";

var root;
var imported = false;
var emotionStyledImported = false;
var emotionReactImported = false;
var filterTags = [];
var MAP_STYLED_VARS = {};
var cssList = [];
var emotionReactImported = false;
var importDeclaration = buildImport();
var emotionStyledImportDeclaration = buildImport();
var emotionReactImportDeclaration = buildImportEmotionReact();
function insertEmotionReact() {
if (!emotionReactImported) {
root.unshiftContainer("body", emotionReactImportDeclaration);
emotionReactImported = true;
}
root.unshiftContainer("body", emotionReactImportDeclaration);
emotionReactImported = true;
}
function insertEmotionStyled() {
root.unshiftContainer("body", emotionStyledImportDeclaration);
emotionStyledImported = true;
}
return {

@@ -103,4 +106,3 @@ visitor: {

}
});
console.log(">>>123", filterTags, MAP_STYLED_VARS);
}); // console.log(">>>123", filterTags, MAP_STYLED_VARS);

@@ -139,7 +141,5 @@ if (filterTags.length) {

});
console.log("tmplit...", MAP_STYLED_VARS);
}
},
ImportDeclaration: function ImportDeclaration(path, state) {
console.log("imp-declare---", path.node.source.value);
var isReactEmotionImport = path.node.source.value === "react-emotion";

@@ -159,2 +159,7 @@

var styledLocalName = (_styledDefaultNode$lo = styledDefaultNode.local) === null || _styledDefaultNode$lo === void 0 ? void 0 : _styledDefaultNode$lo.name;
/**
* Anticipate custom local import name
* e.g import { css as csx } or import styledz from...
*/
CSS_LOCAL_NAME = cssLocalName || "css";

@@ -183,5 +188,4 @@ STYLED_LOCAL_NAME = styledLocalName || "styled";

if (hasStyled.length && !imported) {
imported = true;
root.unshiftContainer("body", importDeclaration);
if (hasStyled.length) {
insertEmotionStyled();
}

@@ -213,4 +217,2 @@

if (node.callee.name === "require" && node.arguments && node.arguments.length === 1 && t.isStringLiteral(node.arguments[0]) && isModule(node.arguments[0].value, original)) {
console.log("require-declare---");
if (path.scope.bindings.styled && /(react-)?emotion/.test(node.arguments[0].value)) {

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

{
"name": "babel-plugin-emotion-rename",
"version": "1.0.0-beta.11",
"version": "1.0.0-beta.12",
"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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc