@ohbug/vue 2.0.7 → 2.0.8

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/dist/index.js CHANGED
@@ -1 +1,78 @@
1
- "use strict";var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var V=(o,e)=>{for(var r in e)i(o,r,{get:e[r],enumerable:!0})},b=(o,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of d(e))!h.call(o,t)&&t!==r&&i(o,t,{get:()=>e[t],enumerable:!(n=c(e,t))||n.enumerable});return o};var E=o=>b(i({},"__esModule",{value:!0}),o);var C={};V(C,{default:()=>u});module.exports=E(C);var f=require("@ohbug/core"),D=o=>{if((o==null?void 0:o.$root)===o)return{component:"Root"};let e=o==null?void 0:o.$options,r=e==null?void 0:e.name,n=e==null?void 0:e.__file;return{component:r,file:n}};function s(o,e){let r=e.config.errorHandler,n=(t,p,l)=>{let{component:m,file:a}=D(p),g={name:t.name,message:t.message,stack:t.stack,errorInfo:l,component:m,file:a,props:p?p.$options.propsData:void 0},y=o.createEvent({category:"error",type:f.EventTypes.VUE,detail:g});o.notify(y),typeof console<"u"&&typeof console.error=="function"&&console.error(t),typeof r=="function"&&r(t,p,l)};e.config.errorHandler=n}function u(o){return{install:e=>{s(o,e)}}}0&&(module.exports={});
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ default: () => createVueClient
24
+ });
25
+ module.exports = __toCommonJS(src_exports);
26
+
27
+ // src/install.ts
28
+ var import_core = require("@ohbug/core");
29
+ var getComponent = (instance) => {
30
+ if ((instance == null ? void 0 : instance.$root) === instance) {
31
+ return { component: "Root" };
32
+ }
33
+ const options = instance == null ? void 0 : instance.$options;
34
+ const component = options == null ? void 0 : options.name;
35
+ const file = options == null ? void 0 : options.__file;
36
+ return {
37
+ component,
38
+ file
39
+ };
40
+ };
41
+ function install(client, Vue) {
42
+ const prev = Vue.config.errorHandler;
43
+ const handler = (error, instance, info) => {
44
+ const { component, file } = getComponent(instance);
45
+ const detail = {
46
+ name: error.name,
47
+ message: error.message,
48
+ stack: error.stack,
49
+ errorInfo: info,
50
+ component,
51
+ file,
52
+ props: instance ? instance.$options.propsData : void 0
53
+ };
54
+ const event = client.createEvent({
55
+ category: "error",
56
+ type: import_core.EventTypes.VUE,
57
+ detail
58
+ });
59
+ client.notify(event);
60
+ if (typeof console !== "undefined" && typeof console.error === "function") {
61
+ console.error(error);
62
+ }
63
+ if (typeof prev === "function")
64
+ prev(error, instance, info);
65
+ };
66
+ Vue.config.errorHandler = handler;
67
+ }
68
+
69
+ // src/index.ts
70
+ function createVueClient(client) {
71
+ return {
72
+ install: (app) => {
73
+ install(client, app);
74
+ }
75
+ };
76
+ }
77
+ // Annotate the CommonJS export names for ESM import in node:
78
+ 0 && (module.exports = {});
package/dist/index.mjs CHANGED
@@ -1 +1,53 @@
1
- import{EventTypes as a}from"@ohbug/core";var g=e=>{if((e==null?void 0:e.$root)===e)return{component:"Root"};let o=e==null?void 0:e.$options,r=o==null?void 0:o.name,p=o==null?void 0:o.__file;return{component:r,file:p}};function l(e,o){let r=o.config.errorHandler,p=(t,n,i)=>{let{component:f,file:s}=g(n),u={name:t.name,message:t.message,stack:t.stack,errorInfo:i,component:f,file:s,props:n?n.$options.propsData:void 0},m=e.createEvent({category:"error",type:a.VUE,detail:u});e.notify(m),typeof console<"u"&&typeof console.error=="function"&&console.error(t),typeof r=="function"&&r(t,n,i)};o.config.errorHandler=p}function y(e){return{install:o=>{l(e,o)}}}export{y as default};
1
+ // src/install.ts
2
+ import { EventTypes } from "@ohbug/core";
3
+ var getComponent = (instance) => {
4
+ if ((instance == null ? void 0 : instance.$root) === instance) {
5
+ return { component: "Root" };
6
+ }
7
+ const options = instance == null ? void 0 : instance.$options;
8
+ const component = options == null ? void 0 : options.name;
9
+ const file = options == null ? void 0 : options.__file;
10
+ return {
11
+ component,
12
+ file
13
+ };
14
+ };
15
+ function install(client, Vue) {
16
+ const prev = Vue.config.errorHandler;
17
+ const handler = (error, instance, info) => {
18
+ const { component, file } = getComponent(instance);
19
+ const detail = {
20
+ name: error.name,
21
+ message: error.message,
22
+ stack: error.stack,
23
+ errorInfo: info,
24
+ component,
25
+ file,
26
+ props: instance ? instance.$options.propsData : void 0
27
+ };
28
+ const event = client.createEvent({
29
+ category: "error",
30
+ type: EventTypes.VUE,
31
+ detail
32
+ });
33
+ client.notify(event);
34
+ if (typeof console !== "undefined" && typeof console.error === "function") {
35
+ console.error(error);
36
+ }
37
+ if (typeof prev === "function")
38
+ prev(error, instance, info);
39
+ };
40
+ Vue.config.errorHandler = handler;
41
+ }
42
+
43
+ // src/index.ts
44
+ function createVueClient(client) {
45
+ return {
46
+ install: (app) => {
47
+ install(client, app);
48
+ }
49
+ };
50
+ }
51
+ export {
52
+ createVueClient as default
53
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohbug/vue",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "Ohbug SDK for Vue",
5
5
  "license": "Apache-2.0",
6
6
  "author": "chenyueban <jasonchan0527@gmail.com>",
@@ -30,8 +30,8 @@
30
30
  "vue": "2.x || 3.x"
31
31
  },
32
32
  "dependencies": {
33
- "@ohbug/core": "2.1.0",
34
- "@ohbug/types": "2.1.0"
33
+ "@ohbug/core": "2.1.1",
34
+ "@ohbug/types": "2.1.1"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"