Socket
Socket
Sign inDemoInstall

babel-plugin-grommet

Package Overview
Dependencies
9
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.0 to 0.5.0

13

index.js

@@ -7,7 +7,12 @@ const types = require('babel-types');

visitor: {
ImportDeclaration: (path) => {
ImportDeclaration: (path, { opts: { dependencies = ['grommet', 'grommet-icons'] } }) => {
const source = path.node.source.value;
const dependency = source.split('/')[0];
if (source.startsWith('grommet')) {
const context = /(grommet-icons|grommet)(\/(components|themes|utils))?/.exec(source)[0];
const dependencyPathRegexp = new RegExp(
`(${dependencies.join('|')})(\/(components|themes|utils))?$`
);
const matches = dependencyPathRegexp.exec(source);
if (matches) {
const context = matches[0];
const modulesInContext = find.fileSync(

@@ -19,3 +24,3 @@ /\.js$/, `./node_modules/${context}`

// remove grommet-icons inside grommet node_modules
file => file.indexOf('grommet/grommet-icons') === -1
file => file.indexOf(`${dependency}/grommet-icons`) === -1
).reverse(); // reverse so es6 modules have higher priority

@@ -22,0 +27,0 @@ const memberImports = path.node.specifiers.filter(

{
"version": "0.4.0",
"version": "0.5.0",
"name": "babel-plugin-grommet",

@@ -4,0 +4,0 @@ "description": "Babel plugin to transform member style imports into default imports",

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