@ohbug/vue 1.0.14 → 2.0.2

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
@@ -2,14 +2,13 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@ohbug/vue.svg?style=flat-square)](https://www.npmjs.com/package/@ohbug/vue)
4
4
  [![npm bundle size](https://img.shields.io/bundlephobia/min/@ohbug/vue?style=flat-square)](https://bundlephobia.com/result?p=@ohbug/vue)
5
- [![Code style](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
6
5
 
7
6
  English | [简体中文](./README-zh_CN.md)
8
7
 
9
8
  ## Installation
10
9
 
11
10
  ```
12
- yarn add @ohbug/browser @ohbug/vue
11
+ pnpm instal @ohbug/browser @ohbug/vue
13
12
  ```
14
13
 
15
14
  ## Usage
@@ -19,6 +18,9 @@ import Vue from 'vue'
19
18
  import Ohbug from '@ohbug/browser'
20
19
  import OhbugVue from '@ohbug/vue'
21
20
 
22
- const client = Ohbug.init({ apiKey: 'YOUR_API_KEY' })
23
- client.use(OhbugVue, Vue)
21
+ const client = Ohbug.setup({ apiKey: 'YOUR_API_KEY' })
22
+
23
+ Vue.createApp(App)
24
+ .use(OhbugVue(client))
25
+ .mount('#app')
24
26
  ```
package/dist/index.d.ts CHANGED
@@ -1,3 +1,15 @@
1
- export type { VueErrorDetail } from './install';
2
- export { extension as default } from './extension';
3
- //# sourceMappingURL=index.d.ts.map
1
+ import { OhbugBaseDetail, OhbugClient } from '@ohbug/types';
2
+ import { Plugin } from 'vue';
3
+
4
+ interface VueErrorDetail extends OhbugBaseDetail {
5
+ name: string;
6
+ stack?: string;
7
+ errorInfo: string;
8
+ component?: string;
9
+ file?: string;
10
+ props?: Record<string, any>;
11
+ }
12
+
13
+ declare function createVueClient(client: OhbugClient): Plugin;
14
+
15
+ export { VueErrorDetail, createVueClient as default };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ var l=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var h=(o,e)=>{for(var r in e)l(o,r,{get:e[r],enumerable:!0})},C=(o,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of b(e))!d.call(o,t)&&t!==r&&l(o,t,{get:()=>e[t],enumerable:!(n=y(e,t))||n.enumerable});return o};var E=o=>C(l({},"__esModule",{value:!0}),o);var O={};h(O,{default:()=>s});module.exports=E(O);var u=require("@ohbug/core"),v=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 f(o,e){let r=e.config.errorHandler,n=(t,p,i)=>{let{component:m,file:a}=v(p),g={name:t.name,message:t.message,stack:t.stack,errorInfo:i,component:m,file:a,props:p?p.$options.propsData:void 0},c=o.createEvent({category:"error",type:u.EventTypes.VUE,detail:g});o.notify(c),typeof console<"u"&&typeof console.error=="function"&&console.error(t),typeof r=="function"&&r(t,p,i)};e.config.errorHandler=n}function s(o){return{install:e=>{f(o,e)}}}0&&(module.exports={});
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ import{EventTypes as c}from"@ohbug/core";var y=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 i(e,o){let r=o.config.errorHandler,p=(t,n,l)=>{let{component:u,file:f}=y(n),s={name:t.name,message:t.message,stack:t.stack,errorInfo:l,component:u,file:f,props:n?n.$options.propsData:void 0},m=e.createEvent({category:"error",type:c.VUE,detail:s});e.notify(m),typeof console<"u"&&typeof console.error=="function"&&console.error(t),typeof r=="function"&&r(t,n,l)};o.config.errorHandler=p}function b(e){return{install:o=>{i(e,o)}}}export{b as default};
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@ohbug/vue",
3
- "version": "1.0.14",
3
+ "version": "2.0.2",
4
4
  "description": "Ohbug SDK for Vue",
5
+ "license": "Apache-2.0",
5
6
  "author": "chenyueban <jasonchan0527@gmail.com>",
6
7
  "homepage": "https://github.com/ohbug-org/ohbug",
7
8
  "bugs": {
@@ -11,40 +12,36 @@
11
12
  "type": "git",
12
13
  "url": "https://github.com/ohbug-org/ohbug"
13
14
  },
14
- "license": "Apache-2.0",
15
- "main": "./dist/ohbug-vue.umd.js",
16
- "module": "./dist/ohbug-vue.es.js",
17
- "unpkg": "./dist/ohbug-vue.umd.js",
18
- "jsdelivr": "./dist/ohbug-vue.umd.js",
19
- "types": "./dist/index.d.ts",
15
+ "main": "dist/index.js",
16
+ "module": "dist/index.mjs",
17
+ "types": "dist/index.d.ts",
20
18
  "exports": {
21
19
  ".": {
22
- "import": "./dist/ohbug-vue.es.js",
23
- "require": "./dist/ohbug-vue.umd.js"
20
+ "require": "./dist/index.js",
21
+ "import": "./dist/index.mjs",
22
+ "types": "./dist/index.d.ts"
24
23
  }
25
24
  },
26
25
  "files": [
27
26
  "dist"
28
27
  ],
28
+ "sideEffects": false,
29
+ "peerDependencies": {
30
+ "vue": "^3.0.0"
31
+ },
29
32
  "dependencies": {
30
- "@ohbug/core": "^1.1.7"
33
+ "@ohbug/core": "2.0.2",
34
+ "@ohbug/types": "2.0.2"
31
35
  },
32
36
  "devDependencies": {
33
- "vue": "^2.6.11"
34
- },
35
- "peerDependencies": {
36
- "vue": "^2.6.0"
37
- },
38
- "buildOptions": {
39
- "name": "OhbugVue",
40
- "formats": [
41
- "es",
42
- "umd"
43
- ],
44
- "order": 4
37
+ "vue": "^3.2.33"
45
38
  },
46
39
  "publishConfig": {
47
40
  "access": "public"
48
41
  },
49
- "gitHead": "323e4755a0da5893748c19901f3f709e903b6dd2"
50
- }
42
+ "scripts": {
43
+ "build": "tsup",
44
+ "dev": "tsup --watch"
45
+ },
46
+ "readme": "# `@ohbug/vue`\n\n[![npm](https://img.shields.io/npm/v/@ohbug/vue.svg?style=flat-square)](https://www.npmjs.com/package/@ohbug/vue)\n[![npm bundle size](https://img.shields.io/bundlephobia/min/@ohbug/vue?style=flat-square)](https://bundlephobia.com/result?p=@ohbug/vue)\n\nEnglish | [简体中文](./README-zh_CN.md)\n\n## Installation\n\n```\npnpm instal @ohbug/browser @ohbug/vue\n```\n\n## Usage\n\n```javascript\nimport Vue from 'vue'\nimport Ohbug from '@ohbug/browser'\nimport OhbugVue from '@ohbug/vue'\n\nconst client = Ohbug.setup({ apiKey: 'YOUR_API_KEY' })\n\nVue.createApp(App)\n .use(OhbugVue(client))\n .mount('#app')\n```\n"
47
+ }
@@ -1,2 +0,0 @@
1
- export declare const extension: import("@ohbug/types").OhbugExtension<any>;
2
- //# sourceMappingURL=extension.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS,4CAQpB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,aAAa,CAAA"}
package/dist/install.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import type { OhbugBaseDetail, OhbugClient } from '@ohbug/types';
2
- import type { VueConstructor } from 'vue';
3
- export interface VueErrorDetail extends OhbugBaseDetail {
4
- name: string;
5
- stack?: string;
6
- errorInfo: string;
7
- component: string;
8
- file: string;
9
- props?: Record<string, any>;
10
- }
11
- export declare function install(client: OhbugClient, Vue: VueConstructor): void;
12
- //# sourceMappingURL=install.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AAGzC,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC5B;AAkBD,wBAAgB,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,cAAc,QA6B/D"}
@@ -1,15 +0,0 @@
1
- /*! *****************************************************************************
2
- Copyright (c) Microsoft Corporation.
3
-
4
- Permission to use, copy, modify, and/or distribute this software for any
5
- purpose with or without fee is hereby granted.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
- PERFORMANCE OF THIS SOFTWARE.
14
- ***************************************************************************** */
15
- var e=function(){return(e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function t(e){return"string"==typeof e}var r=function(e,t,r,n){this.type=r,this.timestamp=n||(new Date).toISOString(),this.message=e,this.data=t};!function(){function n(e,t){var r=e.apiKey,n=e.appVersion,o=e.appType,a=e.releaseStage,i=e.timestamp,s=e.category,p=e.type,c=e.sdk,u=e.detail,f=e.device,l=e.user,h=e.actions,E=e.metaData;this.apiKey=r,this.appVersion=n,this.appType=o,this.releaseStage=a,this.timestamp=i,this.category=s,this.type=p,this.sdk=c,this.detail=u,this.device=f,this.user=l,this.actions=h,this.metaData=E,this._client=t}Object.defineProperty(n.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),n.prototype.addAction=function(e,n,o,a){var i,s,p=this.actions,c=t(e)?e:"",u=n||{},f=t(o)?o:"",l=new r(c,u,f,a);p.length>=(null!==(s=null===(i=this._client)||void 0===i?void 0:i._config.maxActions)&&void 0!==s?s:30)&&p.shift(),p.push(l)},n.prototype.getUser=function(){return this.user},n.prototype.setUser=function(t){var r;if(function(e){return"[object Object]"===Object.prototype.toString.call(e)}(t)&&Object.keys(t).length<=6)return this.user=e(e({},this.user),t),this.getUser();null===(r=this._client)||void 0===r||r._logger.warn(function(e,t){return new Error("Invalid data\n- "+e+", got "+JSON.stringify(t))}("setUser should be an object and have up to 6 attributes",t))},n.prototype.addMetaData=function(e,t){return function(e,t,r){t&&(e[t]=r)}(this.metaData,e,t)},n.prototype.getMetaData=function(e){return function(e,t){if(e[t])return e[t]}(this.metaData,e)},n.prototype.deleteMetaData=function(e){return function(e,t){if(e[t])return delete e[t]}(this.metaData,e)},n.prototype.toJSON=function(){var e=this;return{apiKey:e.apiKey,appVersion:e.appVersion,appType:e.appType,timestamp:e.timestamp,category:e.category,type:e.type,sdk:e.sdk,device:e.device,detail:e.detail,user:e.user,actions:e.actions,metaData:e.metaData,releaseStage:e.releaseStage}}}();Object.freeze({__proto__:null,UNCAUGHT_ERROR:"uncaughtError",RESOURCE_ERROR:"resourceError",UNHANDLEDREJECTION_ERROR:"unhandledrejectionError",AJAX_ERROR:"ajaxError",FETCH_ERROR:"fetchError",WEBSOCKET_ERROR:"websocketError",UNKNOWN_ERROR:"unknownError",MESSAGE:"message",FEEDBACK:"feedback",VIEW:"view",REACT:"react",VUE:"vue",ANGULAR:"angular",MINIAPP_ERROR:"miniappError",MINIAPP_UNHANDLEDREJECTION_ERROR:"miniappUnhandledrejectionError",MINIAPP_PAGENOTFOUND_ERROR:"miniappPagenotfoundError",MINIAPP_MEMORYWARNING_ERROR:"miniappMemorywarningError"});var n={name:"OhbugVue",init:function(e,t){if(!t)throw new Error("Ohbug @ohbug/vue reference to `Vue` was undefined");return function(e,t){var r=t.config.errorHandler;t.config.errorHandler=function(t,n,o){var a=function(e){if(e.$root===e)return{component:"Root"};var t=e.$options;return{component:t.name,file:t.__file}}(n),i=a.component,s=a.file,p={name:t.name,message:t.message,stack:t.stack,errorInfo:o,component:i,file:s,props:n?n.$options.propsData:void 0},c=e.createEvent({category:"error",type:"vue",detail:p});e.notify(c),"undefined"!=typeof console&&"function"==typeof console.error&&console.error(t),"function"==typeof r&&r(t,n,o)}}(e,t)}};export{n as default};
@@ -1,15 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).OhbugVue=t()}(this,(function(){"use strict";
2
- /*! *****************************************************************************
3
- Copyright (c) Microsoft Corporation.
4
-
5
- Permission to use, copy, modify, and/or distribute this software for any
6
- purpose with or without fee is hereby granted.
7
-
8
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
- PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */var e=function(){return(e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function t(e){return"string"==typeof e}var r=function(e,t,r,n){this.type=r,this.timestamp=n||(new Date).toISOString(),this.message=e,this.data=t};!function(){function n(e,t){var r=e.apiKey,n=e.appVersion,o=e.appType,i=e.releaseStage,a=e.timestamp,s=e.category,p=e.type,u=e.sdk,c=e.detail,f=e.device,l=e.user,d=e.actions,h=e.metaData;this.apiKey=r,this.appVersion=n,this.appType=o,this.releaseStage=i,this.timestamp=a,this.category=s,this.type=p,this.sdk=u,this.detail=c,this.device=f,this.user=l,this.actions=d,this.metaData=h,this._client=t}Object.defineProperty(n.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),n.prototype.addAction=function(e,n,o,i){var a,s,p=this.actions,u=t(e)?e:"",c=n||{},f=t(o)?o:"",l=new r(u,c,f,i);p.length>=(null!==(s=null===(a=this._client)||void 0===a?void 0:a._config.maxActions)&&void 0!==s?s:30)&&p.shift(),p.push(l)},n.prototype.getUser=function(){return this.user},n.prototype.setUser=function(t){var r;if(function(e){return"[object Object]"===Object.prototype.toString.call(e)}(t)&&Object.keys(t).length<=6)return this.user=e(e({},this.user),t),this.getUser();null===(r=this._client)||void 0===r||r._logger.warn(function(e,t){return new Error("Invalid data\n- "+e+", got "+JSON.stringify(t))}("setUser should be an object and have up to 6 attributes",t))},n.prototype.addMetaData=function(e,t){return function(e,t,r){t&&(e[t]=r)}(this.metaData,e,t)},n.prototype.getMetaData=function(e){return function(e,t){if(e[t])return e[t]}(this.metaData,e)},n.prototype.deleteMetaData=function(e){return function(e,t){if(e[t])return delete e[t]}(this.metaData,e)},n.prototype.toJSON=function(){var e=this;return{apiKey:e.apiKey,appVersion:e.appVersion,appType:e.appType,timestamp:e.timestamp,category:e.category,type:e.type,sdk:e.sdk,device:e.device,detail:e.detail,user:e.user,actions:e.actions,metaData:e.metaData,releaseStage:e.releaseStage}}}();Object.freeze({__proto__:null,UNCAUGHT_ERROR:"uncaughtError",RESOURCE_ERROR:"resourceError",UNHANDLEDREJECTION_ERROR:"unhandledrejectionError",AJAX_ERROR:"ajaxError",FETCH_ERROR:"fetchError",WEBSOCKET_ERROR:"websocketError",UNKNOWN_ERROR:"unknownError",MESSAGE:"message",FEEDBACK:"feedback",VIEW:"view",REACT:"react",VUE:"vue",ANGULAR:"angular",MINIAPP_ERROR:"miniappError",MINIAPP_UNHANDLEDREJECTION_ERROR:"miniappUnhandledrejectionError",MINIAPP_PAGENOTFOUND_ERROR:"miniappPagenotfoundError",MINIAPP_MEMORYWARNING_ERROR:"miniappMemorywarningError"});return{name:"OhbugVue",init:function(e,t){if(!t)throw new Error("Ohbug @ohbug/vue reference to `Vue` was undefined");return function(e,t){var r=t.config.errorHandler;t.config.errorHandler=function(t,n,o){var i=function(e){if(e.$root===e)return{component:"Root"};var t=e.$options;return{component:t.name,file:t.__file}}(n),a=i.component,s=i.file,p={name:t.name,message:t.message,stack:t.stack,errorInfo:o,component:a,file:s,props:n?n.$options.propsData:void 0},u=e.createEvent({category:"error",type:"vue",detail:p});e.notify(u),"undefined"!=typeof console&&"function"==typeof console.error&&console.error(t),"function"==typeof r&&r(t,n,o)}}(e,t)}}}));