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

babel-plugin-eliminator

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-eliminator

Remove specific named exports

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

babel-plugin-eliminator

What is this?

This is a babel plugin for removing specific named exports in your JavaScript code, this is how Next.js implements getServerSideProps and getStaticProps, it essentially removes thoses exports and referenced variables.

Install

npm i babel-plugin-eliminator

Usage

Removing specific named exports

Options:

{
  "plugins": [
    ["eliminator", {"namedExports": ["foo"]}]
  ]
}

Input:

import pkg from 'some-pkg'

const someVariable = 'some-string'

export const foo = () => {
    return pkg(someVariable)
}

Output:

export var foo = 1

Options

type PluginState = {
  refs: Set<NodePath<BabelTypes.Identifier>>
  opts: PluginOpts
  /** Removed named exports */
  removedNamedExports: Set<string>
}

type PluginOpts = {
  /** Removing specific named exports */
  namedExports?: string[]
  /** Called at the end of transpiling */
  done?: (state: PluginState) => void
}

Credits

This plugin is essentially a fork of next.js/next-ssg-transform.

License

MIT © EGOIST

FAQs

Package last updated on 14 Mar 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