Socket
Socket
Sign inDemoInstall

babel-plugin-eliminator

Package Overview
Dependencies
53
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-plugin-eliminator

Remove specific named exports


Version published
Weekly downloads
202
decreased by-71.51%
Maintainers
1
Install size
10.2 MB
Created
Weekly downloads
 

Readme

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

Last updated on 14 Mar 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc