UNPKG

1.55 kBJavaScriptView Raw
1var path = require('path');
2var paths = require('./paths');
3
4exports.base = function() {
5 var config = {
6 filename: '',
7 filenameRelative: '',
8 sourceMap: true,
9 sourceRoot: '',
10 moduleRoot: path.resolve('src').replace(/\\/g, '/'),
11 moduleIds: false,
12 comments: false,
13 compact: false,
14 code: true,
15 presets: [ 'es2015-loose', 'stage-1' ],
16 plugins: [
17 'syntax-flow',
18 'transform-decorators-legacy',
19 ]
20 };
21 if (!paths.useTypeScriptForDTS) {
22 config.plugins.push(
23 ['babel-dts-generator', {
24 packageName: paths.packageName,
25 typings: '',
26 suppressModulePath: true,
27 suppressComments: false,
28 memberOutputFilter: /^_.*/,
29 suppressAmbientDeclaration: true
30 }]
31 );
32 };
33 config.plugins.push('transform-flow-strip-types');
34 return config;
35}
36
37exports.commonjs = function() {
38 var options = exports.base();
39 options.plugins.push('transform-es2015-modules-commonjs');
40 return options;
41};
42
43exports.amd = function() {
44 var options = exports.base();
45 options.plugins.push('transform-es2015-modules-amd');
46 return options;
47};
48
49exports.system = function() {
50 var options = exports.base();
51 options.plugins.push('transform-es2015-modules-systemjs');
52 return options;
53};
54
55exports.es2015 = function() {
56 var options = exports.base();
57 options.presets = ['stage-1']
58 return options;
59};
60
61exports['native-modules'] = function() {
62 var options = exports.base();
63 options.presets[0] = 'es2015-loose-native-modules';
64 return options;
65}