1.0.0 • Published 6 years ago

babel-plugin-export-toplevel v1.0.0

Weekly downloads
1,488
License
MIT
Repository
github
Last release
6 years ago

babel-plugin-export-toplevel

A simple transform to automatically export all top-level names.

This is mostly useful for testing purposes, so you can have access to these names in testing while not exporting them in other environments.

Effect

Transforms

const hiddenFunction = () => {};
const publicFunction = () => {};

export default publicFunction;

to something akin to

const hiddenFunction = () => {};
const publicFunction = () => {};

export default publicFunction;
export { publicFunction, hiddenFunction };

Install

npm i --save-dev babel-plugin-export-toplevel

Usage

.babelrc

{
  "plugins": ["export-toplevel"]
}