Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/babel-utils/babel-helper-simplify-module
Transform module using babel-explode-module to have a simpler structure
https://github.com/babel-utils/babel-helper-simplify-module
babel babel-util modules
Last synced: about 14 hours ago
JSON representation
Transform module using babel-explode-module to have a simpler structure
- Host: GitHub
- URL: https://github.com/babel-utils/babel-helper-simplify-module
- Owner: babel-utils
- License: mit
- Created: 2017-05-25T17:25:17.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-17T02:44:01.000Z (over 6 years ago)
- Last Synced: 2024-12-27T14:09:05.662Z (about 2 months ago)
- Topics: babel, babel-util, modules
- Language: JavaScript
- Size: 32.2 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# babel-helper-simplify-module
> Transform module using [babel-explode-module](https://github.com/babel-utils/babel-explode-module) to have a simpler structure
```js
import {simplifyModule} from 'babel-helper-simplify-module';simplifyModule(programPath);
```**Before:**
```js
import foo from "mod";
import {bar} from "mod";export default function() {
// ...
}export const baz = 42,
bat = "hello world";export * from "bam";
```**After:**
```js
import foo, {bar} from "mod";function _default() {
// ...
}const baz = 42;
const bat = "hello world";export default _default;
export { baz };
export { bat };
export * from "bam";
```## API
### `explodedToStatements(exploded)`
```js
import explodeModule from 'babel-explode-module';
import {explodedToStatements} from 'babel-helper-simplify-module';let exploded = explodeModule(node);
let statements = explodedToStatements(exploded);
```### `simplifyModule(path)`
> This mutates the program.
```js
import {simplifyModule} from 'babel-helper-simplify-module';simplifyModule(programPath);
```