compiler.js 2.1 KB

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