1
1
const chalk = require ( 'chalk' )
2
2
const SILENT = {
3
3
category : 'Global Config' ,
4
- name : '# silent' ,
4
+ name : 'silent' ,
5
5
type : 'boolean' ,
6
6
default : 'false' ,
7
7
usage : `Vue.config.silent = ${ chalk . magentaBright ( 'true' ) } ` ,
8
8
details : 'Suppress all Vue logs and warnings' ,
9
9
}
10
10
const OPTION_MERGE_STRATEGIES = {
11
11
category : 'Global Config' ,
12
- name : '# optionMergeStrategies' ,
12
+ name : 'optionMergeStrategies' ,
13
13
type : '{ [key: string]: Function }' ,
14
14
default : '{}' ,
15
15
usage : `Vue.config.optionMergeStrategies._my_option = ${ chalk . magentaBright ( 'function' ) } (parent, child, vm) {
@@ -26,7 +26,7 @@ const OPTION_MERGE_STRATEGIES = {
26
26
}
27
27
const DEVTOOLS = {
28
28
category : 'Global Config' ,
29
- name : '# devtools' ,
29
+ name : 'devtools' ,
30
30
type : 'boolean' ,
31
31
default : `true ${ chalk . white ( '(' ) } false ${ chalk . white ( 'in production builds)' ) } ` ,
32
32
usage : `// make sure to set this synchronously immediately after loading Vue
@@ -35,19 +35,33 @@ const DEVTOOLS = {
35
35
This option's default value is ${ chalk . magentaBright ( 'true' ) } in development builds and ${ chalk . magentaBright ( 'false' ) } in production builds.
36
36
You can set it to ${ chalk . magentaBright ( 'true' ) } to enable inspection for production builds`
37
37
}
38
- /* const SILENT = {
38
+ const ERROR_HANDLER = {
39
39
category : 'Global Config' ,
40
- name: '#silent',
41
- type: 'boolean',
42
- default: 'false',
43
- arguments: '',
44
- readOption: '',
45
- usage: `Vue.config.silent = ${chalk.magentaBright('true')}`,
46
- details: 'Suppress all Vue logs and warnings',
47
- example: ''
40
+ name : 'errorHandler' ,
41
+ type : 'Function' ,
42
+ default : 'undefined' ,
43
+ usage : `Vue.config.errorHandler = ${ chalk . magentaBright ( 'function' ) } (err, vm, info) {
44
+ // handle error
45
+ // 'info' is a Vue-specific error info, e.g. which lifecycle hook
46
+ // the error was found in. Only available in 2.2.0+
47
+ }` ,
48
+ details : `Assign a handler for uncaught errors during component render function
49
+ and watchers. The handler gets called with the error and the Vue instance.`
48
50
}
49
51
50
- const SILENT = {
52
+ const WARN_HANDLER = {
53
+ category : 'Global Config' ,
54
+ name : 'warnHandler' ,
55
+ type : 'Function' ,
56
+ default : 'undefined' ,
57
+ usage : `Vue.config.warnHandler = ${ chalk . magentaBright ( 'function' ) } (msg, vm, trace) {
58
+ // trace is the component hierarchy trace
59
+ }` ,
60
+ details : `Assign a custom handler for runtime Vue warnings. Note this only works
61
+ during development and is ignored in production.`
62
+ }
63
+
64
+ /*const SILENT = {
51
65
category: 'Global Config',
52
66
name: '#silent',
53
67
type: 'boolean',
@@ -122,5 +136,7 @@ const SILENT = {
122
136
module . exports = {
123
137
SILENT ,
124
138
OPTION_MERGE_STRATEGIES ,
125
- DEVTOOLS
139
+ DEVTOOLS ,
140
+ ERROR_HANDLER ,
141
+ WARN_HANDLER
126
142
}
0 commit comments