https://github.com/infctr/babel-plugin-codemod-named-export-declarations
Transform export object literals to single named export declarations
https://github.com/infctr/babel-plugin-codemod-named-export-declarations
Last synced: 11 months ago
JSON representation
Transform export object literals to single named export declarations
- Host: GitHub
- URL: https://github.com/infctr/babel-plugin-codemod-named-export-declarations
- Owner: infctr
- Created: 2018-08-03T13:03:41.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T13:21:13.000Z (over 3 years ago)
- Last Synced: 2025-06-16T02:17:57.589Z (12 months ago)
- Language: JavaScript
- Homepage:
- Size: 580 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# babel-plugin-codemod-named-export-declarations
This plugin replaces `export` object literal declaration with corresponding named export declarations with Typescript support.
## Example
**In**
```javascript
type IFoo = string;
const foo: IFoo = 'foo';
export { foo, IFoo };
```
**Out**
```javascript
export type IFoo = string;
export const foo: IFoo = 'foo';
```
## Installation
```sh
yarn add -D babel-plugin-codemod-named-export-declarations
```
## Usage
### Via CLI (recommended)
Run transforms on your files with excellent [babel-codemod](https://github.com/square/babel-codemod)! Considered it's installed locally:
```sh
./node_modules/.bin/codemod -p babel-plugin-codemod-named-export-declarations script.js
```
`babel-codemod` enables other plugins for parsing files out of the box (eg. jsx, typescript).
### Via Node API
```javascript
require('babel-core').transform('code', {
plugins: ['codemod-named-export-declarations']
});
```