@honeybadger-io/vue 1.1.0 → 3.1.0

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 CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  For comprehensive documentation and support, [check out our documentation site](https://docs.honeybadger.io/lib/javascript/index.html).
11
11
 
12
- The documentation includes a detailed [Vue integration guide](https://docs.honeybadger.io/lib/javascript/integration/vue2.html)
12
+ The documentation includes a detailed [Vue integration guide](https://docs.honeybadger.io/lib/javascript/integration/vue3.html)
13
13
 
14
14
  ## Project Goals
15
15
 
@@ -87,10 +87,14 @@ To perform a release:
87
87
 
88
88
  1. With a clean working tree, use `npm version [new version]` to bump the version, commit the
89
89
  changes, tag the release, and push to GitHub. See `npm help version` for
90
- documentation.
90
+ documentation. Make sure to checkout the correct branch (i.e. if you are planning to release a version with other than `latest` dist tag).
91
+
91
92
 
92
93
  2. To publish the release, use `npm publish`. See `npm help publish` for
93
- documentation.
94
+ documentation. This command will publish the version with the `latest` tag. To publish with a different tag, i.e. `next`, use `npm publish --tag next`.
95
+
96
+
97
+ 3. Verify the published version in Versions tab from [here](https://www.npmjs.com/package/@honeybadger-io/vue).
94
98
 
95
99
  ### Release Automation
96
100
 
@@ -71,67 +71,62 @@ var generateComponentTrace = function (vm) {
71
71
  }
72
72
  };
73
73
 
74
- function logError (Vue, error, vm, info) {
74
+ function logError (app, error, vm, info) {
75
75
  var message = "Error in " + info + ": \"" + (error && error.toString()) + "\"";
76
76
 
77
77
  var trace = vm ? generateComponentTrace(vm) : '';
78
- if (Vue.config.warnHandler) {
79
- Vue.config.warnHandler.call(null, message, vm, trace);
78
+ if (app.config.warnHandler) {
79
+ app.config.warnHandler.call(null, message, vm, trace);
80
80
  } else {
81
81
  console.error(("[Vue warn]: " + message + trace));
82
82
  }
83
83
  }
84
84
 
85
85
  var HoneybadgerVue = {
86
- install: function install (Vue, options) {
87
- var this$1$1 = this;
88
-
89
- if (Vue.config.debug) {
86
+ install: function install (app, options) {
87
+ if (app.config.debug) {
90
88
  console.log(("Honeybadger configured with " + (options.apiKey)));
91
89
  }
92
90
  var honeybadger = Honeybadger.configure(options);
93
- Vue.$honeybadger = honeybadger;
94
- Vue.prototype.$honeybadger = Vue.$honeybadger;
95
- var chainedErrorHandler = Vue.config.errorHandler;
96
- var extractContext = function (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 || {};
103
- var name = options.name || options._componentTag;
104
- var file = options.__file;
105
- return {
106
- isRoot: vm.$root === vm,
107
- name: name,
108
- props: options.propsData,
109
- parentVnodeTag: options._parentVnode ? options._parentVnode.tag : undefined,
110
- file: file
111
- }
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
-
123
- Vue.config.errorHandler = function (error, vm, info) {
91
+ app.$honeybadger = honeybadger;
92
+ app.config.globalProperties.$honeybadger = honeybadger;
93
+ var chainedErrorHandler = app.config.errorHandler;
94
+ app.config.errorHandler = function (error, vm, info) {
124
95
  honeybadger.notify(error, { context: { vm: extractContext(vm), info: info } });
125
96
  if (typeof chainedErrorHandler === 'function') {
126
- chainedErrorHandler.call(this$1$1.Vue, error, vm, info);
97
+ chainedErrorHandler.call(app, error, vm, info);
127
98
  }
128
99
 
129
- if (shouldLogError()) {
130
- logError(Vue, error, vm, info);
100
+ if (shouldLogError(app)) {
101
+ logError(app, error, vm, info);
131
102
  }
132
103
  };
133
104
  }
134
105
  };
135
106
 
107
+ function shouldLogError (app) {
108
+ if (app.config.warnHandler) {
109
+ return true
110
+ }
111
+
112
+ var hasConsole = typeof console !== 'undefined';
113
+ var isDebug = app.config.debug || process.env.NODE_ENV !== 'production';
114
+ return hasConsole && isDebug
115
+ }
116
+
117
+ function extractContext (vm) {
118
+ var options = vm.$options || {};
119
+ var name = options.name || options._componentTag;
120
+ var file = options.__file;
121
+ var parentName = vm.$parent && vm.$parent.$options ? vm.$parent.$options.name : undefined;
122
+ return {
123
+ isRoot: vm.$root === vm,
124
+ name: name,
125
+ props: vm.$props,
126
+ parentName: parentName,
127
+ file: file
128
+ }
129
+ }
130
+
136
131
  export { HoneybadgerVue as default };
137
132
  //# sourceMappingURL=honeybadger-vue.esm.js.map
@@ -1 +1 @@
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 (shouldLog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AC3B,OAAO;QACL,MAAM,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE;QACvB,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,OAAO,CAAC,SAAS;QACxB,cAAc,EAAE,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,GAAG,SAAS;QAC3E,IAAI,EAAE,IAAI;OACX;MACF;IACDA,IAAM,cAAc,eAAM;MACxB,IAAI,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE;QAC1B,OAAO,IAAI;OACZ;;MAEDA,IAAM,UAAU,GAAG,OAAO,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;;;;;"}
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 (app, error, vm, info) {\n const message = `Error in ${info}: \"${error && error.toString()}\"`\n\n const trace = vm ? generateComponentTrace(vm) : ''\n if (app.config.warnHandler) {\n app.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 (app, options) {\n if (app.config.debug) {\n console.log(`Honeybadger configured with ${options.apiKey}`)\n }\n const honeybadger = Honeybadger.configure(options)\n app.$honeybadger = honeybadger\n app.config.globalProperties.$honeybadger = honeybadger\n const chainedErrorHandler = app.config.errorHandler\n app.config.errorHandler = (error, vm, info) => {\n honeybadger.notify(error, { context: { vm: extractContext(vm), info: info } })\n if (typeof chainedErrorHandler === 'function') {\n chainedErrorHandler.call(app, error, vm, info)\n }\n\n if (shouldLogError(app)) {\n logError(app, error, vm, info)\n }\n }\n }\n}\n\nfunction shouldLogError (app) {\n if (app.config.warnHandler) {\n return true\n }\n\n const hasConsole = typeof console !== 'undefined'\n const isDebug = app.config.debug || process.env.NODE_ENV !== 'production'\n return hasConsole && isDebug\n}\n\nfunction extractContext (vm) {\n const options = vm.$options || {}\n const name = options.name || options._componentTag\n const file = options.__file\n const parentName = vm.$parent && vm.$parent.$options ? vm.$parent.$options.name : undefined\n return {\n isRoot: vm.$root === vm,\n name: name,\n props: vm.$props,\n parentName: parentName,\n file: file\n }\n}\n\nexport default HoneybadgerVue\n"],"names":["const","let"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACAA,IAAM,UAAU,GAAG,kBAAiB;AACpCA,IAAM,QAAQ,GAAG,UAAA,GAAA,WAAO,GAAG;AAC3B,GAAG,OAAO,CAAC,UAAU,EAAE,UAAA,CAAA,WAAK,CAAC,CAAC,WAAW,EAAA,CAAA,EAAE,CAAC;AAC5C,GAAG,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA,GAAA;AACvB;AACAA,IAAM,mBAAmB,GAAA,UAAI,EAAE,EAAE,WAAW,EAAK;AACjD,EAAE,IAAI,EAAE,CAAC,KAAK,KAAK,EAAE,EAAE;AACvB,IAAI,OAAO,QAAQ;AACnB,GAAG;AACH,EAAEA,IAAM,OAAO,GAAG,OAAO,EAAE,KAAK,UAAU,IAAI,EAAE,CAAC,GAAG,IAAI,IAAI;AAC5D,MAAM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IAAI;AACd,GAAG;AACH;;;;"}
@@ -76,68 +76,63 @@ var HoneybadgerVue = (function (exports, Honeybadger) {
76
76
  }
77
77
  };
78
78
 
79
- function logError (Vue, error, vm, info) {
79
+ function logError (app, error, vm, info) {
80
80
  var message = "Error in " + info + ": \"" + (error && error.toString()) + "\"";
81
81
 
82
82
  var trace = vm ? generateComponentTrace(vm) : '';
83
- if (Vue.config.warnHandler) {
84
- Vue.config.warnHandler.call(null, message, vm, trace);
83
+ if (app.config.warnHandler) {
84
+ app.config.warnHandler.call(null, message, vm, trace);
85
85
  } else {
86
86
  console.error(("[Vue warn]: " + message + trace));
87
87
  }
88
88
  }
89
89
 
90
90
  var HoneybadgerVue = {
91
- install: function install (Vue, options) {
92
- var this$1$1 = this;
93
-
94
- if (Vue.config.debug) {
91
+ install: function install (app, options) {
92
+ if (app.config.debug) {
95
93
  console.log(("Honeybadger configured with " + (options.apiKey)));
96
94
  }
97
95
  var honeybadger = Honeybadger__default["default"].configure(options);
98
- Vue.$honeybadger = honeybadger;
99
- Vue.prototype.$honeybadger = Vue.$honeybadger;
100
- var chainedErrorHandler = Vue.config.errorHandler;
101
- var extractContext = function (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 || {};
108
- var name = options.name || options._componentTag;
109
- var file = options.__file;
110
- return {
111
- isRoot: vm.$root === vm,
112
- name: name,
113
- props: options.propsData,
114
- parentVnodeTag: options._parentVnode ? options._parentVnode.tag : undefined,
115
- file: file
116
- }
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
-
128
- Vue.config.errorHandler = function (error, vm, info) {
96
+ app.$honeybadger = honeybadger;
97
+ app.config.globalProperties.$honeybadger = honeybadger;
98
+ var chainedErrorHandler = app.config.errorHandler;
99
+ app.config.errorHandler = function (error, vm, info) {
129
100
  honeybadger.notify(error, { context: { vm: extractContext(vm), info: info } });
130
101
  if (typeof chainedErrorHandler === 'function') {
131
- chainedErrorHandler.call(this$1$1.Vue, error, vm, info);
102
+ chainedErrorHandler.call(app, error, vm, info);
132
103
  }
133
104
 
134
- if (shouldLogError()) {
135
- logError(Vue, error, vm, info);
105
+ if (shouldLogError(app)) {
106
+ logError(app, error, vm, info);
136
107
  }
137
108
  };
138
109
  }
139
110
  };
140
111
 
112
+ function shouldLogError (app) {
113
+ if (app.config.warnHandler) {
114
+ return true
115
+ }
116
+
117
+ var hasConsole = typeof console !== 'undefined';
118
+ var isDebug = app.config.debug || process.env.NODE_ENV !== 'production';
119
+ return hasConsole && isDebug
120
+ }
121
+
122
+ function extractContext (vm) {
123
+ var options = vm.$options || {};
124
+ var name = options.name || options._componentTag;
125
+ var file = options.__file;
126
+ var parentName = vm.$parent && vm.$parent.$options ? vm.$parent.$options.name : undefined;
127
+ return {
128
+ isRoot: vm.$root === vm,
129
+ name: name,
130
+ props: vm.$props,
131
+ parentName: parentName,
132
+ file: file
133
+ }
134
+ }
135
+
141
136
  exports["default"] = HoneybadgerVue;
142
137
 
143
138
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1 +1 @@
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,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,G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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;;;;;;;;;;;;;"}
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 (app, error, vm, info) {\n const message = `Error in ${info}: \"${error && error.toString()}\"`\n\n const trace = vm ? generateComponentTrace(vm) : ''\n if (app.config.warnHandler) {\n app.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 (app, options) {\n if (app.config.debug) {\n console.log(`Honeybadger configured with ${options.apiKey}`)\n }\n const honeybadger = Honeybadger.configure(options)\n app.$honeybadger = honeybadger\n app.config.globalProperties.$honeybadger = honeybadger\n const chainedErrorHandler = app.config.errorHandler\n app.config.errorHandler = (error, vm, info) => {\n honeybadger.notify(error, { context: { vm: extractContext(vm), info: info } })\n if (typeof chainedErrorHandler === 'function') {\n chainedErrorHandler.call(app, error, vm, info)\n }\n\n if (shouldLogError(app)) {\n logError(app, error, vm, info)\n }\n }\n }\n}\n\nfunction shouldLogError (app) {\n if (app.config.warnHandler) {\n return true\n }\n\n const hasConsole = typeof console !== 'undefined'\n const isDebug = app.config.debug || process.env.NODE_ENV !== 'production'\n return hasConsole && isDebug\n}\n\nfunction extractContext (vm) {\n const options = vm.$options || {}\n const name = options.name || options._componentTag\n const file = options.__file\n const parentName = vm.$parent && vm.$parent.$options ? vm.$parent.$options.name : undefined\n return {\n isRoot: vm.$root === vm,\n name: name,\n props: vm.$props,\n parentName: parentName,\n file: file\n }\n}\n\nexport default HoneybadgerVue\n"],"names":["const","let","Honeybadger"],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AAE;EAC7B,EAAEA,IAAM,OAAO,GAAG,EAAE,CAAC,QAAQ,IAAI,GAAE;EACnC,EAAEA,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,cAAa;EACpD,EAAEA,IAAM,IAAI,GAAG,OAAO,CAAC,OAAM;EAC7B,EAAEA,IAAM,UAAU,GAAG,EAAE,CAAC,OAAO,IAAI,EAAE,CAAC,OAAO,CAAC,QAAQ,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,GAAG,UAAS;EAC7F,EAAE,OAAO;EACT,IAAI,MAAM,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE;EAC3B,IAAI,IAAI,EAAE,IAAI;EACd,IAAI,KAAK,EAAE,EAAE,CAAC,MAAM;EACpB,IAAI,UAAU,EAAE,UAAU;EAC1B,IAAI,IAAI,EAAE,IAAI;EACd,GAAG;EACH;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ var HoneybadgerVue=function(n,r){"use strict";function o(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var e=o(r),t=/(?:^|[-_])(\w)/g,i=function(n,r){if(n.$root===n)return"<Root>";var o="function"==typeof n&&null!=n.cid?n.options:n._isVue?n.$options||n.constructor.options:n||{},e=o.name||o._componentTag,i=o.__file;if(!e&&i){var a=i.match(/([^/\\]+)\.vue$/);e=a&&a[1]}return(e?"<"+(e.replace(t,(function(n){return n.toUpperCase()})).replace(/[-_]/g,"")+">"):"<Anonymous>")+(i&&!1!==r?" at "+i:"")};function a(n,r,o,e){var t="Error in "+e+': "'+(r&&r.toString())+'"',a=o?function(n){if(n._isVue&&n.$parent){for(var r=[],o=0;n;){if(r.length>0){var e=r[r.length-1];if(e.constructor===n.constructor){o++,n=n.$parent;continue}o>0&&(r[r.length-1]=[e,o],o=0)}r.push(n),n=n.$parent}return"\n\nfound in\n\n"+r.map((function(n,r){return""+(0===r?"---\x3e ":function(n,r){for(var o="";r;)r%2==1&&(o+=n),r>1&&(n+=n),r>>=1;return o}(" ",5+2*r))+(Array.isArray(n)?i(n[0])+"... ("+n[1]+" recursive calls)":i(n))})).join("\n")}return"\n\n(found in "+i(n)+")"}(o):"";n.config.warnHandler?n.config.warnHandler.call(null,t,o,a):console.error("[Vue warn]: "+t+a)}var u={install:function(n,r){n.config.debug&&console.log("Honeybadger configured with "+r.apiKey);var o=e.default.configure(r);n.$honeybadger=o,n.config.globalProperties.$honeybadger=o;var t=n.config.errorHandler;n.config.errorHandler=function(r,e,i){o.notify(r,{context:{vm:c(e),info:i}}),"function"==typeof t&&t.call(n,r,e,i),function(n){if(n.config.warnHandler)return!0;var r="undefined"!=typeof console,o=n.config.debug||"production"!==process.env.NODE_ENV;return r&&o}(n)&&a(n,r,e,i)}}};function c(n){var r=n.$options||{},o=r.name||r._componentTag,e=r.__file,t=n.$parent&&n.$parent.$options?n.$parent.$options.name:void 0;return{isRoot:n.$root===n,name:o,props:n.$props,parentName:t,file:e}}return n.default=u,Object.defineProperty(n,"__esModule",{value:!0}),n}({},Honeybadger);
2
+ //# sourceMappingURL=honeybadger-vue.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"honeybadger-vue.min.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 (app, error, vm, info) {\n const message = `Error in ${info}: \"${error && error.toString()}\"`\n\n const trace = vm ? generateComponentTrace(vm) : ''\n if (app.config.warnHandler) {\n app.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 (app, options) {\n if (app.config.debug) {\n console.log(`Honeybadger configured with ${options.apiKey}`)\n }\n const honeybadger = Honeybadger.configure(options)\n app.$honeybadger = honeybadger\n app.config.globalProperties.$honeybadger = honeybadger\n const chainedErrorHandler = app.config.errorHandler\n app.config.errorHandler = (error, vm, info) => {\n honeybadger.notify(error, { context: { vm: extractContext(vm), info: info } })\n if (typeof chainedErrorHandler === 'function') {\n chainedErrorHandler.call(app, error, vm, info)\n }\n\n if (shouldLogError(app)) {\n logError(app, error, vm, info)\n }\n }\n }\n}\n\nfunction shouldLogError (app) {\n if (app.config.warnHandler) {\n return true\n }\n\n const hasConsole = typeof console !== 'undefined'\n const isDebug = app.config.debug || process.env.NODE_ENV !== 'production'\n return hasConsole && isDebug\n}\n\nfunction extractContext (vm) {\n const options = vm.$options || {}\n const name = options.name || options._componentTag\n const file = options.__file\n const parentName = vm.$parent && vm.$parent.$options ? vm.$parent.$options.name : undefined\n return {\n isRoot: vm.$root === vm,\n name: name,\n props: vm.$props,\n parentName: parentName,\n file: file\n }\n}\n\nexport default HoneybadgerVue\n"],"names":["classifyRE","formatComponentName","vm","includeFile","$root","const","options","cid","_isVue","$options","constructor","name","_componentTag","file","__file","match","replace","c","toUpperCase","logError","app","error","info","message","toString","trace","$parent","tree","currentRecursiveSequence","length","last","push","map","i","str","n","let","res","repeat","Array","isArray","join","generateComponentTrace","config","warnHandler","call","console","HoneybadgerVue","install","debug","log","honeybadger","Honeybadger","configure","$honeybadger","globalProperties","chainedErrorHandler","errorHandler","notify","context","extractContext","hasConsole","isDebug","process","env","NODE_ENV","shouldLogError","parentName","undefined","isRoot","props","$props"],"mappings":"iIAKMA,EAAa,kBAKbC,EAAmB,SAAIC,EAAIC,GAC/B,GAAID,EAAGE,QAAUF,EACf,MAAO,SAETG,IAAMC,EAAwB,mBAAPJ,GAA+B,MAAVA,EAAGK,IAC3CL,EAAGI,QACHJ,EAAGM,OACDN,EAAGO,UAAYP,EAAGQ,YAAYJ,QAC9BJ,GAAM,GACRS,EAAOL,EAAQK,MAAQL,EAAQM,cAC7BC,EAAOP,EAAQQ,OACrB,IAAKH,GAAQE,EAAM,CACjBR,IAAMU,EAAQF,EAAKE,MAAM,mBACzBJ,EAAOI,GAASA,EAAM,GAGxB,OACGJ,EAAW,KAASA,EApBtBK,QAAQhB,GAAY,SAAAiB,UAAKA,EAAEC,iBAC3BF,QAAQ,QAAS,IAmBU,KAAM,gBAC/BH,IAAwB,IAAhBV,EAA+B,OAA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aAAeH,EACnB/B,EAAIuB,OAAOY,iBAAiBD,aAAeH,EAC3C9C,IAAMmD,EAAsBpC,EAAIuB,OAAOc,aACvCrC,EAAIuB,OAAOc,aAAY,SAAIpC,EAAOnB,EAAIoB,GACpC6B,EAAYO,OAAOrC,EAAO,CAAEsC,QAAS,CAAEzD,GAAI0D,EAAe1D,GAAKoB,KAAMA,KAClC,mBAAxBkC,GACTA,EAAoBX,KAAKzB,EAAKC,EAAOnB,EAAIoB,GAUjD,SAAyBF,GACvB,GAAIA,EAAIuB,OAAOC,YACb,OAAO,EAGTvC,IAAMwD,EAAgC,oBAAZf,QACpBgB,EAAU1C,EAAIuB,OAAOM,OAAkC,eAAzBc,QAAQC,IAAIC,SAChD,OAAOJ,GAAcC,EAdbI,CAAe9C,IACjBD,EAASC,EAAKC,EAAOnB,EAAIoB,MAgBjC,SAASsC,EAAgB1D,GACvBG,IAAMC,EAAUJ,EAAGO,UAAY,GACzBE,EAAOL,EAAQK,MAAQL,EAAQM,cAC/BC,EAAOP,EAAQQ,OACfqD,EAAajE,EAAGwB,SAAWxB,EAAGwB,QAAQjB,SAAWP,EAAGwB,QAAQjB,SAASE,UAAOyD,EAClF,MAAO,CACLC,OAAQnE,EAAGE,QAAUF,EACrBS,KAAMA,EACN2D,MAAOpE,EAAGqE,OACVJ,WAAYA,EACZtD,KAAMA"}
@@ -79,68 +79,63 @@
79
79
  }
80
80
  };
81
81
 
82
- function logError (Vue, error, vm, info) {
82
+ function logError (app, error, vm, info) {
83
83
  var message = "Error in " + info + ": \"" + (error && error.toString()) + "\"";
84
84
 
85
85
  var trace = vm ? generateComponentTrace(vm) : '';
86
- if (Vue.config.warnHandler) {
87
- Vue.config.warnHandler.call(null, message, vm, trace);
86
+ if (app.config.warnHandler) {
87
+ app.config.warnHandler.call(null, message, vm, trace);
88
88
  } else {
89
89
  console.error(("[Vue warn]: " + message + trace));
90
90
  }
91
91
  }
92
92
 
93
93
  var HoneybadgerVue = {
94
- install: function install (Vue, options) {
95
- var this$1$1 = this;
96
-
97
- if (Vue.config.debug) {
94
+ install: function install (app, options) {
95
+ if (app.config.debug) {
98
96
  console.log(("Honeybadger configured with " + (options.apiKey)));
99
97
  }
100
98
  var honeybadger = Honeybadger__default["default"].configure(options);
101
- Vue.$honeybadger = honeybadger;
102
- Vue.prototype.$honeybadger = Vue.$honeybadger;
103
- var chainedErrorHandler = Vue.config.errorHandler;
104
- var extractContext = function (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 || {};
111
- var name = options.name || options._componentTag;
112
- var file = options.__file;
113
- return {
114
- isRoot: vm.$root === vm,
115
- name: name,
116
- props: options.propsData,
117
- parentVnodeTag: options._parentVnode ? options._parentVnode.tag : undefined,
118
- file: file
119
- }
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
-
131
- Vue.config.errorHandler = function (error, vm, info) {
99
+ app.$honeybadger = honeybadger;
100
+ app.config.globalProperties.$honeybadger = honeybadger;
101
+ var chainedErrorHandler = app.config.errorHandler;
102
+ app.config.errorHandler = function (error, vm, info) {
132
103
  honeybadger.notify(error, { context: { vm: extractContext(vm), info: info } });
133
104
  if (typeof chainedErrorHandler === 'function') {
134
- chainedErrorHandler.call(this$1$1.Vue, error, vm, info);
105
+ chainedErrorHandler.call(app, error, vm, info);
135
106
  }
136
107
 
137
- if (shouldLogError()) {
138
- logError(Vue, error, vm, info);
108
+ if (shouldLogError(app)) {
109
+ logError(app, error, vm, info);
139
110
  }
140
111
  };
141
112
  }
142
113
  };
143
114
 
115
+ function shouldLogError (app) {
116
+ if (app.config.warnHandler) {
117
+ return true
118
+ }
119
+
120
+ var hasConsole = typeof console !== 'undefined';
121
+ var isDebug = app.config.debug || process.env.NODE_ENV !== 'production';
122
+ return hasConsole && isDebug
123
+ }
124
+
125
+ function extractContext (vm) {
126
+ var options = vm.$options || {};
127
+ var name = options.name || options._componentTag;
128
+ var file = options.__file;
129
+ var parentName = vm.$parent && vm.$parent.$options ? vm.$parent.$options.name : undefined;
130
+ return {
131
+ isRoot: vm.$root === vm,
132
+ name: name,
133
+ props: vm.$props,
134
+ parentName: parentName,
135
+ file: file
136
+ }
137
+ }
138
+
144
139
  exports["default"] = HoneybadgerVue;
145
140
 
146
141
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1 +1 @@
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,IAAM,MAAM,aAAI,GAAG,EAAE,CAAC,EAAE;IACtBC,IAAI,GAAG,GAAG,GAAE;IACZ,OAAO,CAAC,EAAE;MACR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AI,IAAI,OAAO,CAAC,cAAa;QAClDA,IAAM,IAAI,GAAG,OAAO,CAAC,OAAM;QAC3B,OAAO;UACL,MAAM,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE;UACvB,IAAI,EAAE,IAAI;UACV,KAAK,EAAE,OAAO,CAAC,SAAS;UACxB,cAAc,EAAE,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,GAAG,SAAS;UAC3E,IAAI,EAAE,IAAI;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;;;;;;;;;;;"}
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 (app, error, vm, info) {\n const message = `Error in ${info}: \"${error && error.toString()}\"`\n\n const trace = vm ? generateComponentTrace(vm) : ''\n if (app.config.warnHandler) {\n app.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 (app, options) {\n if (app.config.debug) {\n console.log(`Honeybadger configured with ${options.apiKey}`)\n }\n const honeybadger = Honeybadger.configure(options)\n app.$honeybadger = honeybadger\n app.config.globalProperties.$honeybadger = honeybadger\n const chainedErrorHandler = app.config.errorHandler\n app.config.errorHandler = (error, vm, info) => {\n honeybadger.notify(error, { context: { vm: extractContext(vm), info: info } })\n if (typeof chainedErrorHandler === 'function') {\n chainedErrorHandler.call(app, error, vm, info)\n }\n\n if (shouldLogError(app)) {\n logError(app, error, vm, info)\n }\n }\n }\n}\n\nfunction shouldLogError (app) {\n if (app.config.warnHandler) {\n return true\n }\n\n const hasConsole = typeof console !== 'undefined'\n const isDebug = app.config.debug || process.env.NODE_ENV !== 'production'\n return hasConsole && isDebug\n}\n\nfunction extractContext (vm) {\n const options = vm.$options || {}\n const name = options.name || options._componentTag\n const file = options.__file\n const parentName = vm.$parent && vm.$parent.$options ? vm.$parent.$options.name : undefined\n return {\n isRoot: vm.$root === vm,\n name: name,\n props: vm.$props,\n parentName: parentName,\n file: file\n }\n}\n\nexport default HoneybadgerVue\n"],"names":["const","let","Honeybadger"],"mappings":";;;;;;;;;;EAAA;EACA;EACA;EACA;AACA;EACAA,IAAM,UAAU,GAAG,kBAAiB;EACpCA,IAAM,QAAQ,GAAG,UAAA,GAAA,WAAO,GAAG;EAC3B,GAAG,OAAO,CAAC,UAAU,EAAE,UAAA,CAAA,WAAK,CAAC,CAAC,WAAW,EAAA,CAAA,EAAE,CAAC;EAC5C,GAAG,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA,GAAA;AACvB;EACAA,IAAM,mBAAmB,GAAA,UAAI,EAAE,EAAE,WAAW,EAAK;EACjD,EAAE,IAAI,EAAE,CAAC,KAAK,KAAK,EAAE,EAAE;EACvB,IAAI,OAAO,QAAQ;EACnB,GAAG;EACH,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AI;EACd,IAAI,KAAK,EAAE,EAAE,CAAC,MAAM;EACpB,IAAI,UAAU,EAAE,UAAU;EAC1B,IAAI,IAAI,EAAE,IAAI;EACd,GAAG;EACH;;;;;;;;;;"}
@@ -1,17 +1,17 @@
1
1
  // Type definitions for honeybadger.js vue integration
2
2
  // Project: https://github.com/honeybadger-io/honeybadger-vue
3
3
 
4
- import Vue from 'vue'
4
+ import { App } from 'vue';
5
5
  import * as Honeybadger from '@honeybadger-io/js'
6
6
 
7
- declare module 'vue/types/vue' {
8
- interface Vue {
7
+ declare module '@vue/runtime-core' {
8
+ interface App {
9
9
  $honeybadger: typeof Honeybadger
10
10
  }
11
11
  }
12
12
 
13
- declare const HoneybadgerVue: {
14
- install(app: typeof Vue, options?: any): void
13
+ declare var HoneybadgerVue: {
14
+ install(app: App, options?: any): void
15
15
  }
16
16
 
17
- export default HoneybadgerVue
17
+ export default HoneybadgerVue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@honeybadger-io/vue",
3
- "version": "1.1.0",
3
+ "version": "3.1.0",
4
4
  "license": "MIT",
5
5
  "description": "Honeybadger Vue.js client",
6
6
  "author": "Jason Truesdell <jason@yuzuten.com> (https://github.com/JasonTrue)",
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "homepage": "https://github.com/honeybadger-io/honeybadger-vue#readme",
28
28
  "scripts": {
29
- "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
29
+ "dev": "webpack serve --progress --config build/webpack.dev.conf.js",
30
30
  "start": "npm run dev",
31
31
  "unit": "jest --config test/unit/jest.conf.js --coverage",
32
32
  "e2e": "node test/e2e/runner.js",
@@ -50,85 +50,85 @@
50
50
  "@honeybadger-io/js": "^4.0.1"
51
51
  },
52
52
  "devDependencies": {
53
- "@babel/core": "^7.16.12",
54
- "@babel/helper-module-imports": "^7.16.7",
53
+ "@babel/core": "^7.17.10",
54
+ "@babel/helper-module-imports": "^7.14.5",
55
55
  "@babel/plugin-syntax-jsx": "^7.16.7",
56
- "@babel/plugin-transform-modules-commonjs": "^7.16.8",
57
- "@babel/plugin-transform-runtime": "^7.16.10",
56
+ "@babel/plugin-transform-modules-commonjs": "^7.15.0",
57
+ "@babel/plugin-transform-runtime": "^7.17.0",
58
58
  "@babel/preset-env": "^7.16.11",
59
- "@babel/register": "^7.16.9",
60
- "@babel/runtime": "^7.16.7",
59
+ "@babel/register": "^7.17.7",
60
+ "@babel/runtime": "^7.17.9",
61
61
  "@commitlint/cli": "^17.0.0",
62
62
  "@commitlint/config-conventional": "^17.0.0",
63
- "@vue/runtime-core": "^3.2.29",
64
- "ajv": "^8.9.0",
65
- "autoprefixer": "^10.4.2",
63
+ "@vue/compiler-sfc": "^3.2.35",
64
+ "@vue/runtime-core": "^3.2.6",
65
+ "@vue/test-utils": "^2.0.0-rc.21",
66
+ "ajv": "^8.6.1",
67
+ "autoprefixer": "^10.4.7",
66
68
  "babel-core": "^7.0.0-bridge.0",
67
69
  "babel-eslint": "^10.1.0",
68
70
  "babel-helper-vue-jsx-merge-props": "^2.0.3",
69
- "babel-jest": "^28.0.3",
70
- "babel-loader": "^8.2.3",
71
+ "babel-jest": "^26.0.0",
72
+ "babel-loader": "^8.1.0",
71
73
  "babel-plugin-dynamic-import-node": "^2.3.3",
72
74
  "babel-plugin-transform-vue-jsx": "^4.0.1",
73
75
  "browser-resolve": "^2.0.0",
74
- "chalk": "^5.0.0",
75
- "chromedriver": "^101.0.0",
76
- "copy-webpack-plugin": "^11.0.0",
76
+ "chalk": "^4.1.2",
77
+ "chromedriver": "^92.0.0",
78
+ "copy-webpack-plugin": "^10.2.4",
77
79
  "cross-spawn": "^7.0.2",
78
- "css-loader": "^6.5.1",
80
+ "css-loader": "^5.2.7",
79
81
  "css-minimizer-webpack-plugin": "^3.4.1",
80
82
  "dotenv": "^16.0.0",
81
- "eslint": "^8.8.0",
82
- "eslint-config-standard": "^17.0.0",
83
+ "eslint": "^7.32.0",
84
+ "eslint-config-standard": "^16.0.3",
83
85
  "eslint-friendly-formatter": "^4.0.1",
84
86
  "eslint-loader": "^4.0.1",
85
- "eslint-plugin-import": "^2.25.4",
87
+ "eslint-plugin-import": "^2.26.0",
86
88
  "eslint-plugin-node": "^11.1.0",
87
- "eslint-plugin-promise": "^6.0.0",
89
+ "eslint-plugin-promise": "^5.1.0",
88
90
  "eslint-plugin-standard": "^5.0.0",
89
- "eslint-plugin-vue": "^9.0.1",
91
+ "eslint-plugin-vue": "^7.16.0",
90
92
  "file-loader": "^6.0.0",
91
- "friendly-errors-webpack-plugin": "^1.7.0",
92
93
  "html-webpack-plugin": "^5.5.0",
93
94
  "husky": "^8.0.0",
94
95
  "interactive": "^0.1.9",
95
- "jest": "^28.0.3",
96
- "jest-environment-jsdom": "^28.0.2",
96
+ "jest": "^26.0.0",
97
97
  "jest-serializer-vue": "^2.0.2",
98
- "mini-css-extract-plugin": "^2.5.3",
99
- "nightwatch": "^2.0.2",
98
+ "mini-css-extract-plugin": "^2.0.0",
99
+ "nightwatch": "^2.1.4",
100
100
  "nightwatch-xhr": "^0.4.7",
101
- "node-notifier": "^10.0.0",
101
+ "node-notifier": "^10.0.1",
102
+ "ora": "^5.4.1",
102
103
  "portfinder": "^1.0.13",
103
- "postcss": "^8.4.5",
104
+ "postcss": "^8.3.6",
104
105
  "postcss-import": "^14.0.2",
105
106
  "postcss-loader": "^6.2.1",
106
107
  "postcss-url": "^10.1.3",
107
108
  "rimraf": "^3.0.2",
108
- "rollup": "^2.66.1",
109
+ "rollup": "^2.70.2",
109
110
  "rollup-plugin-buble": "^0.19.4",
110
111
  "rollup-plugin-conditional": "^3.1.2",
111
112
  "rollup-plugin-terser": "^7.0.0",
112
- "rollup-plugin-vue": "^5.1.6",
113
+ "rollup-plugin-vue": "^6.0.0",
113
114
  "selenium-server": "^3.0.1",
114
- "semver": "^7.3.2",
115
+ "semver": "^7.3.7",
115
116
  "shelljs": "^0.8.5",
116
117
  "shipjs": "0.24.4",
117
- "sinon": "^14.0.0",
118
- "terser-webpack-plugin": "^5.3.0",
119
- "tsd": "^0.20.0",
118
+ "sinon": "^11.1.1",
119
+ "terser-webpack-plugin": "^5.3.1",
120
+ "tsd": "^0.17.0",
120
121
  "url-loader": "^4.1.0",
121
- "vue": "^2.6.14",
122
- "vue-jest": "^3.0.5",
123
- "vue-loader": "^17.0.0",
122
+ "vue": "^3.2.33",
123
+ "vue-jest": "^5.0.0-alpha.10",
124
+ "vue-loader": "^16.3.0",
124
125
  "vue-style-loader": "^4.1.3",
125
- "vue-template-compiler": "^2.6.14",
126
- "webpack": "^5.67.0",
126
+ "webpack": "^5.72.0",
127
127
  "webpack-bundle-analyzer": "^4.5.0",
128
128
  "webpack-cli": "^4.9.2",
129
- "webpack-dev-server": "^4.7.3",
129
+ "webpack-dev-server": "^4.0.0",
130
130
  "webpack-merge": "^5.8.0",
131
- "winston": "^3.5.0"
131
+ "winston": "^3.7.2"
132
132
  },
133
133
  "engines": {
134
134
  "node": ">= 6.0.0",
@@ -1,11 +1,11 @@
1
1
  import { generateComponentTrace } from './vue-debug'
2
2
 
3
- export function logError (Vue, error, vm, info) {
3
+ export function logError (app, error, vm, info) {
4
4
  const message = `Error in ${info}: "${error && error.toString()}"`
5
5
 
6
6
  const trace = vm ? generateComponentTrace(vm) : ''
7
- if (Vue.config.warnHandler) {
8
- Vue.config.warnHandler.call(null, message, vm, trace)
7
+ if (app.config.warnHandler) {
8
+ app.config.warnHandler.call(null, message, vm, trace)
9
9
  } else {
10
10
  console.error(`[Vue warn]: ${message}${trace}`)
11
11
  }
package/src/index.js CHANGED
@@ -2,52 +2,49 @@ import Honeybadger from '@honeybadger-io/js'
2
2
  import { logError } from './error-logging'
3
3
 
4
4
  const HoneybadgerVue = {
5
- install (Vue, options) {
6
- if (Vue.config.debug) {
5
+ install (app, options) {
6
+ if (app.config.debug) {
7
7
  console.log(`Honeybadger configured with ${options.apiKey}`)
8
8
  }
9
9
  const honeybadger = Honeybadger.configure(options)
10
- Vue.$honeybadger = honeybadger
11
- Vue.prototype.$honeybadger = Vue.$honeybadger
12
- const chainedErrorHandler = Vue.config.errorHandler
13
- const extractContext = function (vm) {
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
22
- return {
23
- isRoot: vm.$root === vm,
24
- name: name,
25
- props: options.propsData,
26
- parentVnodeTag: options._parentVnode ? options._parentVnode.tag : undefined,
27
- file: file
28
- }
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
-
40
- Vue.config.errorHandler = (error, vm, info) => {
10
+ app.$honeybadger = honeybadger
11
+ app.config.globalProperties.$honeybadger = honeybadger
12
+ const chainedErrorHandler = app.config.errorHandler
13
+ app.config.errorHandler = (error, vm, info) => {
41
14
  honeybadger.notify(error, { context: { vm: extractContext(vm), info: info } })
42
15
  if (typeof chainedErrorHandler === 'function') {
43
- chainedErrorHandler.call(this.Vue, error, vm, info)
16
+ chainedErrorHandler.call(app, error, vm, info)
44
17
  }
45
18
 
46
- if (shouldLogError()) {
47
- logError(Vue, error, vm, info)
19
+ if (shouldLogError(app)) {
20
+ logError(app, error, vm, info)
48
21
  }
49
22
  }
50
23
  }
51
24
  }
52
25
 
26
+ function shouldLogError (app) {
27
+ if (app.config.warnHandler) {
28
+ return true
29
+ }
30
+
31
+ const hasConsole = typeof console !== 'undefined'
32
+ const isDebug = app.config.debug || process.env.NODE_ENV !== 'production'
33
+ return hasConsole && isDebug
34
+ }
35
+
36
+ function extractContext (vm) {
37
+ const options = vm.$options || {}
38
+ const name = options.name || options._componentTag
39
+ const file = options.__file
40
+ const parentName = vm.$parent && vm.$parent.$options ? vm.$parent.$options.name : undefined
41
+ return {
42
+ isRoot: vm.$root === vm,
43
+ name: name,
44
+ props: vm.$props,
45
+ parentName: parentName,
46
+ file: file
47
+ }
48
+ }
49
+
53
50
  export default HoneybadgerVue