compiler.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. declare type CompilerOptions = {
  2. warn?: Function,
  3. isIE?: boolean,
  4. expectHTML?: boolean,
  5. preserveWhitespace?: boolean,
  6. modules?: Array<ModuleOptions>,
  7. staticKeys?: string,
  8. directives?: { [key: string]: Function },
  9. isUnaryTag?: (tag: string) => ?boolean,
  10. isReservedTag?: (tag: string) => ?boolean,
  11. mustUseProp?: (attr: string) => ?boolean,
  12. getTagNamespace?: (tag: string) => ?string,
  13. delimiters?: [string, string]
  14. }
  15. declare type ModuleOptions = {
  16. staticKeys?: Array<string>,
  17. parse: Function,
  18. genData: Function
  19. }
  20. declare type ASTElementHandler = {
  21. value: string,
  22. modifiers: ?{ [key: string]: true }
  23. }
  24. declare type ASTElementHandlers = {
  25. [key: string]: ASTElementHandler | Array<ASTElementHandler>
  26. }
  27. declare type ASTElementHooks = { [key: string]: Array<string> }
  28. declare type ASTDirective = {
  29. name: string,
  30. value: ?string,
  31. arg: ?string,
  32. modifiers: ?{ [key: string]: true }
  33. }
  34. declare type ASTNode = ASTElement | ASTText | ASTExpression
  35. declare type ASTElement = {
  36. type: 1,
  37. tag: string,
  38. attrsList: Array<{ name: string, value: string }>,
  39. attrsMap: { [key: string]: string | null },
  40. parent: ASTElement | void,
  41. children: Array<ASTNode>,
  42. static?: boolean,
  43. staticRoot?: boolean,
  44. text?: string,
  45. attrs?: Array<{ name: string, value: string }>,
  46. props?: Array<{ name: string, value: string }>,
  47. staticAttrs?: Array<{ name: string, value: string }>,
  48. plain?: boolean,
  49. pre?: true,
  50. ns?: string,
  51. component?: string,
  52. inlineTemplate?: true,
  53. slotName?: ?string,
  54. slotTarget?: ?string,
  55. ref?: string,
  56. refInFor?: boolean,
  57. render?: true,
  58. renderMethod?: ?string,
  59. renderArgs?: ?string,
  60. if?: string | null,
  61. else?: true,
  62. elseBlock?: ASTElement,
  63. for?: string | null,
  64. key?: string,
  65. alias?: string,
  66. iterator?: string,
  67. staticClass?: string,
  68. classBinding?: string,
  69. styleBinding?: string,
  70. hooks?: ASTElementHooks,
  71. events?: ASTElementHandlers,
  72. transition?: string | true,
  73. transitionOnAppear?: boolean,
  74. directives?: Array<ASTDirective>,
  75. forbidden?: true,
  76. once?: true
  77. }
  78. declare type ASTExpression = {
  79. type: 2,
  80. expression: string,
  81. static?: boolean
  82. }
  83. declare type ASTText = {
  84. type: 3,
  85. text: string,
  86. static?: boolean
  87. }