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

@arms/rum-miniapp

Package Overview
Dependencies
Maintainers
0
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.31 to 0.0.32

5

lib/collector/application/index.d.ts
import { ICollector, IContext, RumEvent } from '@arms/rum-core';
/**
* 参考资料:
* - 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
*/
export default class ApplicationCollector implements ICollector {

@@ -3,0 +8,0 @@ name: string;

11

lib/collector/application/index.js

@@ -1,6 +0,5 @@

"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule=!0,exports["default"]=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_rumCore=require("@arms/rum-core"),_platform=require("../../utils/platform"),ApplicationCollector=exports["default"]=/*#__PURE__*/function(){function a(){var a=this;this.name="application-collector",this.ctx=void 0,this.sendEvent=void 0,this.perfObserver=void 0,this.observerHandler=function(b){console.log("observerHandler",b);var c=(0,_rumCore.isArray)(b)?b:b.getEntries();if(Array.isArray(c)&&0<c.length)for(var d,e=0;e<c.length;e++)if(d=c[e],"number"==typeof d.duration&&0<d.duration){var f=a.ctx.session.getBaseEvent(),g=(0,_extends2["default"])({},f,{event_type:_rumCore.RumEventType.APPLICATION,// type: 'launch',
state:"",duration:0,snapshots:JSON.stringify(d)});switch(d.name){case"appLaunch":case"app-click":g.state="cold_lunch",g.duration=d.duration;break;case"downloadPackage":case"miniprogram-package":g.state="download_package",g.duration=d.duration;break;case"evaluateScript":case"app-service":var h=d.moduleName||d.packageName;"__APP__"===h&&(g.state="evaluate_script",g.duration=d.duration);break;default:}g.name&&0<g.duration&&6e5>g.duration&&a.sendEvent(g)}}}var b=a.prototype;return b.setup=function setup(a,b){var c=this,d=a.getConfig(),e=d.collectors,f=void 0===e?{}:e;if(!1!==f.application){this.ctx=a,this.sendEvent=b;var g=(0,_platform.getPerformance)();if(g&&g.createObserver){var h=[];if("wechat"===_platform.appName||"alipay"===_platform.appName)h=["navigation","script","loadPackage"];else if("bytedance"===_platform.appName)h=["launch","evaluate","resource"];else return;(0,_rumCore.delay)(function(){c.observerHandler(g.getEntries().filter(function(a){return h.includes(a.entryType)})),c.perfObserver=g.createObserver(c.observerHandler),c.perfObserver.observe({entryTypes:h})},1e3)}}},b.destroy=function destroy(){this.perfObserver&&this.perfObserver.disconnect()},a}();/*
* 参考资料:
* 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
* */
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule=!0,exports["default"]=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_rumCore=require("@arms/rum-core"),_platform=_interopRequireWildcard(require("../../utils/platform"));function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(b,c){if(!c&&b&&b.__esModule)return b;if(null===b||"object"!=typeof b&&"function"!=typeof b)return{default:b};var d=_getRequireWildcardCache(c);if(d&&d.has(b))return d.get(b);var e={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in b)if("default"!=a&&{}.hasOwnProperty.call(b,a)){var g=f?Object.getOwnPropertyDescriptor(b,a):null;g&&(g.get||g.set)?Object.defineProperty(e,a,g):e[a]=b[a]}return e["default"]=b,d&&d.set(b,e),e}/**
* 参考资料:
* - 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
*/var ApplicationCollector=exports["default"]=/*#__PURE__*/function(){function a(){var a=this;this.name="application-collector",this.ctx=void 0,this.sendEvent=void 0,this.perfObserver=void 0,this.observerHandler=function(b){var c,d=(0,_rumCore.isArray)(b)?b:b.getEntries();if((0,_rumCore.isFunction)(_platform["default"].getLaunchOptionsSync)){var e;c=null===(e=_platform["default"].getLaunchOptionsSync())||void 0===e?void 0:e.scene}if(Array.isArray(d)&&0<d.length)for(var f,g=0;g<d.length;g++)if(f=d[g],"number"==typeof f.duration&&0<f.duration){var h=a.ctx.session.getBaseEvent(),j=(0,_extends2["default"])({},h,{event_type:_rumCore.RumEventType.APPLICATION,state:"",duration:0,snapshots:JSON.stringify(f),scene:c});switch(f.name){case"appLaunch":case"app-click":j.state="cold_lunch",j.duration=f.duration;break;case"downloadPackage":case"miniprogram-package":j.state="download_package",j.duration=f.duration;break;case"evaluateScript":case"app-service":var k=f.moduleName||f.packageName;"__APP__"===k&&(j.state="evaluate_script",j.duration=f.duration);break;default:}j.state&&0<j.duration&&6e5>j.duration&&a.sendEvent(j)}}}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.application){this.ctx=a,this.sendEvent=b;var f=(0,_platform.getPerformance)();if(f&&(0,_rumCore.isFunction)(f.createObserver)){var g=[];if("wechat"===_platform.appName||"alipay"===_platform.appName)g=["navigation","script","loadPackage"];else if("bytedance"===_platform.appName)g=["launch","evaluate","resource"];else return;this.observerHandler(f.getEntries().filter(function(a){return g.includes(a.entryType)})),this.perfObserver=f.createObserver(this.observerHandler),this.perfObserver.observe({entryTypes:g})}}},b.destroy=function destroy(){this.perfObserver&&this.perfObserver.disconnect()},a}();

@@ -15,5 +15,6 @@ export declare const VERSION: string;

performance: any;
getLaunchOptionsSync: () => any;
}
export declare const sdk: SDK, appName: string;
export declare function getStorageSync(key: any): any;
export declare function getStorageSync(key: string): any;
export declare function setStorageSync(key: string, data: string): void;

@@ -20,0 +21,0 @@ export declare function getPerformance(): any;

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

"use strict";exports.__esModule=!0,exports["default"]=exports.appName=exports.VERSION=exports.HEADER_KEY=void 0,exports.getPerformance=getPerformance,exports.getStorageSync=getStorageSync,exports.sdk=void 0,exports.setStorageSync=setStorageSync;var VERSION=exports.VERSION='npm-0.0.31',OBJ="object",qqName="qq",bytedanceName="bytedance",wechatName="wechat",dingtalkName="dingtalk",alipayName="alipay",swanName="swan",jdName="jd";/**
"use strict";exports.__esModule=!0,exports["default"]=exports.appName=exports.VERSION=exports.HEADER_KEY=void 0,exports.getPerformance=getPerformance,exports.getStorageSync=getStorageSync,exports.sdk=void 0,exports.setStorageSync=setStorageSync;var VERSION=exports.VERSION='npm-0.0.32',OBJ="object",qqName="qq",bytedanceName="bytedance",wechatName="wechat",dingtalkName="dingtalk",alipayName="alipay",swanName="swan",jdName="jd";function isFunc(a){return"function"==typeof a}/**
* 获取跨平台的 SDK

@@ -6,2 +6,2 @@ */function getSDK(){var a,b="unknown";if(typeof swan===OBJ)a=swan,b=swanName;else if(typeof qq===OBJ)// qq的全局也有wx命名空间,和qq等效,这会导致判断AppName失效

a=tt,b=bytedanceName;else if(typeof dd===OBJ)// dd 必须出现在 my之前,因为现在dd环境里也有my
a=dd,b=dingtalkName;else if(typeof my===OBJ)a=my,b=alipayName;else if(typeof jd===OBJ)a=jd,b=jdName;else if(typeof wx===OBJ)a=wx,b=wechatName;else throw new Error("Current platform is not supported.");return{sdk:a,appName:b}}var _getSDK=getSDK(),sdk=exports.sdk=_getSDK.sdk,appName=exports.appName=_getSDK.appName;function getStorageSync(a){return"function"==typeof sdk.getStorageSync?appName===alipayName||appName===dingtalkName?sdk.getStorageSync({key:a}).data:sdk.getStorageSync(a):void 0}function setStorageSync(a,b){return"function"==typeof sdk.setStorageSync?appName===alipayName||appName===dingtalkName?sdk.setStorageSync({key:a,data:b}):sdk.setStorageSync(a,b):void 0}function getPerformance(){return"function"==typeof sdk.getPerformance?sdk.getPerformance():"performance"in sdk?sdk.performance:void 0}var HEADER_KEY=exports.HEADER_KEY=function(){return"alipay"===appName?"headers":"header"}(),_default=exports["default"]=sdk;
a=dd,b=dingtalkName;else if(typeof my===OBJ)a=my,b=alipayName;else if(typeof jd===OBJ)a=jd,b=jdName;else if(typeof wx===OBJ)a=wx,b=wechatName;else throw new Error("Current platform is not supported.");return{sdk:a,appName:b}}var _getSDK=getSDK(),sdk=exports.sdk=_getSDK.sdk,appName=exports.appName=_getSDK.appName;function getStorageSync(a){return isFunc(sdk.getStorageSync)?appName===alipayName||appName===dingtalkName?sdk.getStorageSync({key:a}).data:sdk.getStorageSync(a):void 0}function setStorageSync(a,b){return isFunc(sdk.getStorageSync)?appName===alipayName||appName===dingtalkName?sdk.setStorageSync({key:a,data:b}):sdk.setStorageSync(a,b):void 0}function getPerformance(){return isFunc(sdk.getPerformance)?sdk.getPerformance():"performance"in sdk?sdk.performance:void 0}var HEADER_KEY=exports.HEADER_KEY=function(){return"alipay"===appName?"headers":"header"}(),_default=exports["default"]=sdk;
{
"name": "@arms/rum-miniapp",
"version": "0.0.31",
"version": "0.0.32",
"description": "arms rum javascript sdk for miniapp",

@@ -20,3 +20,3 @@ "author": "guangli.fj <guangli.fj@alibaba-inc.com>",

"scripts": {
"start": "build-scripts build --config build.dev.json",
"start": "build-scripts build --config build.dev.json --skip-demo",
"build": "build-scripts build --skip-demo",

@@ -27,8 +27,10 @@ "prepublishOnly": "npm run build",

"dependencies": {
"@arms/rum-core": "0.0.31"
"@arms/rum-core": "0.0.32"
},
"peerDependencies": {
"@babel/runtime": "^7.24.5"
},
"devDependencies": {
"@babel/runtime": "^7.24.5",
"typescript": "^4.9.4"
}
}

Sorry, the diff of this file is too big to display

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