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.

21 lines
748 B

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