babel-plugin-export-toplevel

1.0.0 • Public • Published

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"]
}

/babel-plugin-export-toplevel/

    Package Sidebar

    Install

    npm i babel-plugin-export-toplevel

    Weekly Downloads

    2,958

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    113 kB

    Total Files

    5

    Last publish

    Collaborators

    • maienm