UNPKG

7.99 kBJavaScriptView Raw
1"use strict";
2
3exports.__esModule = true;
4
5var _babelPluginTransformEs2015TemplateLiterals = require("babel-plugin-transform-es2015-template-literals");
6
7var _babelPluginTransformEs2015TemplateLiterals2 = _interopRequireDefault(_babelPluginTransformEs2015TemplateLiterals);
8
9var _babelPluginTransformEs2015Literals = require("babel-plugin-transform-es2015-literals");
10
11var _babelPluginTransformEs2015Literals2 = _interopRequireDefault(_babelPluginTransformEs2015Literals);
12
13var _babelPluginTransformEs2015FunctionName = require("babel-plugin-transform-es2015-function-name");
14
15var _babelPluginTransformEs2015FunctionName2 = _interopRequireDefault(_babelPluginTransformEs2015FunctionName);
16
17var _babelPluginTransformEs2015ArrowFunctions = require("babel-plugin-transform-es2015-arrow-functions");
18
19var _babelPluginTransformEs2015ArrowFunctions2 = _interopRequireDefault(_babelPluginTransformEs2015ArrowFunctions);
20
21var _babelPluginTransformEs2015BlockScopedFunctions = require("babel-plugin-transform-es2015-block-scoped-functions");
22
23var _babelPluginTransformEs2015BlockScopedFunctions2 = _interopRequireDefault(_babelPluginTransformEs2015BlockScopedFunctions);
24
25var _babelPluginTransformEs2015Classes = require("babel-plugin-transform-es2015-classes");
26
27var _babelPluginTransformEs2015Classes2 = _interopRequireDefault(_babelPluginTransformEs2015Classes);
28
29var _babelPluginTransformEs2015ObjectSuper = require("babel-plugin-transform-es2015-object-super");
30
31var _babelPluginTransformEs2015ObjectSuper2 = _interopRequireDefault(_babelPluginTransformEs2015ObjectSuper);
32
33var _babelPluginTransformEs2015ShorthandProperties = require("babel-plugin-transform-es2015-shorthand-properties");
34
35var _babelPluginTransformEs2015ShorthandProperties2 = _interopRequireDefault(_babelPluginTransformEs2015ShorthandProperties);
36
37var _babelPluginTransformEs2015DuplicateKeys = require("babel-plugin-transform-es2015-duplicate-keys");
38
39var _babelPluginTransformEs2015DuplicateKeys2 = _interopRequireDefault(_babelPluginTransformEs2015DuplicateKeys);
40
41var _babelPluginTransformEs2015ComputedProperties = require("babel-plugin-transform-es2015-computed-properties");
42
43var _babelPluginTransformEs2015ComputedProperties2 = _interopRequireDefault(_babelPluginTransformEs2015ComputedProperties);
44
45var _babelPluginTransformEs2015ForOf = require("babel-plugin-transform-es2015-for-of");
46
47var _babelPluginTransformEs2015ForOf2 = _interopRequireDefault(_babelPluginTransformEs2015ForOf);
48
49var _babelPluginTransformEs2015StickyRegex = require("babel-plugin-transform-es2015-sticky-regex");
50
51var _babelPluginTransformEs2015StickyRegex2 = _interopRequireDefault(_babelPluginTransformEs2015StickyRegex);
52
53var _babelPluginTransformEs2015UnicodeRegex = require("babel-plugin-transform-es2015-unicode-regex");
54
55var _babelPluginTransformEs2015UnicodeRegex2 = _interopRequireDefault(_babelPluginTransformEs2015UnicodeRegex);
56
57var _babelPluginCheckEs2015Constants = require("babel-plugin-check-es2015-constants");
58
59var _babelPluginCheckEs2015Constants2 = _interopRequireDefault(_babelPluginCheckEs2015Constants);
60
61var _babelPluginTransformEs2015Spread = require("babel-plugin-transform-es2015-spread");
62
63var _babelPluginTransformEs2015Spread2 = _interopRequireDefault(_babelPluginTransformEs2015Spread);
64
65var _babelPluginTransformEs2015Parameters = require("babel-plugin-transform-es2015-parameters");
66
67var _babelPluginTransformEs2015Parameters2 = _interopRequireDefault(_babelPluginTransformEs2015Parameters);
68
69var _babelPluginTransformEs2015Destructuring = require("babel-plugin-transform-es2015-destructuring");
70
71var _babelPluginTransformEs2015Destructuring2 = _interopRequireDefault(_babelPluginTransformEs2015Destructuring);
72
73var _babelPluginTransformEs2015BlockScoping = require("babel-plugin-transform-es2015-block-scoping");
74
75var _babelPluginTransformEs2015BlockScoping2 = _interopRequireDefault(_babelPluginTransformEs2015BlockScoping);
76
77var _babelPluginTransformEs2015TypeofSymbol = require("babel-plugin-transform-es2015-typeof-symbol");
78
79var _babelPluginTransformEs2015TypeofSymbol2 = _interopRequireDefault(_babelPluginTransformEs2015TypeofSymbol);
80
81var _babelPluginTransformEs2015ModulesCommonjs = require("babel-plugin-transform-es2015-modules-commonjs");
82
83var _babelPluginTransformEs2015ModulesCommonjs2 = _interopRequireDefault(_babelPluginTransformEs2015ModulesCommonjs);
84
85var _babelPluginTransformEs2015ModulesSystemjs = require("babel-plugin-transform-es2015-modules-systemjs");
86
87var _babelPluginTransformEs2015ModulesSystemjs2 = _interopRequireDefault(_babelPluginTransformEs2015ModulesSystemjs);
88
89var _babelPluginTransformEs2015ModulesAmd = require("babel-plugin-transform-es2015-modules-amd");
90
91var _babelPluginTransformEs2015ModulesAmd2 = _interopRequireDefault(_babelPluginTransformEs2015ModulesAmd);
92
93var _babelPluginTransformEs2015ModulesUmd = require("babel-plugin-transform-es2015-modules-umd");
94
95var _babelPluginTransformEs2015ModulesUmd2 = _interopRequireDefault(_babelPluginTransformEs2015ModulesUmd);
96
97var _babelPluginTransformRegenerator = require("babel-plugin-transform-regenerator");
98
99var _babelPluginTransformRegenerator2 = _interopRequireDefault(_babelPluginTransformRegenerator);
100
101function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
102
103function preset(context) {
104 var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
105
106 var moduleTypes = ["commonjs", "amd", "umd", "systemjs"];
107 var loose = false;
108 var modules = "commonjs";
109 var spec = false;
110
111 if (opts !== undefined) {
112 if (opts.loose !== undefined) loose = opts.loose;
113 if (opts.modules !== undefined) modules = opts.modules;
114 if (opts.spec !== undefined) spec = opts.spec;
115 }
116
117 if (typeof loose !== "boolean") throw new Error("Preset es2015 'loose' option must be a boolean.");
118 if (typeof spec !== "boolean") throw new Error("Preset es2015 'spec' option must be a boolean.");
119 if (modules !== false && moduleTypes.indexOf(modules) === -1) {
120 throw new Error("Preset es2015 'modules' option must be 'false' to indicate no modules\n" + "or a module type which be be one of: 'commonjs' (default), 'amd', 'umd', 'systemjs'");
121 }
122
123 var optsLoose = { loose: loose };
124
125 return {
126 plugins: [[_babelPluginTransformEs2015TemplateLiterals2.default, { loose: loose, spec: spec }], _babelPluginTransformEs2015Literals2.default, _babelPluginTransformEs2015FunctionName2.default, [_babelPluginTransformEs2015ArrowFunctions2.default, { spec: spec }], _babelPluginTransformEs2015BlockScopedFunctions2.default, [_babelPluginTransformEs2015Classes2.default, optsLoose], _babelPluginTransformEs2015ObjectSuper2.default, _babelPluginTransformEs2015ShorthandProperties2.default, _babelPluginTransformEs2015DuplicateKeys2.default, [_babelPluginTransformEs2015ComputedProperties2.default, optsLoose], [_babelPluginTransformEs2015ForOf2.default, optsLoose], _babelPluginTransformEs2015StickyRegex2.default, _babelPluginTransformEs2015UnicodeRegex2.default, _babelPluginCheckEs2015Constants2.default, [_babelPluginTransformEs2015Spread2.default, optsLoose], _babelPluginTransformEs2015Parameters2.default, [_babelPluginTransformEs2015Destructuring2.default, optsLoose], _babelPluginTransformEs2015BlockScoping2.default, _babelPluginTransformEs2015TypeofSymbol2.default, modules === "commonjs" && [_babelPluginTransformEs2015ModulesCommonjs2.default, optsLoose], modules === "systemjs" && [_babelPluginTransformEs2015ModulesSystemjs2.default, optsLoose], modules === "amd" && [_babelPluginTransformEs2015ModulesAmd2.default, optsLoose], modules === "umd" && [_babelPluginTransformEs2015ModulesUmd2.default, optsLoose], [_babelPluginTransformRegenerator2.default, { async: false, asyncGenerators: false }]].filter(Boolean) };
127}
128
129var oldConfig = preset({});
130
131exports.default = oldConfig;
132
133Object.defineProperty(oldConfig, "buildPreset", {
134 configurable: true,
135 writable: true,
136
137 enumerable: false,
138 value: preset
139});
140module.exports = exports["default"];
\No newline at end of file