flow.js 459 B

12345678910111213141516
  1. "use strict";
  2. const parser = require("./babylon.js").parser;
  3. // This module is suitable for passing as options.parser when calling
  4. // recast.parse to process Flow code:
  5. //
  6. // const ast = recast.parse(source, {
  7. // parser: require("recast/parsers/flow")
  8. // });
  9. //
  10. exports.parse = function parse(source, options) {
  11. options = require("./_babylon_options.js")(options);
  12. options.plugins.push("jsx", "flow");
  13. return parser.parse(source, options);
  14. };