1 | "use strict";
|
2 |
|
3 | exports.__esModule = true;
|
4 |
|
5 |
|
6 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
|
7 |
|
8 | var _babylon = require("babylon");
|
9 |
|
10 | var babylon = _interopRequireWildcard(_babylon);
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | exports["default"] = function (code) {
|
17 | var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
|
18 |
|
19 | var parseOpts = {
|
20 | allowImportExportEverywhere: opts.looseModules,
|
21 | allowReturnOutsideFunction: opts.looseModules,
|
22 | allowHashBang: true,
|
23 | ecmaVersion: 6,
|
24 | strictMode: opts.strictMode,
|
25 | sourceType: opts.sourceType,
|
26 | locations: true,
|
27 | features: opts.features || {},
|
28 | plugins: opts.plugins || {}
|
29 | };
|
30 |
|
31 | if (opts.nonStandard) {
|
32 | parseOpts.plugins.jsx = true;
|
33 | parseOpts.plugins.flow = true;
|
34 | }
|
35 |
|
36 | return babylon.parse(code, parseOpts);
|
37 | };
|
38 |
|
39 | module.exports = exports["default"]; |
\ | No newline at end of file |