Socket
Socket
Sign inDemoInstall

babel-plugin-grommet

Package Overview
Dependencies
9
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.0 to 0.5.1

13

index.js
const types = require('babel-types');
const find = require('find');
const pathUtils = require('path');

@@ -12,3 +13,3 @@ module.exports = () => (

const dependencyPathRegexp = new RegExp(
`(${dependencies.join('|')})(\/(components|themes|utils))?$`
`(${dependencies.join('|')})(\\${pathUtils.sep}(components|themes|utils))?$`
);

@@ -19,8 +20,8 @@ const matches = dependencyPathRegexp.exec(source);

const modulesInContext = find.fileSync(
/\.js$/, `./node_modules/${context}`
/\.js$/, pathUtils.join('.', 'node_modules', context)
).map(
file => file.replace(/node_modules\/|\.js/g, '')
file => file.replace(new RegExp(`node_modules\\${pathUtils.sep}|\.js`, 'g'), '')
).filter(
// remove grommet-icons inside grommet node_modules
file => file.indexOf(`${dependency}/grommet-icons`) === -1
file => file.indexOf(pathUtils.join(dependency, 'grommet-icons')) === -1
).reverse(); // reverse so es6 modules have higher priority

@@ -37,3 +38,3 @@ const memberImports = path.node.specifiers.filter(

// if webpack alias is enabled the es6 path does not exist.
if (module.endsWith(`/${componentName}`)) {
if (module.endsWith(`${pathUtils.sep}${componentName}`)) {
if (process.env.NODE_ENV === 'development') {

@@ -43,3 +44,3 @@ // in development webpack alias may be enabled

// we need to remove it and use commonjs structure.
newPath = module.replace('es6/', '');
newPath = module.replace(`es6${pathUtils.sep}`, '');
} else {

@@ -46,0 +47,0 @@ newPath = module;

{
"version": "0.5.0",
"version": "0.5.1",
"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