@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 +78 -1
- package/dist/index.mjs +53 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1 +1,78 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
-
|
|
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.
|
|
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.
|
|
34
|
-
"@ohbug/types": "2.1.
|
|
33
|
+
"@ohbug/core": "2.1.1",
|
|
34
|
+
"@ohbug/types": "2.1.1"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|