Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/effrenus/babel-plugin-transform-es6-to-ymodule

Transpile es6 module syntax to YModules
https://github.com/effrenus/babel-plugin-transform-es6-to-ymodule

Last synced: about 1 month ago
JSON representation

Transpile es6 module syntax to YModules

Awesome Lists containing this project

README

        

# Babel plugin

Transform ES6 module syntax to YModule declarations

## Plugin settings

* `namespace` - modules prefix

## Example

```
//SETMODULE: bubble.layout
import 'Map';
import 'Placemark';

var size = [100, 200],
color = 'red';

const map = new Map({
center: [55, 45],
zoom: 10
});

export function getColor () {
return color;
}

export function getMap () {
return map;
}
```

transformed to

```
'use strict';

ymaps.modules.define('bubble.layout', ['Map', 'Placemark'], function (provide, Map, Placemark) {

var size = [100, 200],
color = 'red';

var map = new Map({
center: [55, 45],
zoom: 10
});

provide({
'getColor': function getColor() {
return color;
},
'getMap': function getMap() {
return map;
}
});
})
```