1 | "use strict";
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports.default = traverse;
|
5 |
|
6 | var _path = _interopRequireDefault(require("path"));
|
7 |
|
8 | var _core = require("@babel/core");
|
9 |
|
10 | var _plugin = _interopRequireDefault(require("./plugin"));
|
11 |
|
12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13 |
|
14 | function traverse(source, filename, opts) {
|
15 | const extname = _path.default.extname(filename);
|
16 |
|
17 | return (0, _core.transformSync)(source, {
|
18 | filename,
|
19 | babelrc: false,
|
20 | code: false,
|
21 | ast: false,
|
22 | plugins: [[_plugin.default, opts]],
|
23 | parserOpts: {
|
24 | allowImportExportEverywhere: true,
|
25 | allowReturnOutsideFunction: true,
|
26 | allowSuperOutsideMethod: true,
|
27 | sourceType: 'unambiguous',
|
28 | sourceFilename: true,
|
29 | plugins: ['jsx', extname === '.ts' || extname === '.tsx' ? 'typescript' : 'flow', 'doExpressions', 'objectRestSpread', ['decorators', {
|
30 | decoratorsBeforeExport: true
|
31 | }], 'classProperties', 'classPrivateProperties', 'classPrivateMethods', 'exportDefaultFrom', 'exportNamespaceFrom', 'asyncGenerators', 'functionBind', 'functionSent', 'dynamicImport', 'numericSeparator', 'optionalChaining', 'importMeta', 'bigInt', 'optionalCatchBinding', 'throwExpressions', ['pipelineOperator', {
|
32 | proposal: 'minimal'
|
33 | }], 'nullishCoalescingOperator']
|
34 | }
|
35 | });
|
36 | } |
\ | No newline at end of file |