You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
748 B
22 lines
748 B
4 years ago
|
"use strict";
|
||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
|
};
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
var babel_1 = require("./babel");
|
||
|
var _babel_options_1 = __importDefault(require("./_babel_options"));
|
||
|
// This module is suitable for passing as options.parser when calling
|
||
|
// recast.parse to process Flow code:
|
||
|
//
|
||
|
// const ast = recast.parse(source, {
|
||
|
// parser: require("recast/parsers/flow")
|
||
|
// });
|
||
|
//
|
||
|
function parse(source, options) {
|
||
|
var babelOptions = _babel_options_1.default(options);
|
||
|
babelOptions.plugins.push("jsx", "flow");
|
||
|
return babel_1.parser.parse(source, babelOptions);
|
||
|
}
|
||
|
exports.parse = parse;
|
||
|
;
|