Skip to content

effrenus/babel-plugin-transform-es6-to-ymodule

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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;
		}
	});
})

About

Transpile es6 module syntax to YModules

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published