UNPKG

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