flow.js 676 B

12345678910111213141516171819
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.parse = void 0;
  4. var tslib_1 = require("tslib");
  5. var babel_1 = require("./babel");
  6. var _babel_options_1 = tslib_1.__importDefault(require("./_babel_options"));
  7. // This module is suitable for passing as options.parser when calling
  8. // recast.parse to process Flow code:
  9. //
  10. // const ast = recast.parse(source, {
  11. // parser: require("recast/parsers/flow")
  12. // });
  13. //
  14. function parse(source, options) {
  15. var babelOptions = (0, _babel_options_1.default)(options);
  16. babelOptions.plugins.push("jsx", "flow");
  17. return babel_1.parser.parse(source, babelOptions);
  18. }
  19. exports.parse = parse;