config.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* @flow */
  2. import {
  3. no,
  4. noop,
  5. identity
  6. } from 'shared/util'
  7. export type Config = {
  8. // user
  9. optionMergeStrategies: { [key: string]: Function };
  10. silent: boolean;
  11. productionTip: boolean;
  12. performance: boolean;
  13. devtools: boolean;
  14. errorHandler: ?(err: Error, vm: Component, info: string) => void;
  15. ignoredElements: Array<string>;
  16. keyCodes: { [key: string]: number | Array<number> };
  17. // platform
  18. isReservedTag: (x?: string) => boolean;
  19. parsePlatformTagName: (x: string) => string;
  20. isUnknownElement: (x?: string) => boolean;
  21. getTagNamespace: (x?: string) => string | void;
  22. mustUseProp: (tag: string, type: ?string, name: string) => boolean;
  23. };
  24. export default ({
  25. /**
  26. * Option merge strategies (used in core/util/options)
  27. */
  28. optionMergeStrategies: Object.create(null),
  29. /**
  30. * Whether to suppress warnings.
  31. */
  32. silent: false,
  33. /**
  34. * Show production mode tip message on boot?
  35. */
  36. productionTip: process.env.NODE_ENV !== 'production',
  37. /**
  38. * Whether to enable devtools
  39. */
  40. devtools: process.env.NODE_ENV !== 'production',
  41. /**
  42. * Whether to record perf
  43. */
  44. performance: false,
  45. /**
  46. * Error handler for watcher errors
  47. */
  48. errorHandler: null,
  49. /**
  50. * Ignore certain custom elements
  51. */
  52. ignoredElements: [],
  53. /**
  54. * Custom user key aliases for v-on
  55. */
  56. keyCodes: Object.create(null),
  57. /**
  58. * Check if a tag is reserved so that it cannot be registered as a
  59. * component. This is platform-dependent and may be overwritten.
  60. */
  61. isReservedTag: no,
  62. /**
  63. * Check if a tag is an unknown element.
  64. * Platform-dependent.
  65. */
  66. isUnknownElement: no,
  67. /**
  68. * Get the namespace of an element
  69. */
  70. getTagNamespace: noop,
  71. /**
  72. * Parse the real tag name for the specific platform.
  73. */
  74. parsePlatformTagName: identity,
  75. /**
  76. * Check if an attribute must be bound using property, e.g. value
  77. * Platform-dependent.
  78. */
  79. mustUseProp: no
  80. }: Config)