How to use the babel-preset-es2015.plugins function in babel-preset-es2015

To help you get started, we’ve selected a few babel-preset-es2015 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jairajs89 / zerver / src / plugin / babel.js View on Github external
callback(headers, body);
        return;
    }

    try {
        body = require('babel-core').transform(body.toString(), {
            filename        : path.join(options.dir, pathname),
            filenameRelative: pathname,
            compact         : false,
            ast             : false,
            comments        : false,
            moduleIds       : true,
            plugins         : [
                babelModuleInner,
            ].concat(
                require('babel-preset-es2015').plugins
                    .filter(function (_, index, list) {
                        // Super dirty hack to remove commonjs module formatter
                        return index !== list.length - 2;
                    })
            ).concat(
                require('babel-preset-react').plugins
            ).concat([
                babelModuleOuter,
            ]),
        }).code;
        headers['Content-Type'] = 'application/javascript';
    } catch (err) {
        console.error('failed to compile JSX file, ' + pathname);
        console.error(err.stack || err.message || err.toString());
        if (options.production) {
            process.exit(1);
github Sage / streamlinejs / src / browser / transform.js View on Github external
transform: function(code, streamlineOptions) {
		streamlineOptions = streamlineOptions || {};
		streamlineOptions.runtime = streamlineOptions.runtime || "callbacks";
		var plugins = [[streamline, streamlineOptions]];
		// remove regenerator plugin (last one in es2015 preset) if generators mode
		es2015.plugins = es2015Plugins.slice(); // restore original plugins list
		if (streamlineOptions.runtime === 'generators') es2015.plugins.pop();
		return babel.transform(code, {
			plugins: plugins,
			presets: es2015,
		}).code;
	},
	modules: {
github Sage / streamlinejs / src / browser / transform.js View on Github external
"use strict";
var babel = require('babel-core');
var streamline = require('babel-plugin-streamline');
var es2015 = require('babel-preset-es2015');
var es2015Plugins = es2015.plugins;

window.Streamline = {
	transform: function(code, streamlineOptions) {
		streamlineOptions = streamlineOptions || {};
		streamlineOptions.runtime = streamlineOptions.runtime || "callbacks";
		var plugins = [[streamline, streamlineOptions]];
		// remove regenerator plugin (last one in es2015 preset) if generators mode
		es2015.plugins = es2015Plugins.slice(); // restore original plugins list
		if (streamlineOptions.runtime === 'generators') es2015.plugins.pop();
		return babel.transform(code, {
			plugins: plugins,
			presets: es2015,
		}).code;
	},
	modules: {
		'streamline-runtime/lib/callbacks/regenerator' : require('streamline-runtime/lib/callbacks/regenerator'),

babel-preset-es2015

Babel preset for all es2015 plugins.

MIT
Latest version published 8 years ago

Package Health Score

64 / 100
Full package analysis