Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@arms/rum-miniapp

Package Overview
Dependencies
Maintainers
5
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arms/rum-miniapp - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

lib/collector/exception/index.js

@@ -1,2 +0,2 @@

"use strict";exports.__esModule=!0,exports["default"]=void 0;var _rumCore=require("@arms/rum-core"),_base=require("@arms/rum-core/src/utils/base"),_view=require("../../utils/view"),ExceptionCollector=exports["default"]=/*#__PURE__*/function(){function a(){this.name="exception-collector",this.ctx=void 0,this.sendEvent=void 0,this.origin={app:App,consoleError:console.error}}var b=a.prototype;return b.setup=function setup(a,b){this.ctx=a,this.sendEvent=b,this.hackOrigin()},b.hackOrigin=function hackOrigin(){var a=this,b=this.ctx.getConfig(),c=b.collectors,d=void 0===c?{}:c;!1!==d.jsError&&(App=function App(b){b||(b={}),(0,_base.interceptFunction)(b,"onError",function(b){a.sendError(b)}),a.origin.app(b)}),!1!==d.consoleError&&(0,_base.interceptFunction)(console,"error",function(b){a.sendError(b)})},b.sendError=function sendError(a){var b,c,d,e,f,g,h=(0,_view.getCurView)(this.ctx);if(a instanceof Object)b=a.name,c=a.message,d=a.filename||a.fileName,e=a.stack,f=a.lineno||a.lineNumber,g=a.colno||a.columnNumber;else if("string"==typeof a){e=a;var i=this.getErrorByStack(a);i&&(b=i.name,c=i.message)}b&&c&&this.sendEvent({event_type:_rumCore.RumEventType.EXCEPTION,source:"event",type:"error",name:b,message:c,file:d,stack:e,line:f,column:g,times:1,view:h})}/**
"use strict";exports.__esModule=!0,exports["default"]=void 0;var _rumCore=require("@arms/rum-core"),_view=require("../../utils/view"),ExceptionCollector=exports["default"]=/*#__PURE__*/function(){function a(){this.name="exception-collector",this.ctx=void 0,this.sendEvent=void 0,this.origin={app:App,consoleError:console.error}}var b=a.prototype;return b.setup=function setup(a,b){this.ctx=a,this.sendEvent=b,this.hackOrigin()},b.hackOrigin=function hackOrigin(){var a=this,b=this.ctx.getConfig(),c=b.collectors,d=void 0===c?{}:c;!1!==d.jsError&&(App=function App(b){b||(b={}),(0,_rumCore.interceptFunction)(b,"onError",function(b){a.sendError(b)}),a.origin.app(b)}),!1!==d.consoleError&&(0,_rumCore.interceptFunction)(console,"error",function(b){a.sendError(b)})},b.sendError=function sendError(a){var b,c,d,e,f,g,h=(0,_view.getCurView)(this.ctx);if(a instanceof Object)b=a.name,c=a.message,d=a.filename||a.fileName,e=a.stack,f=a.lineno||a.lineNumber,g=a.colno||a.columnNumber;else if("string"==typeof a){e=a;var i=this.getErrorByStack(a);i&&(b=i.name,c=i.message)}b&&c&&this.sendEvent({event_type:_rumCore.RumEventType.EXCEPTION,source:"event",type:"error",name:b,message:c,file:d,stack:e,line:f,column:g,times:1,view:h})}/**
* 根据stack获取Error信息

@@ -3,0 +3,0 @@ * TODO: 增加基于Stack解析filename和lineNumber的能力

@@ -1,1 +0,7 @@

"use strict";exports.__esModule=!0,exports["default"]=void 0;var _platform=require("../../utils/platform"),PerfCollector=exports["default"]=/*#__PURE__*/function(){function a(){this.name="perf-collector",this.ctx=void 0,this.sendEvent=void 0,this.perfObserver=void 0,this.observerHandler=function(a){var b=a.getEntries(),c={};if(Array.isArray(b)&&0<b.length)for(var d,e=0;e<b.length;e++)if(d=b[e],"number"==typeof d.duration)switch(d.name){case"appLaunch":c.launch=d.duration;break;case"firstPaint":c.fp=d.duration;break;case"firstRender":c.fpt=d.duration;break;case"firstContentfulPaint":c.fcp=d.duration;break;case"largestContentfulPaint":c.lcp=d.duration;break;default:}!Object.keys(c).length}}var b=a.prototype;return b.setup=function setup(a,b){var c=a.getConfig(),d=c.collectors,e=void 0===d?{}:d;if(!1!==e.perf){this.ctx=a,this.sendEvent=b;var f=(0,_platform.getPerformance)();f&&f.createObserver&&(this.perfObserver=f.createObserver(this.observerHandler),this.perfObserver.observe({entryTypes:["launch","navigation","render","paint"]}))}},b.destroy=function destroy(){this.perfObserver&&this.perfObserver.disconnect()},a}();// import {addPageListener, removePageListener} from "../../utils/hackPage";
"use strict";exports.__esModule=!0,exports["default"]=void 0;var _platform=require("../../utils/platform"),_view=require("../../utils/view"),PerfCollector=exports["default"]=/*#__PURE__*/function(){function a(){var a=this;this.name="perf-collector",this.ctx=void 0,this.sendEvent=void 0,this.perfObserver=void 0,this.observerHandler=function(b){var c=b.getEntries(),d={view:(0,_view.getCurView)(a.ctx)};if(Array.isArray(c)&&0<c.length)for(var e,f=0;f<c.length;f++)if(e=c[f],"number"==typeof e.duration)switch(e.name){case"appLaunch":case"app-click":d.launch=e.duration;break;case"firstPaint":d["first-paint"]=e.duration;break;case"firstRender":d.first_render=e.duration;break;case"firstContentfulPaint":d.first_contentful_paint=e.duration;break;case"largestContentfulPaint":d.largest_contentful_paint=e.duration;break;case"resourceTiming":case"resource-timing":d.timing_data=JSON.stringify(e);break;default:}Object.keys(d).length&&// TODO 处理性能数据
console.warn("perf-collector: ",d)}}var b=a.prototype;return b.setup=function setup(a,b){var c=a.getConfig(),d=c.collectors,e=void 0===d?{}:d;if(!1!==e.perf){this.ctx=a,this.sendEvent=b;var f=(0,_platform.getPerformance)();f&&f.createObserver&&(this.perfObserver=f.createObserver(this.observerHandler),this.perfObserver.observe({entryTypes:["launch","navigation","render","paint","resource"]}))}},b.destroy=function destroy(){this.perfObserver&&this.perfObserver.disconnect()},a}();// import {addPageListener, removePageListener} from "../../utils/hackPage";
/*
* 参考资料:
* https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html
* https://developer.open-douyin.com/docs/resource/zh-CN/mini-app/develop/api/foundation/performance/tt-performance/performance-entry
* */
{
"name": "@arms/rum-miniapp",
"version": "0.0.1",
"version": "0.0.2",
"description": "arms rum javascript sdk for miniapp",
"author": "guangli.fj <guangli.fj@alibaba-inc.com>",
"homepage": "https://unpkg.com/@arms/rum-miniapp@0.0.1/build/index.html",
"license": "ISC",

@@ -25,8 +24,7 @@ "main": "lib/index.js",

"dependencies": {
"@arms/rum-core": "^0.0.1"
"@arms/rum-core": "^0.0.2"
},
"devDependencies": {
"typescript": "^4.9.4"
},
"repository": "git@gitlab.alibaba-inc.com:aliyun-rum/rum-sdk.git"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc