1 |
|
2 | /**
|
3 | * Copyright (c) Facebook, Inc. and its affiliates.
|
4 | *
|
5 | * This source code is licensed under the MIT license found in the
|
6 | * LICENSE file in the root directory of this source tree.
|
7 | */
|
8 |
|
9 | ;
|
10 |
|
11 | const babylon = require('@babel/parser');
|
12 | const baseOptions = require('./tsOptions');
|
13 |
|
14 | const options = Object.assign({}, baseOptions);
|
15 | options.plugins = ['jsx'].concat(baseOptions.plugins);
|
16 |
|
17 | /**
|
18 | * Doesn't accept custom options because babylon should be used directly in
|
19 | * that case.
|
20 | */
|
21 | module.exports = function() {
|
22 | return {
|
23 | parse(code) {
|
24 | return babylon.parse(code, options);
|
25 | },
|
26 | };
|
27 | };
|