Socket
Socket
Sign inDemoInstall

@talend/babel-plugin-import-from-index

Package Overview
Dependencies
0
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.1.2

2

package.json
{
"name": "@talend/babel-plugin-import-from-index",
"version": "0.1.1",
"version": "0.1.2",
"description": "Transform default imports from specific path to named import from index",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -19,3 +19,6 @@ const PACKAGE_NAME = '@talend/react-components';

imports.push(
...importDeclarationPath.node.specifiers.map(({ local }) => local.name),
...importDeclarationPath.node.specifiers.map(({ local, imported }) => ({
local: local.name,
imported: imported ? imported.name : local.name,
})),
);

@@ -31,4 +34,4 @@ importDeclarationPath.remove();

const source = types.stringLiteral(PACKAGE_NAME);
const specifiers = imports.map(name =>
types.importSpecifier(types.identifier(name), types.identifier(name)),
const specifiers = imports.map(({ local, imported }) =>
types.importSpecifier(types.identifier(local), types.identifier(imported)),
);

@@ -35,0 +38,0 @@ const imp = types.importDeclaration(specifiers, source);

@@ -22,3 +22,12 @@ import pluginTester from 'babel-plugin-tester';

},
{
code: `
import React from 'react';
import { SidePanel } from '@talend/react-components';
import { ModelViewer as ModelViewerComponent } from '@talend/react-components';`,
output: `
import React from 'react';
import { SidePanel, ModelViewer as ModelViewerComponent } from '@talend/react-components';`,
},
],
});
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