Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-extract-export

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-extract-export

Extract ESM exports and their dependencies using Babel.

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
410
decreased by-32.34%
Maintainers
1
Weekly downloads
 
Created
Source

babel-plugin-extract-export

This is a fork of the NextJS SSG transform Babel plugin that reverses the logic and allows extracting a specific export and its dependencies.

Install

yarn add babel-plugin-extract-export

Example

const babel = require('@babel/core')
const syntaxTypeScript = require('@babel/plugin-syntax-typescript')
const extractExport = require('babel-plugin-extract-export')

const jsx = `
import { Image } from 'system'

export const Avatar = () => <Image />

type SystemProps = { as: any }

type BoxProps = { children: any } & SystemProps

export const Box = (props: BoxProps) => <div {...props} />
`

const result = babel.transform(jsx, {
  configFile: false,
  plugins: [
    [syntaxTypeScript, { isTSX: true }],
    [extractExport, { exportName: 'Avatar' }],
  ],
})

// Output:
// import { Image } from 'system'
// export const Avatar = () => <Image />

Development

yarn install && yarn test

FAQs

Package last updated on 28 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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