JSPM

babel-helper-simplify-module

2.2.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 440
  • Score
    100M100P100Q102950F
  • License MIT

Transform module using babel-explode-module to have a simpler structure

Package Exports

  • babel-helper-simplify-module

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-helper-simplify-module) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

babel-helper-simplify-module

Transform module using babel-explode-module to have a simpler structure

import {simplifyModule} from 'babel-helper-simplify-module';

simplifyModule(programPath);

Before:

import foo from "mod";
import {bar} from "mod";

export default function() {
  // ...
}

export const baz = 42,
             bat = "hello world";

export * from "bam";

After:

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)

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.

import {simplifyModule} from 'babel-helper-simplify-module';

simplifyModule(programPath);