@honeybadger-io/vue 1.0.1 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/honeybadger-vue.esm.js +105 -5
- package/dist/honeybadger-vue.esm.js.map +1 -1
- package/dist/honeybadger-vue.js +107 -7
- package/dist/honeybadger-vue.js.map +1 -1
- package/dist/honeybadger-vue.umd.js +108 -8
- package/dist/honeybadger-vue.umd.js.map +1 -1
- package/honeybadger-vue.d.ts +11 -18
- package/package.json +63 -53
- package/src/error-logging.js +12 -0
- package/src/index.js +23 -4
- package/src/vue-debug.js +74 -0
- package/CHANGELOG.md +0 -74
package/README.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
[](https://badge.fury.io/js/%40honeybadger-io%2Fvue)
|
|
4
4
|
> [Vue.js integration for Honeybadger.io](https://www.honeybadger.io/for/javascript/?utm_source=github&utm_medium=readme&utm_campaign=vue&utm_content=Vue.js+integration+for+Honeybadger.io)
|
|
5
5
|
|
|
6
|
+
**Note:** The latest release of this project supports Vue.js v2.x. See the [vue3](https://github.com/honeybadger-io/honeybadger-vue/tree/vue3) branch for v3.x support.
|
|
7
|
+
|
|
6
8
|
## Documentation and Support
|
|
7
9
|
|
|
8
10
|
For comprehensive documentation and support, [check out our documentation site](https://docs.honeybadger.io/lib/javascript/index.html).
|
|
@@ -1,8 +1,90 @@
|
|
|
1
1
|
import Honeybadger from '@honeybadger-io/js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* This was taken from https://github.com/vuejs/vue/blob/master/src/core/util/debug.js.
|
|
5
|
+
* The method generateStackTrace is used to log errors the same way as Vue logs them when errorHandler is not set.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
var classifyRE = /(?:^|[-_])(\w)/g;
|
|
9
|
+
var classify = function (str) { return str
|
|
10
|
+
.replace(classifyRE, function (c) { return c.toUpperCase(); })
|
|
11
|
+
.replace(/[-_]/g, ''); };
|
|
12
|
+
|
|
13
|
+
var formatComponentName = function (vm, includeFile) {
|
|
14
|
+
if (vm.$root === vm) {
|
|
15
|
+
return '<Root>'
|
|
16
|
+
}
|
|
17
|
+
var options = typeof vm === 'function' && vm.cid != null
|
|
18
|
+
? vm.options
|
|
19
|
+
: vm._isVue
|
|
20
|
+
? vm.$options || vm.constructor.options
|
|
21
|
+
: vm || {};
|
|
22
|
+
var name = options.name || options._componentTag;
|
|
23
|
+
var file = options.__file;
|
|
24
|
+
if (!name && file) {
|
|
25
|
+
var match = file.match(/([^/\\]+)\.vue$/);
|
|
26
|
+
name = match && match[1];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
(name ? ("<" + (classify(name)) + ">") : '<Anonymous>') +
|
|
31
|
+
(file && includeFile !== false ? (" at " + file) : '')
|
|
32
|
+
)
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var repeat = function (str, n) {
|
|
36
|
+
var res = '';
|
|
37
|
+
while (n) {
|
|
38
|
+
if (n % 2 === 1) { res += str; }
|
|
39
|
+
if (n > 1) { str += str; }
|
|
40
|
+
n >>= 1;
|
|
41
|
+
}
|
|
42
|
+
return res
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var generateComponentTrace = function (vm) {
|
|
46
|
+
if (vm._isVue && vm.$parent) {
|
|
47
|
+
var tree = [];
|
|
48
|
+
var currentRecursiveSequence = 0;
|
|
49
|
+
while (vm) {
|
|
50
|
+
if (tree.length > 0) {
|
|
51
|
+
var last = tree[tree.length - 1];
|
|
52
|
+
if (last.constructor === vm.constructor) {
|
|
53
|
+
currentRecursiveSequence++;
|
|
54
|
+
vm = vm.$parent;
|
|
55
|
+
continue
|
|
56
|
+
} else if (currentRecursiveSequence > 0) {
|
|
57
|
+
tree[tree.length - 1] = [last, currentRecursiveSequence];
|
|
58
|
+
currentRecursiveSequence = 0;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
tree.push(vm);
|
|
62
|
+
vm = vm.$parent;
|
|
63
|
+
}
|
|
64
|
+
return '\n\nfound in\n\n' + tree
|
|
65
|
+
.map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
|
|
66
|
+
? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
|
|
67
|
+
: formatComponentName(vm))); })
|
|
68
|
+
.join('\n')
|
|
69
|
+
} else {
|
|
70
|
+
return ("\n\n(found in " + (formatComponentName(vm)) + ")")
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
function logError (Vue, error, vm, info) {
|
|
75
|
+
var message = "Error in " + info + ": \"" + (error && error.toString()) + "\"";
|
|
76
|
+
|
|
77
|
+
var trace = vm ? generateComponentTrace(vm) : '';
|
|
78
|
+
if (Vue.config.warnHandler) {
|
|
79
|
+
Vue.config.warnHandler.call(null, message, vm, trace);
|
|
80
|
+
} else {
|
|
81
|
+
console.error(("[Vue warn]: " + message + trace));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
3
85
|
var HoneybadgerVue = {
|
|
4
86
|
install: function install (Vue, options) {
|
|
5
|
-
var this$1 = this;
|
|
87
|
+
var this$1$1 = this;
|
|
6
88
|
|
|
7
89
|
if (Vue.config.debug) {
|
|
8
90
|
console.log(("Honeybadger configured with " + (options.apiKey)));
|
|
@@ -12,8 +94,12 @@ var HoneybadgerVue = {
|
|
|
12
94
|
Vue.prototype.$honeybadger = Vue.$honeybadger;
|
|
13
95
|
var chainedErrorHandler = Vue.config.errorHandler;
|
|
14
96
|
var extractContext = function (vm) {
|
|
15
|
-
var options = typeof vm === 'function' && vm.cid != null
|
|
16
|
-
vm.
|
|
97
|
+
var options = typeof vm === 'function' && vm.cid != null
|
|
98
|
+
? vm.options
|
|
99
|
+
: vm._isVue
|
|
100
|
+
? vm.$options ||
|
|
101
|
+
vm.constructor.options
|
|
102
|
+
: vm || {};
|
|
17
103
|
var name = options.name || options._componentTag;
|
|
18
104
|
var file = options.__file;
|
|
19
105
|
return {
|
|
@@ -24,14 +110,28 @@ var HoneybadgerVue = {
|
|
|
24
110
|
file: file
|
|
25
111
|
}
|
|
26
112
|
};
|
|
113
|
+
var shouldLogError = function () {
|
|
114
|
+
if (Vue.config.warnHandler) {
|
|
115
|
+
return true
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
var hasConsole = typeof console !== 'undefined';
|
|
119
|
+
var isDebug = Vue.config.debug || process.env.NODE_ENV !== 'production';
|
|
120
|
+
return hasConsole && isDebug
|
|
121
|
+
};
|
|
122
|
+
|
|
27
123
|
Vue.config.errorHandler = function (error, vm, info) {
|
|
28
124
|
honeybadger.notify(error, { context: { vm: extractContext(vm), info: info } });
|
|
29
125
|
if (typeof chainedErrorHandler === 'function') {
|
|
30
|
-
chainedErrorHandler.call(this$1.Vue, error, vm, info);
|
|
126
|
+
chainedErrorHandler.call(this$1$1.Vue, error, vm, info);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (shouldLogError()) {
|
|
130
|
+
logError(Vue, error, vm, info);
|
|
31
131
|
}
|
|
32
132
|
};
|
|
33
133
|
}
|
|
34
134
|
};
|
|
35
135
|
|
|
36
|
-
export default
|
|
136
|
+
export { HoneybadgerVue as default };
|
|
37
137
|
//# sourceMappingURL=honeybadger-vue.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"honeybadger-vue.esm.js","sources":["../../src/index.js"],"sourcesContent":["import Honeybadger from '@honeybadger-io/js'\n\nconst HoneybadgerVue = {\n install (Vue, options) {\n if (Vue.config.debug) {\n console.log(`Honeybadger configured with ${options.apiKey}`)\n }\n const honeybadger = Honeybadger.configure(options)\n Vue.$honeybadger = honeybadger\n Vue.prototype.$honeybadger = Vue.$honeybadger\n const chainedErrorHandler = Vue.config.errorHandler\n const extractContext = function (vm) {\n
|
|
1
|
+
{"version":3,"file":"honeybadger-vue.esm.js","sources":["../../src/vue-debug.js","../../src/error-logging.js","../../src/index.js"],"sourcesContent":["/**\n * This was taken from https://github.com/vuejs/vue/blob/master/src/core/util/debug.js.\n * The method generateStackTrace is used to log errors the same way as Vue logs them when errorHandler is not set.\n */\n\nconst classifyRE = /(?:^|[-_])(\\w)/g\nconst classify = str => str\n .replace(classifyRE, c => c.toUpperCase())\n .replace(/[-_]/g, '')\n\nconst formatComponentName = (vm, includeFile) => {\n if (vm.$root === vm) {\n return '<Root>'\n }\n const options = typeof vm === 'function' && vm.cid != null\n ? vm.options\n : vm._isVue\n ? vm.$options || vm.constructor.options\n : vm || {}\n let name = options.name || options._componentTag\n const file = options.__file\n if (!name && file) {\n const match = file.match(/([^/\\\\]+)\\.vue$/)\n name = match && match[1]\n }\n\n return (\n (name ? `<${classify(name)}>` : '<Anonymous>') +\n (file && includeFile !== false ? ` at ${file}` : '')\n )\n}\n\nconst repeat = (str, n) => {\n let res = ''\n while (n) {\n if (n % 2 === 1) res += str\n if (n > 1) str += str\n n >>= 1\n }\n return res\n}\n\nexport const generateComponentTrace = vm => {\n if (vm._isVue && vm.$parent) {\n const tree = []\n let currentRecursiveSequence = 0\n while (vm) {\n if (tree.length > 0) {\n const last = tree[tree.length - 1]\n if (last.constructor === vm.constructor) {\n currentRecursiveSequence++\n vm = vm.$parent\n continue\n } else if (currentRecursiveSequence > 0) {\n tree[tree.length - 1] = [last, currentRecursiveSequence]\n currentRecursiveSequence = 0\n }\n }\n tree.push(vm)\n vm = vm.$parent\n }\n return '\\n\\nfound in\\n\\n' + tree\n .map((vm, i) => `${\n i === 0 ? '---> ' : repeat(' ', 5 + i * 2)\n }${\n Array.isArray(vm)\n ? `${formatComponentName(vm[0])}... (${vm[1]} recursive calls)`\n : formatComponentName(vm)\n }`)\n .join('\\n')\n } else {\n return `\\n\\n(found in ${formatComponentName(vm)})`\n }\n}\n","import { generateComponentTrace } from './vue-debug'\n\nexport function logError (Vue, error, vm, info) {\n const message = `Error in ${info}: \"${error && error.toString()}\"`\n\n const trace = vm ? generateComponentTrace(vm) : ''\n if (Vue.config.warnHandler) {\n Vue.config.warnHandler.call(null, message, vm, trace)\n } else {\n console.error(`[Vue warn]: ${message}${trace}`)\n }\n}\n","import Honeybadger from '@honeybadger-io/js'\nimport { logError } from './error-logging'\n\nconst HoneybadgerVue = {\n install (Vue, options) {\n if (Vue.config.debug) {\n console.log(`Honeybadger configured with ${options.apiKey}`)\n }\n const honeybadger = Honeybadger.configure(options)\n Vue.$honeybadger = honeybadger\n Vue.prototype.$honeybadger = Vue.$honeybadger\n const chainedErrorHandler = Vue.config.errorHandler\n const extractContext = function (vm) {\n const options = typeof vm === 'function' && vm.cid != null\n ? vm.options\n : vm._isVue\n ? vm.$options ||\n vm.constructor.options\n : vm || {}\n const name = options.name || options._componentTag\n const file = options.__file\n return {\n isRoot: vm.$root === vm,\n name: name,\n props: options.propsData,\n parentVnodeTag: options._parentVnode ? options._parentVnode.tag : undefined,\n file: file\n }\n }\n const shouldLogError = () => {\n if (Vue.config.warnHandler) {\n return true\n }\n\n const hasConsole = typeof console !== 'undefined'\n const isDebug = Vue.config.debug || process.env.NODE_ENV !== 'production'\n return hasConsole && isDebug\n }\n\n Vue.config.errorHandler = (error, vm, info) => {\n honeybadger.notify(error, { context: { vm: extractContext(vm), info: info } })\n if (typeof chainedErrorHandler === 'function') {\n chainedErrorHandler.call(this.Vue, error, vm, info)\n }\n\n if (shouldLogError()) {\n logError(Vue, error, vm, info)\n }\n }\n }\n}\n\nexport default HoneybadgerVue\n"],"names":["const","let","this"],"mappings":";;AAAA;;;;;AAKAA,IAAM,UAAU,GAAG,kBAAiB;AACpCA,IAAM,QAAQ,aAAG,KAAI,SAAG,GAAG;GACxB,OAAO,CAAC,UAAU,YAAE,GAAE,SAAG,CAAC,CAAC,WAAW,KAAE,CAAC;GACzC,OAAO,CAAC,OAAO,EAAE,EAAE,KAAC;;AAEvBA,IAAM,mBAAmB,aAAI,EAAE,EAAE,WAAW,EAAE;EAC5C,IAAI,EAAE,CAAC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,OAAO,KAAK,YAAW;MACjDA,IAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAY;MACzE,OAAO,UAAU,IAAI,OAAO;MAC7B;;IAED,GAAG,CAAC,MAAM,CAAC,YAAY,aAAI,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE;MAC1C,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAC;MAC9E,IAAI,OAAO,mBAAmB,KAAK,UAAU,EAAE;QAC7C,mBAAmB,CAAC,IAAI,CAACE,QAAI,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAC;OACpD;;MAED,IAAI,cAAc,EAAE,EAAE;QACpB,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAC;OAC/B;MACF;GACF;;;;;"}
|
package/dist/honeybadger-vue.js
CHANGED
|
@@ -5,20 +5,106 @@ var HoneybadgerVue = (function (exports, Honeybadger) {
|
|
|
5
5
|
|
|
6
6
|
var Honeybadger__default = /*#__PURE__*/_interopDefaultLegacy(Honeybadger);
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* This was taken from https://github.com/vuejs/vue/blob/master/src/core/util/debug.js.
|
|
10
|
+
* The method generateStackTrace is used to log errors the same way as Vue logs them when errorHandler is not set.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
var classifyRE = /(?:^|[-_])(\w)/g;
|
|
14
|
+
var classify = function (str) { return str
|
|
15
|
+
.replace(classifyRE, function (c) { return c.toUpperCase(); })
|
|
16
|
+
.replace(/[-_]/g, ''); };
|
|
17
|
+
|
|
18
|
+
var formatComponentName = function (vm, includeFile) {
|
|
19
|
+
if (vm.$root === vm) {
|
|
20
|
+
return '<Root>'
|
|
21
|
+
}
|
|
22
|
+
var options = typeof vm === 'function' && vm.cid != null
|
|
23
|
+
? vm.options
|
|
24
|
+
: vm._isVue
|
|
25
|
+
? vm.$options || vm.constructor.options
|
|
26
|
+
: vm || {};
|
|
27
|
+
var name = options.name || options._componentTag;
|
|
28
|
+
var file = options.__file;
|
|
29
|
+
if (!name && file) {
|
|
30
|
+
var match = file.match(/([^/\\]+)\.vue$/);
|
|
31
|
+
name = match && match[1];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
(name ? ("<" + (classify(name)) + ">") : '<Anonymous>') +
|
|
36
|
+
(file && includeFile !== false ? (" at " + file) : '')
|
|
37
|
+
)
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
var repeat = function (str, n) {
|
|
41
|
+
var res = '';
|
|
42
|
+
while (n) {
|
|
43
|
+
if (n % 2 === 1) { res += str; }
|
|
44
|
+
if (n > 1) { str += str; }
|
|
45
|
+
n >>= 1;
|
|
46
|
+
}
|
|
47
|
+
return res
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var generateComponentTrace = function (vm) {
|
|
51
|
+
if (vm._isVue && vm.$parent) {
|
|
52
|
+
var tree = [];
|
|
53
|
+
var currentRecursiveSequence = 0;
|
|
54
|
+
while (vm) {
|
|
55
|
+
if (tree.length > 0) {
|
|
56
|
+
var last = tree[tree.length - 1];
|
|
57
|
+
if (last.constructor === vm.constructor) {
|
|
58
|
+
currentRecursiveSequence++;
|
|
59
|
+
vm = vm.$parent;
|
|
60
|
+
continue
|
|
61
|
+
} else if (currentRecursiveSequence > 0) {
|
|
62
|
+
tree[tree.length - 1] = [last, currentRecursiveSequence];
|
|
63
|
+
currentRecursiveSequence = 0;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
tree.push(vm);
|
|
67
|
+
vm = vm.$parent;
|
|
68
|
+
}
|
|
69
|
+
return '\n\nfound in\n\n' + tree
|
|
70
|
+
.map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
|
|
71
|
+
? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
|
|
72
|
+
: formatComponentName(vm))); })
|
|
73
|
+
.join('\n')
|
|
74
|
+
} else {
|
|
75
|
+
return ("\n\n(found in " + (formatComponentName(vm)) + ")")
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
function logError (Vue, error, vm, info) {
|
|
80
|
+
var message = "Error in " + info + ": \"" + (error && error.toString()) + "\"";
|
|
81
|
+
|
|
82
|
+
var trace = vm ? generateComponentTrace(vm) : '';
|
|
83
|
+
if (Vue.config.warnHandler) {
|
|
84
|
+
Vue.config.warnHandler.call(null, message, vm, trace);
|
|
85
|
+
} else {
|
|
86
|
+
console.error(("[Vue warn]: " + message + trace));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
8
90
|
var HoneybadgerVue = {
|
|
9
91
|
install: function install (Vue, options) {
|
|
10
|
-
var this$1 = this;
|
|
92
|
+
var this$1$1 = this;
|
|
11
93
|
|
|
12
94
|
if (Vue.config.debug) {
|
|
13
95
|
console.log(("Honeybadger configured with " + (options.apiKey)));
|
|
14
96
|
}
|
|
15
|
-
var honeybadger = Honeybadger__default[
|
|
97
|
+
var honeybadger = Honeybadger__default["default"].configure(options);
|
|
16
98
|
Vue.$honeybadger = honeybadger;
|
|
17
99
|
Vue.prototype.$honeybadger = Vue.$honeybadger;
|
|
18
100
|
var chainedErrorHandler = Vue.config.errorHandler;
|
|
19
101
|
var extractContext = function (vm) {
|
|
20
|
-
var options = typeof vm === 'function' && vm.cid != null
|
|
21
|
-
vm.
|
|
102
|
+
var options = typeof vm === 'function' && vm.cid != null
|
|
103
|
+
? vm.options
|
|
104
|
+
: vm._isVue
|
|
105
|
+
? vm.$options ||
|
|
106
|
+
vm.constructor.options
|
|
107
|
+
: vm || {};
|
|
22
108
|
var name = options.name || options._componentTag;
|
|
23
109
|
var file = options.__file;
|
|
24
110
|
return {
|
|
@@ -29,20 +115,34 @@ var HoneybadgerVue = (function (exports, Honeybadger) {
|
|
|
29
115
|
file: file
|
|
30
116
|
}
|
|
31
117
|
};
|
|
118
|
+
var shouldLogError = function () {
|
|
119
|
+
if (Vue.config.warnHandler) {
|
|
120
|
+
return true
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
var hasConsole = typeof console !== 'undefined';
|
|
124
|
+
var isDebug = Vue.config.debug || process.env.NODE_ENV !== 'production';
|
|
125
|
+
return hasConsole && isDebug
|
|
126
|
+
};
|
|
127
|
+
|
|
32
128
|
Vue.config.errorHandler = function (error, vm, info) {
|
|
33
129
|
honeybadger.notify(error, { context: { vm: extractContext(vm), info: info } });
|
|
34
130
|
if (typeof chainedErrorHandler === 'function') {
|
|
35
|
-
chainedErrorHandler.call(this$1.Vue, error, vm, info);
|
|
131
|
+
chainedErrorHandler.call(this$1$1.Vue, error, vm, info);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (shouldLogError()) {
|
|
135
|
+
logError(Vue, error, vm, info);
|
|
36
136
|
}
|
|
37
137
|
};
|
|
38
138
|
}
|
|
39
139
|
};
|
|
40
140
|
|
|
41
|
-
exports
|
|
141
|
+
exports["default"] = HoneybadgerVue;
|
|
42
142
|
|
|
43
143
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
44
144
|
|
|
45
145
|
return exports;
|
|
46
146
|
|
|
47
|
-
}({}, Honeybadger)
|
|
147
|
+
})({}, Honeybadger);
|
|
48
148
|
//# sourceMappingURL=honeybadger-vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"honeybadger-vue.js","sources":["../../src/index.js"],"sourcesContent":["import Honeybadger from '@honeybadger-io/js'\n\nconst HoneybadgerVue = {\n install (Vue, options) {\n if (Vue.config.debug) {\n console.log(`Honeybadger configured with ${options.apiKey}`)\n }\n const honeybadger = Honeybadger.configure(options)\n Vue.$honeybadger = honeybadger\n Vue.prototype.$honeybadger = Vue.$honeybadger\n const chainedErrorHandler = Vue.config.errorHandler\n const extractContext = function (vm) {\n
|
|
1
|
+
{"version":3,"file":"honeybadger-vue.js","sources":["../../src/vue-debug.js","../../src/error-logging.js","../../src/index.js"],"sourcesContent":["/**\n * This was taken from https://github.com/vuejs/vue/blob/master/src/core/util/debug.js.\n * The method generateStackTrace is used to log errors the same way as Vue logs them when errorHandler is not set.\n */\n\nconst classifyRE = /(?:^|[-_])(\\w)/g\nconst classify = str => str\n .replace(classifyRE, c => c.toUpperCase())\n .replace(/[-_]/g, '')\n\nconst formatComponentName = (vm, includeFile) => {\n if (vm.$root === vm) {\n return '<Root>'\n }\n const options = typeof vm === 'function' && vm.cid != null\n ? vm.options\n : vm._isVue\n ? vm.$options || vm.constructor.options\n : vm || {}\n let name = options.name || options._componentTag\n const file = options.__file\n if (!name && file) {\n const match = file.match(/([^/\\\\]+)\\.vue$/)\n name = match && match[1]\n }\n\n return (\n (name ? `<${classify(name)}>` : '<Anonymous>') +\n (file && includeFile !== false ? ` at ${file}` : '')\n )\n}\n\nconst repeat = (str, n) => {\n let res = ''\n while (n) {\n if (n % 2 === 1) res += str\n if (n > 1) str += str\n n >>= 1\n }\n return res\n}\n\nexport const generateComponentTrace = vm => {\n if (vm._isVue && vm.$parent) {\n const tree = []\n let currentRecursiveSequence = 0\n while (vm) {\n if (tree.length > 0) {\n const last = tree[tree.length - 1]\n if (last.constructor === vm.constructor) {\n currentRecursiveSequence++\n vm = vm.$parent\n continue\n } else if (currentRecursiveSequence > 0) {\n tree[tree.length - 1] = [last, currentRecursiveSequence]\n currentRecursiveSequence = 0\n }\n }\n tree.push(vm)\n vm = vm.$parent\n }\n return '\\n\\nfound in\\n\\n' + tree\n .map((vm, i) => `${\n i === 0 ? '---> ' : repeat(' ', 5 + i * 2)\n }${\n Array.isArray(vm)\n ? `${formatComponentName(vm[0])}... (${vm[1]} recursive calls)`\n : formatComponentName(vm)\n }`)\n .join('\\n')\n } else {\n return `\\n\\n(found in ${formatComponentName(vm)})`\n }\n}\n","import { generateComponentTrace } from './vue-debug'\n\nexport function logError (Vue, error, vm, info) {\n const message = `Error in ${info}: \"${error && error.toString()}\"`\n\n const trace = vm ? generateComponentTrace(vm) : ''\n if (Vue.config.warnHandler) {\n Vue.config.warnHandler.call(null, message, vm, trace)\n } else {\n console.error(`[Vue warn]: ${message}${trace}`)\n }\n}\n","import Honeybadger from '@honeybadger-io/js'\nimport { logError } from './error-logging'\n\nconst HoneybadgerVue = {\n install (Vue, options) {\n if (Vue.config.debug) {\n console.log(`Honeybadger configured with ${options.apiKey}`)\n }\n const honeybadger = Honeybadger.configure(options)\n Vue.$honeybadger = honeybadger\n Vue.prototype.$honeybadger = Vue.$honeybadger\n const chainedErrorHandler = Vue.config.errorHandler\n const extractContext = function (vm) {\n const options = typeof vm === 'function' && vm.cid != null\n ? vm.options\n : vm._isVue\n ? vm.$options ||\n vm.constructor.options\n : vm || {}\n const name = options.name || options._componentTag\n const file = options.__file\n return {\n isRoot: vm.$root === vm,\n name: name,\n props: options.propsData,\n parentVnodeTag: options._parentVnode ? options._parentVnode.tag : undefined,\n file: file\n }\n }\n const shouldLogError = () => {\n if (Vue.config.warnHandler) {\n return true\n }\n\n const hasConsole = typeof console !== 'undefined'\n const isDebug = Vue.config.debug || process.env.NODE_ENV !== 'production'\n return hasConsole && isDebug\n }\n\n Vue.config.errorHandler = (error, vm, info) => {\n honeybadger.notify(error, { context: { vm: extractContext(vm), info: info } })\n if (typeof chainedErrorHandler === 'function') {\n chainedErrorHandler.call(this.Vue, error, vm, info)\n }\n\n if (shouldLogError()) {\n logError(Vue, error, vm, info)\n }\n }\n }\n}\n\nexport default HoneybadgerVue\n"],"names":["const","let","Honeybadger","this"],"mappings":";;;;;;;EAAA;;;;;EAKAA,IAAM,UAAU,GAAG,kBAAiB;EACpCA,IAAM,QAAQ,aAAG,KAAI,SAAG,GAAG;KACxB,OAAO,CAAC,UAAU,YAAE,GAAE,SAAG,CAAC,CAAC,WAA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SACX;QACF;MACDA,IAAM,cAAc,eAAM;QACxB,IAAI,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE;UAC1B,OAAO,IAAI;SACZ;;QAEDA,IAAM,UAAU,GAAG,OAAO,OAAO,KAAK,YAAW;QACjDA,IAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAY;QACzE,OAAO,UAAU,IAAI,OAAO;QAC7B;;MAED,GAAG,CAAC,MAAM,CAAC,YAAY,aAAI,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE;QAC1C,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAC;QAC9E,IAAI,OAAO,mBAAmB,KAAK,UAAU,EAAE;UAC7C,mBAAmB,CAAC,IAAI,CAACG,QAAI,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAC;SACpD;;QAED,IAAI,cAAc,EAAE,EAAE;UACpB,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAC;SAC/B;QACF;KACF;;;;;;;;;;;;;"}
|
|
@@ -2,26 +2,112 @@
|
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@honeybadger-io/js')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', '@honeybadger-io/js'], factory) :
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.HoneybadgerVue = {}, global.Honeybadger));
|
|
5
|
-
}(this, (function (exports, Honeybadger) { 'use strict';
|
|
5
|
+
})(this, (function (exports, Honeybadger) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
9
|
var Honeybadger__default = /*#__PURE__*/_interopDefaultLegacy(Honeybadger);
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* This was taken from https://github.com/vuejs/vue/blob/master/src/core/util/debug.js.
|
|
13
|
+
* The method generateStackTrace is used to log errors the same way as Vue logs them when errorHandler is not set.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
var classifyRE = /(?:^|[-_])(\w)/g;
|
|
17
|
+
var classify = function (str) { return str
|
|
18
|
+
.replace(classifyRE, function (c) { return c.toUpperCase(); })
|
|
19
|
+
.replace(/[-_]/g, ''); };
|
|
20
|
+
|
|
21
|
+
var formatComponentName = function (vm, includeFile) {
|
|
22
|
+
if (vm.$root === vm) {
|
|
23
|
+
return '<Root>'
|
|
24
|
+
}
|
|
25
|
+
var options = typeof vm === 'function' && vm.cid != null
|
|
26
|
+
? vm.options
|
|
27
|
+
: vm._isVue
|
|
28
|
+
? vm.$options || vm.constructor.options
|
|
29
|
+
: vm || {};
|
|
30
|
+
var name = options.name || options._componentTag;
|
|
31
|
+
var file = options.__file;
|
|
32
|
+
if (!name && file) {
|
|
33
|
+
var match = file.match(/([^/\\]+)\.vue$/);
|
|
34
|
+
name = match && match[1];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
(name ? ("<" + (classify(name)) + ">") : '<Anonymous>') +
|
|
39
|
+
(file && includeFile !== false ? (" at " + file) : '')
|
|
40
|
+
)
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
var repeat = function (str, n) {
|
|
44
|
+
var res = '';
|
|
45
|
+
while (n) {
|
|
46
|
+
if (n % 2 === 1) { res += str; }
|
|
47
|
+
if (n > 1) { str += str; }
|
|
48
|
+
n >>= 1;
|
|
49
|
+
}
|
|
50
|
+
return res
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var generateComponentTrace = function (vm) {
|
|
54
|
+
if (vm._isVue && vm.$parent) {
|
|
55
|
+
var tree = [];
|
|
56
|
+
var currentRecursiveSequence = 0;
|
|
57
|
+
while (vm) {
|
|
58
|
+
if (tree.length > 0) {
|
|
59
|
+
var last = tree[tree.length - 1];
|
|
60
|
+
if (last.constructor === vm.constructor) {
|
|
61
|
+
currentRecursiveSequence++;
|
|
62
|
+
vm = vm.$parent;
|
|
63
|
+
continue
|
|
64
|
+
} else if (currentRecursiveSequence > 0) {
|
|
65
|
+
tree[tree.length - 1] = [last, currentRecursiveSequence];
|
|
66
|
+
currentRecursiveSequence = 0;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
tree.push(vm);
|
|
70
|
+
vm = vm.$parent;
|
|
71
|
+
}
|
|
72
|
+
return '\n\nfound in\n\n' + tree
|
|
73
|
+
.map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
|
|
74
|
+
? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
|
|
75
|
+
: formatComponentName(vm))); })
|
|
76
|
+
.join('\n')
|
|
77
|
+
} else {
|
|
78
|
+
return ("\n\n(found in " + (formatComponentName(vm)) + ")")
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
function logError (Vue, error, vm, info) {
|
|
83
|
+
var message = "Error in " + info + ": \"" + (error && error.toString()) + "\"";
|
|
84
|
+
|
|
85
|
+
var trace = vm ? generateComponentTrace(vm) : '';
|
|
86
|
+
if (Vue.config.warnHandler) {
|
|
87
|
+
Vue.config.warnHandler.call(null, message, vm, trace);
|
|
88
|
+
} else {
|
|
89
|
+
console.error(("[Vue warn]: " + message + trace));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
11
93
|
var HoneybadgerVue = {
|
|
12
94
|
install: function install (Vue, options) {
|
|
13
|
-
var this$1 = this;
|
|
95
|
+
var this$1$1 = this;
|
|
14
96
|
|
|
15
97
|
if (Vue.config.debug) {
|
|
16
98
|
console.log(("Honeybadger configured with " + (options.apiKey)));
|
|
17
99
|
}
|
|
18
|
-
var honeybadger = Honeybadger__default[
|
|
100
|
+
var honeybadger = Honeybadger__default["default"].configure(options);
|
|
19
101
|
Vue.$honeybadger = honeybadger;
|
|
20
102
|
Vue.prototype.$honeybadger = Vue.$honeybadger;
|
|
21
103
|
var chainedErrorHandler = Vue.config.errorHandler;
|
|
22
104
|
var extractContext = function (vm) {
|
|
23
|
-
var options = typeof vm === 'function' && vm.cid != null
|
|
24
|
-
vm.
|
|
105
|
+
var options = typeof vm === 'function' && vm.cid != null
|
|
106
|
+
? vm.options
|
|
107
|
+
: vm._isVue
|
|
108
|
+
? vm.$options ||
|
|
109
|
+
vm.constructor.options
|
|
110
|
+
: vm || {};
|
|
25
111
|
var name = options.name || options._componentTag;
|
|
26
112
|
var file = options.__file;
|
|
27
113
|
return {
|
|
@@ -32,18 +118,32 @@
|
|
|
32
118
|
file: file
|
|
33
119
|
}
|
|
34
120
|
};
|
|
121
|
+
var shouldLogError = function () {
|
|
122
|
+
if (Vue.config.warnHandler) {
|
|
123
|
+
return true
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
var hasConsole = typeof console !== 'undefined';
|
|
127
|
+
var isDebug = Vue.config.debug || process.env.NODE_ENV !== 'production';
|
|
128
|
+
return hasConsole && isDebug
|
|
129
|
+
};
|
|
130
|
+
|
|
35
131
|
Vue.config.errorHandler = function (error, vm, info) {
|
|
36
132
|
honeybadger.notify(error, { context: { vm: extractContext(vm), info: info } });
|
|
37
133
|
if (typeof chainedErrorHandler === 'function') {
|
|
38
|
-
chainedErrorHandler.call(this$1.Vue, error, vm, info);
|
|
134
|
+
chainedErrorHandler.call(this$1$1.Vue, error, vm, info);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (shouldLogError()) {
|
|
138
|
+
logError(Vue, error, vm, info);
|
|
39
139
|
}
|
|
40
140
|
};
|
|
41
141
|
}
|
|
42
142
|
};
|
|
43
143
|
|
|
44
|
-
exports
|
|
144
|
+
exports["default"] = HoneybadgerVue;
|
|
45
145
|
|
|
46
146
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
47
147
|
|
|
48
|
-
}))
|
|
148
|
+
}));
|
|
49
149
|
//# sourceMappingURL=honeybadger-vue.umd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"honeybadger-vue.umd.js","sources":["../../src/index.js"],"sourcesContent":["import Honeybadger from '@honeybadger-io/js'\n\nconst HoneybadgerVue = {\n install (Vue, options) {\n if (Vue.config.debug) {\n console.log(`Honeybadger configured with ${options.apiKey}`)\n }\n const honeybadger = Honeybadger.configure(options)\n Vue.$honeybadger = honeybadger\n Vue.prototype.$honeybadger = Vue.$honeybadger\n const chainedErrorHandler = Vue.config.errorHandler\n const extractContext = function (vm) {\n
|
|
1
|
+
{"version":3,"file":"honeybadger-vue.umd.js","sources":["../../src/vue-debug.js","../../src/error-logging.js","../../src/index.js"],"sourcesContent":["/**\n * This was taken from https://github.com/vuejs/vue/blob/master/src/core/util/debug.js.\n * The method generateStackTrace is used to log errors the same way as Vue logs them when errorHandler is not set.\n */\n\nconst classifyRE = /(?:^|[-_])(\\w)/g\nconst classify = str => str\n .replace(classifyRE, c => c.toUpperCase())\n .replace(/[-_]/g, '')\n\nconst formatComponentName = (vm, includeFile) => {\n if (vm.$root === vm) {\n return '<Root>'\n }\n const options = typeof vm === 'function' && vm.cid != null\n ? vm.options\n : vm._isVue\n ? vm.$options || vm.constructor.options\n : vm || {}\n let name = options.name || options._componentTag\n const file = options.__file\n if (!name && file) {\n const match = file.match(/([^/\\\\]+)\\.vue$/)\n name = match && match[1]\n }\n\n return (\n (name ? `<${classify(name)}>` : '<Anonymous>') +\n (file && includeFile !== false ? ` at ${file}` : '')\n )\n}\n\nconst repeat = (str, n) => {\n let res = ''\n while (n) {\n if (n % 2 === 1) res += str\n if (n > 1) str += str\n n >>= 1\n }\n return res\n}\n\nexport const generateComponentTrace = vm => {\n if (vm._isVue && vm.$parent) {\n const tree = []\n let currentRecursiveSequence = 0\n while (vm) {\n if (tree.length > 0) {\n const last = tree[tree.length - 1]\n if (last.constructor === vm.constructor) {\n currentRecursiveSequence++\n vm = vm.$parent\n continue\n } else if (currentRecursiveSequence > 0) {\n tree[tree.length - 1] = [last, currentRecursiveSequence]\n currentRecursiveSequence = 0\n }\n }\n tree.push(vm)\n vm = vm.$parent\n }\n return '\\n\\nfound in\\n\\n' + tree\n .map((vm, i) => `${\n i === 0 ? '---> ' : repeat(' ', 5 + i * 2)\n }${\n Array.isArray(vm)\n ? `${formatComponentName(vm[0])}... (${vm[1]} recursive calls)`\n : formatComponentName(vm)\n }`)\n .join('\\n')\n } else {\n return `\\n\\n(found in ${formatComponentName(vm)})`\n }\n}\n","import { generateComponentTrace } from './vue-debug'\n\nexport function logError (Vue, error, vm, info) {\n const message = `Error in ${info}: \"${error && error.toString()}\"`\n\n const trace = vm ? generateComponentTrace(vm) : ''\n if (Vue.config.warnHandler) {\n Vue.config.warnHandler.call(null, message, vm, trace)\n } else {\n console.error(`[Vue warn]: ${message}${trace}`)\n }\n}\n","import Honeybadger from '@honeybadger-io/js'\nimport { logError } from './error-logging'\n\nconst HoneybadgerVue = {\n install (Vue, options) {\n if (Vue.config.debug) {\n console.log(`Honeybadger configured with ${options.apiKey}`)\n }\n const honeybadger = Honeybadger.configure(options)\n Vue.$honeybadger = honeybadger\n Vue.prototype.$honeybadger = Vue.$honeybadger\n const chainedErrorHandler = Vue.config.errorHandler\n const extractContext = function (vm) {\n const options = typeof vm === 'function' && vm.cid != null\n ? vm.options\n : vm._isVue\n ? vm.$options ||\n vm.constructor.options\n : vm || {}\n const name = options.name || options._componentTag\n const file = options.__file\n return {\n isRoot: vm.$root === vm,\n name: name,\n props: options.propsData,\n parentVnodeTag: options._parentVnode ? options._parentVnode.tag : undefined,\n file: file\n }\n }\n const shouldLogError = () => {\n if (Vue.config.warnHandler) {\n return true\n }\n\n const hasConsole = typeof console !== 'undefined'\n const isDebug = Vue.config.debug || process.env.NODE_ENV !== 'production'\n return hasConsole && isDebug\n }\n\n Vue.config.errorHandler = (error, vm, info) => {\n honeybadger.notify(error, { context: { vm: extractContext(vm), info: info } })\n if (typeof chainedErrorHandler === 'function') {\n chainedErrorHandler.call(this.Vue, error, vm, info)\n }\n\n if (shouldLogError()) {\n logError(Vue, error, vm, info)\n }\n }\n }\n}\n\nexport default HoneybadgerVue\n"],"names":["const","let","Honeybadger","this"],"mappings":";;;;;;;;;;EAAA;;;;;EAKAA,IAAM,UAAU,GAAG,kBAAiB;EACpCA,IAAM,QAAQ,aAAG,KAAI,SAAG,GAAG;KACxB,OAAO,CAAC,UAAU,YAAE,GAAE,SAAG,CAAC,CAAC,WAAW,KAAE,CAAC;KACzC,OAAO,CAAC,OAAO,EAAE,EAAE,KAAC;;EAEvBA,IAAM,mBAAmB,aAAI,EAAE,EAAE,WAAW,EAAE;IAC5C,IAAI,EAAE,CAAC,KAAK,KAAK,EAAE,EAAE;MACnB,OAAO,QAAQ;KAChB;IACDA,IAAM,OAAO,GAAG,OAAO,EAAE,KAAK,UAAU,IAAI,EAAE,CAAC,GAAG,IAAI,IAAI;QACtD,EAAE,CAAC,OAAO;QACV,EAAE,CAAC,MAAM;UACP,EAAE,CAAC,QAAQ,IAAI,EAAE,CAAC,WAAW,CAAC,OAAO;UACrC,EAAE,IAAI,GAAE;IACdC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,cAAa;IAChDD,IAAM,IAAI,GAAG,OAAO,CAAC,OAAM;IAC3B,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE;MACjBA,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAC;MAC3C,IAAI,GAAG,KAAK,IAAI,KAAK,CAAC,CAAC,EAAC;KACzB;;IAED;MACE,CAAC,IAAI,WAAO,QAAQ,CAAC,IAAI,EAAC,UAAM,aAAa;OAC5C,IAAI,IAAI,WAAW,KAAK,KAAK,aAAU,IAAI,IAAK,EAAE,CAAC;KACrD;IACF;;EAEDA,IA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-1,24 +1,17 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
import _Vue from 'vue'
|
|
4
|
-
import Honeybadger from '@honeybadger-io/js';
|
|
1
|
+
// Type definitions for honeybadger.js vue integration
|
|
2
|
+
// Project: https://github.com/honeybadger-io/honeybadger-vue
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
setContext<T extends object>(context: T): typeof Honeybadger;
|
|
9
|
-
resetContext(): typeof Honeybadger;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
declare module '@honeybadger-io/vue' {
|
|
13
|
-
const HoneybadgerVue: {
|
|
14
|
-
install(app: App | typeof _Vue, options?: any): void
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default HoneybadgerVue;
|
|
18
|
-
}
|
|
4
|
+
import Vue from 'vue'
|
|
5
|
+
import * as Honeybadger from '@honeybadger-io/js'
|
|
19
6
|
|
|
20
7
|
declare module 'vue/types/vue' {
|
|
21
8
|
interface Vue {
|
|
22
|
-
$honeybadger:
|
|
9
|
+
$honeybadger: typeof Honeybadger
|
|
23
10
|
}
|
|
24
11
|
}
|
|
12
|
+
|
|
13
|
+
declare const HoneybadgerVue: {
|
|
14
|
+
install(app: typeof Vue, options?: any): void
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default HoneybadgerVue
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@honeybadger-io/vue",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Honeybadger Vue.js client",
|
|
6
6
|
"author": "Jason Truesdell <jason@yuzuten.com> (https://github.com/JasonTrue)",
|
|
@@ -28,10 +28,11 @@
|
|
|
28
28
|
"scripts": {
|
|
29
29
|
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
|
|
30
30
|
"start": "npm run dev",
|
|
31
|
-
"unit": "jest --config test/unit/jest.conf.js --coverage
|
|
31
|
+
"unit": "jest --config test/unit/jest.conf.js --coverage",
|
|
32
32
|
"e2e": "node test/e2e/runner.js",
|
|
33
|
+
"tsd": "npx tsd",
|
|
33
34
|
"test": "npm run unit",
|
|
34
|
-
"test:all": "npm run unit && npm run e2e",
|
|
35
|
+
"test:all": "npm run tsd && npm run unit && npm run e2e",
|
|
35
36
|
"lint": "eslint --ext .js,.vue src test/unit test/e2e/specs",
|
|
36
37
|
"build": "npm run build:umd & npm run build:es & npm run build:unpkg",
|
|
37
38
|
"build:umd": "rollup --config build/rollup.config.js --format umd --file dist/honeybadger-vue.umd.js",
|
|
@@ -44,82 +45,84 @@
|
|
|
44
45
|
"prepublishOnly": "npm run build && npm test"
|
|
45
46
|
},
|
|
46
47
|
"dependencies": {
|
|
47
|
-
"@honeybadger-io/js": "^3.
|
|
48
|
+
"@honeybadger-io/js": "^3.2.7"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
|
-
"@babel/core": "^7.12
|
|
51
|
-
"@babel/helper-module-imports": "^7.
|
|
52
|
-
"@babel/plugin-syntax-jsx": "^7.
|
|
53
|
-
"@babel/plugin-transform-modules-commonjs": "^7.
|
|
54
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
55
|
-
"@babel/preset-env": "^7.
|
|
56
|
-
"@babel/register": "^7.
|
|
57
|
-
"@babel/runtime": "^7.
|
|
58
|
-
"@vue/runtime-core": "^3.
|
|
59
|
-
"ajv": "^
|
|
60
|
-
"autoprefixer": "^10.2
|
|
51
|
+
"@babel/core": "^7.16.12",
|
|
52
|
+
"@babel/helper-module-imports": "^7.16.7",
|
|
53
|
+
"@babel/plugin-syntax-jsx": "^7.16.7",
|
|
54
|
+
"@babel/plugin-transform-modules-commonjs": "^7.16.8",
|
|
55
|
+
"@babel/plugin-transform-runtime": "^7.16.10",
|
|
56
|
+
"@babel/preset-env": "^7.16.11",
|
|
57
|
+
"@babel/register": "^7.16.9",
|
|
58
|
+
"@babel/runtime": "^7.16.7",
|
|
59
|
+
"@vue/runtime-core": "^3.2.29",
|
|
60
|
+
"ajv": "^8.9.0",
|
|
61
|
+
"autoprefixer": "^10.4.2",
|
|
61
62
|
"babel-core": "^7.0.0-bridge.0",
|
|
62
63
|
"babel-eslint": "^10.1.0",
|
|
63
64
|
"babel-helper-vue-jsx-merge-props": "^2.0.3",
|
|
64
|
-
"babel-jest": "^
|
|
65
|
-
"babel-loader": "^8.
|
|
65
|
+
"babel-jest": "^27.4.6",
|
|
66
|
+
"babel-loader": "^8.2.3",
|
|
66
67
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
67
68
|
"babel-plugin-transform-vue-jsx": "^4.0.1",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
69
|
+
"browser-resolve": "^2.0.0",
|
|
70
|
+
"chalk": "^5.0.0",
|
|
71
|
+
"chromedriver": "^99.0.0",
|
|
72
|
+
"copy-webpack-plugin": "^10.2.3",
|
|
71
73
|
"cross-spawn": "^7.0.2",
|
|
72
|
-
"css-loader": "^5.
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"eslint
|
|
74
|
+
"css-loader": "^6.5.1",
|
|
75
|
+
"css-minimizer-webpack-plugin": "^3.4.1",
|
|
76
|
+
"dotenv": "^16.0.0",
|
|
77
|
+
"eslint": "^8.8.0",
|
|
78
|
+
"eslint-config-standard": "^16.0.3",
|
|
76
79
|
"eslint-friendly-formatter": "^4.0.1",
|
|
77
80
|
"eslint-loader": "^4.0.1",
|
|
78
|
-
"eslint-plugin-import": "^2.
|
|
81
|
+
"eslint-plugin-import": "^2.25.4",
|
|
79
82
|
"eslint-plugin-node": "^11.1.0",
|
|
80
|
-
"eslint-plugin-promise": "^
|
|
83
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
81
84
|
"eslint-plugin-standard": "^5.0.0",
|
|
82
|
-
"eslint-plugin-vue": "^
|
|
85
|
+
"eslint-plugin-vue": "^8.4.0",
|
|
83
86
|
"file-loader": "^6.0.0",
|
|
84
87
|
"friendly-errors-webpack-plugin": "^1.7.0",
|
|
85
|
-
"html-webpack-plugin": "^5.
|
|
88
|
+
"html-webpack-plugin": "^5.5.0",
|
|
86
89
|
"interactive": "^0.1.9",
|
|
87
|
-
"jest": "^
|
|
90
|
+
"jest": "^27.4.7",
|
|
88
91
|
"jest-serializer-vue": "^2.0.2",
|
|
89
|
-
"mini-css-extract-plugin": "^
|
|
90
|
-
"nightwatch": "^
|
|
92
|
+
"mini-css-extract-plugin": "^2.5.3",
|
|
93
|
+
"nightwatch": "^2.0.2",
|
|
91
94
|
"nightwatch-xhr": "^0.4.7",
|
|
92
|
-
"node-notifier": "^
|
|
93
|
-
"
|
|
94
|
-
"ora": "^5.0.0",
|
|
95
|
+
"node-notifier": "^10.0.0",
|
|
96
|
+
"ora": "^6.1.0",
|
|
95
97
|
"portfinder": "^1.0.13",
|
|
96
|
-
"postcss": "^8.
|
|
97
|
-
"postcss-import": "^14.0.
|
|
98
|
-
"postcss-loader": "^
|
|
99
|
-
"postcss-url": "^10.
|
|
98
|
+
"postcss": "^8.4.5",
|
|
99
|
+
"postcss-import": "^14.0.2",
|
|
100
|
+
"postcss-loader": "^6.2.1",
|
|
101
|
+
"postcss-url": "^10.1.3",
|
|
100
102
|
"rimraf": "^3.0.2",
|
|
101
|
-
"rollup": "^2.
|
|
103
|
+
"rollup": "^2.66.1",
|
|
102
104
|
"rollup-plugin-buble": "^0.19.4",
|
|
103
105
|
"rollup-plugin-conditional": "^3.1.2",
|
|
104
106
|
"rollup-plugin-terser": "^7.0.0",
|
|
105
107
|
"rollup-plugin-vue": "^5.1.6",
|
|
106
108
|
"selenium-server": "^3.0.1",
|
|
107
109
|
"semver": "^7.3.2",
|
|
108
|
-
"shelljs": "^0.8.
|
|
109
|
-
"sinon": "^
|
|
110
|
-
"terser-webpack-plugin": "^5.
|
|
110
|
+
"shelljs": "^0.8.5",
|
|
111
|
+
"sinon": "^13.0.1",
|
|
112
|
+
"terser-webpack-plugin": "^5.3.0",
|
|
113
|
+
"tsd": "^0.19.1",
|
|
111
114
|
"url-loader": "^4.1.0",
|
|
112
|
-
"vue": "^2.
|
|
115
|
+
"vue": "^2.6.14",
|
|
113
116
|
"vue-jest": "^3.0.5",
|
|
114
|
-
"vue-loader": "^
|
|
115
|
-
"vue-style-loader": "^4.1.
|
|
116
|
-
"vue-template-compiler": "^2.
|
|
117
|
-
"webpack": "^5.
|
|
118
|
-
"webpack-bundle-analyzer": "^4.
|
|
119
|
-
"webpack-cli": "^4.
|
|
120
|
-
"webpack-dev-server": "^
|
|
121
|
-
"webpack-merge": "^5.0
|
|
122
|
-
"winston": "^3.
|
|
117
|
+
"vue-loader": "^17.0.0",
|
|
118
|
+
"vue-style-loader": "^4.1.3",
|
|
119
|
+
"vue-template-compiler": "^2.6.14",
|
|
120
|
+
"webpack": "^5.67.0",
|
|
121
|
+
"webpack-bundle-analyzer": "^4.5.0",
|
|
122
|
+
"webpack-cli": "^4.9.2",
|
|
123
|
+
"webpack-dev-server": "^4.7.3",
|
|
124
|
+
"webpack-merge": "^5.8.0",
|
|
125
|
+
"winston": "^3.5.0"
|
|
123
126
|
},
|
|
124
127
|
"engines": {
|
|
125
128
|
"node": ">= 6.0.0",
|
|
@@ -141,5 +144,12 @@
|
|
|
141
144
|
"https-proxy-agent": "^2.2.1",
|
|
142
145
|
"socks-proxy-agent": "^4.0.1"
|
|
143
146
|
},
|
|
144
|
-
"types": "./honeybadger-vue.d.ts"
|
|
147
|
+
"types": "./honeybadger-vue.d.ts",
|
|
148
|
+
"tsd": {
|
|
149
|
+
"compilerOptions": {
|
|
150
|
+
"lib": [
|
|
151
|
+
"DOM"
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
}
|
|
145
155
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { generateComponentTrace } from './vue-debug'
|
|
2
|
+
|
|
3
|
+
export function logError (Vue, error, vm, info) {
|
|
4
|
+
const message = `Error in ${info}: "${error && error.toString()}"`
|
|
5
|
+
|
|
6
|
+
const trace = vm ? generateComponentTrace(vm) : ''
|
|
7
|
+
if (Vue.config.warnHandler) {
|
|
8
|
+
Vue.config.warnHandler.call(null, message, vm, trace)
|
|
9
|
+
} else {
|
|
10
|
+
console.error(`[Vue warn]: ${message}${trace}`)
|
|
11
|
+
}
|
|
12
|
+
}
|
package/src/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Honeybadger from '@honeybadger-io/js'
|
|
2
|
+
import { logError } from './error-logging'
|
|
2
3
|
|
|
3
4
|
const HoneybadgerVue = {
|
|
4
5
|
install (Vue, options) {
|
|
@@ -10,10 +11,14 @@ const HoneybadgerVue = {
|
|
|
10
11
|
Vue.prototype.$honeybadger = Vue.$honeybadger
|
|
11
12
|
const chainedErrorHandler = Vue.config.errorHandler
|
|
12
13
|
const extractContext = function (vm) {
|
|
13
|
-
|
|
14
|
-
vm.
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const options = typeof vm === 'function' && vm.cid != null
|
|
15
|
+
? vm.options
|
|
16
|
+
: vm._isVue
|
|
17
|
+
? vm.$options ||
|
|
18
|
+
vm.constructor.options
|
|
19
|
+
: vm || {}
|
|
20
|
+
const name = options.name || options._componentTag
|
|
21
|
+
const file = options.__file
|
|
17
22
|
return {
|
|
18
23
|
isRoot: vm.$root === vm,
|
|
19
24
|
name: name,
|
|
@@ -22,11 +27,25 @@ const HoneybadgerVue = {
|
|
|
22
27
|
file: file
|
|
23
28
|
}
|
|
24
29
|
}
|
|
30
|
+
const shouldLogError = () => {
|
|
31
|
+
if (Vue.config.warnHandler) {
|
|
32
|
+
return true
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const hasConsole = typeof console !== 'undefined'
|
|
36
|
+
const isDebug = Vue.config.debug || process.env.NODE_ENV !== 'production'
|
|
37
|
+
return hasConsole && isDebug
|
|
38
|
+
}
|
|
39
|
+
|
|
25
40
|
Vue.config.errorHandler = (error, vm, info) => {
|
|
26
41
|
honeybadger.notify(error, { context: { vm: extractContext(vm), info: info } })
|
|
27
42
|
if (typeof chainedErrorHandler === 'function') {
|
|
28
43
|
chainedErrorHandler.call(this.Vue, error, vm, info)
|
|
29
44
|
}
|
|
45
|
+
|
|
46
|
+
if (shouldLogError()) {
|
|
47
|
+
logError(Vue, error, vm, info)
|
|
48
|
+
}
|
|
30
49
|
}
|
|
31
50
|
}
|
|
32
51
|
}
|
package/src/vue-debug.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This was taken from https://github.com/vuejs/vue/blob/master/src/core/util/debug.js.
|
|
3
|
+
* The method generateStackTrace is used to log errors the same way as Vue logs them when errorHandler is not set.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const classifyRE = /(?:^|[-_])(\w)/g
|
|
7
|
+
const classify = str => str
|
|
8
|
+
.replace(classifyRE, c => c.toUpperCase())
|
|
9
|
+
.replace(/[-_]/g, '')
|
|
10
|
+
|
|
11
|
+
const formatComponentName = (vm, includeFile) => {
|
|
12
|
+
if (vm.$root === vm) {
|
|
13
|
+
return '<Root>'
|
|
14
|
+
}
|
|
15
|
+
const options = typeof vm === 'function' && vm.cid != null
|
|
16
|
+
? vm.options
|
|
17
|
+
: vm._isVue
|
|
18
|
+
? vm.$options || vm.constructor.options
|
|
19
|
+
: vm || {}
|
|
20
|
+
let name = options.name || options._componentTag
|
|
21
|
+
const file = options.__file
|
|
22
|
+
if (!name && file) {
|
|
23
|
+
const match = file.match(/([^/\\]+)\.vue$/)
|
|
24
|
+
name = match && match[1]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
(name ? `<${classify(name)}>` : '<Anonymous>') +
|
|
29
|
+
(file && includeFile !== false ? ` at ${file}` : '')
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const repeat = (str, n) => {
|
|
34
|
+
let res = ''
|
|
35
|
+
while (n) {
|
|
36
|
+
if (n % 2 === 1) res += str
|
|
37
|
+
if (n > 1) str += str
|
|
38
|
+
n >>= 1
|
|
39
|
+
}
|
|
40
|
+
return res
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const generateComponentTrace = vm => {
|
|
44
|
+
if (vm._isVue && vm.$parent) {
|
|
45
|
+
const tree = []
|
|
46
|
+
let currentRecursiveSequence = 0
|
|
47
|
+
while (vm) {
|
|
48
|
+
if (tree.length > 0) {
|
|
49
|
+
const last = tree[tree.length - 1]
|
|
50
|
+
if (last.constructor === vm.constructor) {
|
|
51
|
+
currentRecursiveSequence++
|
|
52
|
+
vm = vm.$parent
|
|
53
|
+
continue
|
|
54
|
+
} else if (currentRecursiveSequence > 0) {
|
|
55
|
+
tree[tree.length - 1] = [last, currentRecursiveSequence]
|
|
56
|
+
currentRecursiveSequence = 0
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
tree.push(vm)
|
|
60
|
+
vm = vm.$parent
|
|
61
|
+
}
|
|
62
|
+
return '\n\nfound in\n\n' + tree
|
|
63
|
+
.map((vm, i) => `${
|
|
64
|
+
i === 0 ? '---> ' : repeat(' ', 5 + i * 2)
|
|
65
|
+
}${
|
|
66
|
+
Array.isArray(vm)
|
|
67
|
+
? `${formatComponentName(vm[0])}... (${vm[1]} recursive calls)`
|
|
68
|
+
: formatComponentName(vm)
|
|
69
|
+
}`)
|
|
70
|
+
.join('\n')
|
|
71
|
+
} else {
|
|
72
|
+
return `\n\n(found in ${formatComponentName(vm)})`
|
|
73
|
+
}
|
|
74
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
All notable changes to this project will be documented in this file.
|
|
3
|
-
|
|
4
|
-
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
|
-
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
|
-
|
|
7
|
-
## [Unreleased]
|
|
8
|
-
|
|
9
|
-
## [1.0.1] - 2021-02-17
|
|
10
|
-
|
|
11
|
-
### Fixed
|
|
12
|
-
- Add a module export with an `install` function. This fixes builds in newer Vue apps written in TypeScript
|
|
13
|
-
- Add `@vue/runtime-core` for being able to import `App` type for correct type information on the install function
|
|
14
|
-
|
|
15
|
-
## [1.0.0] - 2021-01-19
|
|
16
|
-
### Changed
|
|
17
|
-
- Migrate honeybadger-js dependency to @honeybadger-io/js 3.0.0
|
|
18
|
-
See https://docs.honeybadger.io/lib/javascript/support/upgrading-to-v3.html
|
|
19
|
-
|
|
20
|
-
## [0.0.12] - 2020-09-24
|
|
21
|
-
### Fixed
|
|
22
|
-
- Bump honeybadger-js version
|
|
23
|
-
- Import `Honeybadger` in TypeScript definitions file (fixes potential missing
|
|
24
|
-
name error).
|
|
25
|
-
|
|
26
|
-
## [0.0.11] - 2020-04-24
|
|
27
|
-
### Fixed
|
|
28
|
-
- Update honeybadger-js to 2.2.1 (security release, see
|
|
29
|
-
[here](https://github.com/honeybadger-io/honeybadger-js/blob/master/CHANGELOG.md#220---2020-03-16))
|
|
30
|
-
|
|
31
|
-
## [0.0.10] - 2020-01-08
|
|
32
|
-
### Fixed
|
|
33
|
-
- Fix TypeScript type definitions
|
|
34
|
-
|
|
35
|
-
## [0.0.9] - 2019-12-18
|
|
36
|
-
### Fixed
|
|
37
|
-
- Deps & security updates
|
|
38
|
-
- TypeScript definitions
|
|
39
|
-
|
|
40
|
-
## [0.0.8] - 2019-05-28
|
|
41
|
-
### Fixed
|
|
42
|
-
- Added missing dist/ directory to release
|
|
43
|
-
|
|
44
|
-
## [0.0.7] - 2019-04-16
|
|
45
|
-
### Changed
|
|
46
|
-
- Refactored tests to include debug mode output
|
|
47
|
-
- Changed the debug output based on Vue debug mode
|
|
48
|
-
- Update honeybadger-js to v1.0. See
|
|
49
|
-
https://github.com/honeybadger-io/honeybadger-js/blob/master/CHANGELOG.md
|
|
50
|
-
|
|
51
|
-
## [0.0.6] - 2018-12-08
|
|
52
|
-
### Added
|
|
53
|
-
- Reduced size of context information sent to Notify
|
|
54
|
-
- We now send the props value to honeybadger
|
|
55
|
-
|
|
56
|
-
## [0.0.5] - 2018-12-07
|
|
57
|
-
### Added
|
|
58
|
-
- Dependency updates, additional documentation changes
|
|
59
|
-
|
|
60
|
-
## [0.0.4] - 2018-11-07
|
|
61
|
-
### Added
|
|
62
|
-
- Minor changes in Readme and travis configuration (no code changes)
|
|
63
|
-
|
|
64
|
-
## [0.0.3] - 2018-11-06
|
|
65
|
-
### Added
|
|
66
|
-
- Switch to yarn-based package lock
|
|
67
|
-
|
|
68
|
-
## [0.0.2] - 2018-11-06
|
|
69
|
-
### Added
|
|
70
|
-
- Added src folder to published artifact
|
|
71
|
-
|
|
72
|
-
## [0.0.1] - 2018-11-06
|
|
73
|
-
### Added
|
|
74
|
-
- Initial release (unpublished due to missing artifacts)
|