1a3e8a13889060b34e0a8be3c28603efc012c45a772e2401138cf535b187e078b83bf29846917a10bb9c666bacbcd38cb019670866b9b47a86b2eb7cf6af70 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /* @flow */
  2. import {
  3. no,
  4. noop,
  5. identity
  6. } from 'shared/util'
  7. import { LIFECYCLE_HOOKS } from 'shared/constants'
  8. export type Config = {
  9. // user
  10. optionMergeStrategies: { [key: string]: Function };
  11. silent: boolean;
  12. productionTip: boolean;
  13. performance: boolean;
  14. devtools: boolean;
  15. errorHandler: ?(err: Error, vm: Component, info: string) => void;
  16. warnHandler: ?(msg: string, vm: Component, trace: string) => void;
  17. ignoredElements: Array<string | RegExp>;
  18. keyCodes: { [key: string]: number | Array<number> };
  19. // platform
  20. isReservedTag: (x?: string) => boolean;
  21. isReservedAttr: (x?: string) => boolean;
  22. parsePlatformTagName: (x: string) => string;
  23. isUnknownElement: (x?: string) => boolean;
  24. getTagNamespace: (x?: string) => string | void;
  25. mustUseProp: (tag: string, type: ?string, name: string) => boolean;
  26. // private
  27. async: boolean;
  28. // legacy
  29. _lifecycleHooks: Array<string>;
  30. };
  31. export default ({
  32. /**
  33. * Option merge strategies (used in core/util/options)
  34. */
  35. // $flow-disable-line
  36. optionMergeStrategies: Object.create(null),
  37. /**
  38. * Whether to suppress warnings.
  39. */
  40. silent: false,
  41. /**
  42. * Show production mode tip message on boot?
  43. */
  44. productionTip: process.env.NODE_ENV !== 'production',
  45. /**
  46. * Whether to enable devtools
  47. */
  48. devtools: process.env.NODE_ENV !== 'production',
  49. /**
  50. * Whether to record perf
  51. */
  52. performance: false,
  53. /**
  54. * Error handler for watcher errors
  55. */
  56. errorHandler: null,
  57. /**
  58. * Warn handler for watcher warns
  59. */
  60. warnHandler: null,
  61. /**
  62. * Ignore certain custom elements
  63. */
  64. ignoredElements: [],
  65. /**
  66. * Custom user key aliases for v-on
  67. */
  68. // $flow-disable-line
  69. keyCodes: Object.create(null),
  70. /**
  71. * Check if a tag is reserved so that it cannot be registered as a
  72. * component. This is platform-dependent and may be overwritten.
  73. */
  74. isReservedTag: no,
  75. /**
  76. * Check if an attribute is reserved so that it cannot be used as a component
  77. * prop. This is platform-dependent and may be overwritten.
  78. */
  79. isReservedAttr: no,
  80. /**
  81. * Check if a tag is an unknown element.
  82. * Platform-dependent.
  83. */
  84. isUnknownElement: no,
  85. /**
  86. * Get the namespace of an element
  87. */
  88. getTagNamespace: noop,
  89. /**
  90. * Parse the real tag name for the specific platform.
  91. */
  92. parsePlatformTagName: identity,
  93. /**
  94. * Check if an attribute must be bound using property, e.g. value
  95. * Platform-dependent.
  96. */
  97. mustUseProp: no,
  98. /**
  99. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  100. * This will significantly reduce performance if set to false.
  101. */
  102. async: true,
  103. /**
  104. * Exposed for legacy reasons
  105. */
  106. _lifecycleHooks: LIFECYCLE_HOOKS
  107. }: Config)