recast
Version:
JavaScript syntax tree transformer, nondestructive pretty-printer, and automatic source map generator
22 lines (21 loc) • 748 B
JavaScript
;
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;
;