UNPKG

639 BJavaScriptView Raw
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'use strict';
10
11const babylon = require('@babel/parser');
12const baseOptions = require('./tsOptions');
13
14const options = Object.assign({}, baseOptions);
15options.plugins = ['jsx'].concat(baseOptions.plugins);
16
17/**
18 * Doesn't accept custom options because babylon should be used directly in
19 * that case.
20 */
21module.exports = function() {
22 return {
23 parse(code) {
24 return babylon.parse(code, options);
25 },
26 };
27};