Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
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: {
"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'),