Advertisement
Guest User

Untitled

a guest
May 20th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. import fork from "./fork";
  2. import coreDef from "./def/core";
  3. import es6Def from "./def/es6";
  4. import es7Def from "./def/es7";
  5. import jsxDef from "./def/jsx";
  6. import flowDef from "./def/flow";
  7. import esprimaDef from "./def/esprima";
  8. import babelDef from "./def/babel";
  9. import typescriptDef from "./def/typescript";
  10. import esProposalsDef from "./def/es-proposals";
  11. import { Omit } from "./types";
  12. import { ASTNode, Type, AnyType, Field } from "./lib/types";
  13. import { NodePath } from "./lib/node-path";
  14. import { NamedTypes } from "./gen/namedTypes";
  15. import { Builders } from "./gen/builders";
  16. import { Visitor } from "./gen/visitor";
  17.  
  18. type GenTypes = {
  19. namedTypes: NamedTypes;
  20. builders: Builders;
  21. visit<M = {}>(node: ASTNode, methods?: Visitor<M> & M): any;
  22. };
  23.  
  24. type Main = Omit<ReturnType<typeof fork>, keyof GenTypes> & GenTypes;
  25.  
  26. const defs = [
  27. // This core module of AST types captures ES5 as it is parsed today by
  28. // git://github.com/ariya/esprima.git#master.
  29. coreDef,
  30.  
  31. // Feel free to add to or remove from this list of extension modules to
  32. // configure the precise type hierarchy that you need.
  33. es6Def,
  34. es7Def,
  35. jsxDef,
  36. flowDef,
  37. esprimaDef,
  38. babelDef,
  39. typescriptDef,
  40. esProposalsDef,
  41. ];
  42.  
  43. const main = fork(defs) as any as Main;
  44. export default main;
  45.  
  46. export {
  47. ASTNode,
  48. Type,
  49. AnyType,
  50. Field,
  51. NodePath,
  52. NamedTypes,
  53. Builders,
  54. Visitor,
  55. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement