@arms/rum-miniapp 0.1.5 → 0.1.7

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.
Files changed (90) hide show
  1. package/README.md +146 -9
  2. package/dist/miniapp-sdk.js +1 -1
  3. package/docs/SDK/347/211/210/346/234/254/350/257/264/346/230/216.md +71 -0
  4. package/docs/SDK/351/205/215/347/275/256/345/217/202/350/200/203.md +523 -0
  5. package/docs//346/216/245/345/205/245/345/260/217/347/250/213/345/272/217/345/272/224/347/224/250.md +272 -0
  6. package/es/collector/action/index.d.ts +14 -0
  7. package/es/collector/action/index.js +1 -0
  8. package/es/collector/application/index.d.ts +15 -0
  9. package/es/collector/application/index.js +5 -0
  10. package/es/collector/exception/index.d.ts +29 -0
  11. package/es/collector/exception/index.js +7 -0
  12. package/es/collector/longtask/render-block.d.ts +15 -0
  13. package/es/collector/longtask/render-block.js +1 -0
  14. package/es/collector/resource/api.d.ts +28 -0
  15. package/es/collector/resource/api.js +19 -0
  16. package/es/collector/resource/static-resource.d.ts +10 -0
  17. package/es/collector/resource/static-resource.js +148 -0
  18. package/es/collector/view/perf.d.ts +26 -0
  19. package/es/collector/view/perf.js +10 -0
  20. package/es/collector/view/pv.d.ts +12 -0
  21. package/es/collector/view/pv.js +2 -0
  22. package/es/configManager.d.ts +13 -0
  23. package/es/configManager.js +7 -0
  24. package/es/empty.js +1 -0
  25. package/es/index.d.ts +3 -0
  26. package/es/index.js +1 -0
  27. package/es/processor/default-processor.d.ts +5 -0
  28. package/es/processor/default-processor.js +1 -0
  29. package/es/processor/session-processor.d.ts +8 -0
  30. package/es/processor/session-processor.js +1 -0
  31. package/es/reporter/index.d.ts +10 -0
  32. package/es/reporter/index.js +3 -0
  33. package/es/shell.d.ts +42 -0
  34. package/es/shell.js +10 -0
  35. package/es/style.js +1 -0
  36. package/es/types/client.d.ts +39 -0
  37. package/es/types/client.js +1 -0
  38. package/es/utils/api.d.ts +43 -0
  39. package/es/utils/api.js +3 -0
  40. package/es/utils/base.d.ts +19 -0
  41. package/es/utils/base.js +16 -0
  42. package/es/utils/constants.d.ts +1 -0
  43. package/es/utils/constants.js +1 -0
  44. package/es/utils/hackApp.d.ts +3 -0
  45. package/es/utils/hackApp.js +2 -0
  46. package/es/utils/hackComponent.d.ts +3 -0
  47. package/es/utils/hackComponent.js +5 -0
  48. package/es/utils/hackPage.d.ts +3 -0
  49. package/es/utils/hackPage.js +2 -0
  50. package/es/utils/network.d.ts +1 -0
  51. package/es/utils/network.js +1 -0
  52. package/es/utils/platform.d.ts +41 -0
  53. package/es/utils/platform.js +6 -0
  54. package/es/utils/session.d.ts +26 -0
  55. package/es/utils/session.js +4 -0
  56. package/es/utils/sse.d.ts +23 -0
  57. package/es/utils/sse.js +14 -0
  58. package/es/utils/url.d.ts +29 -0
  59. package/es/utils/url.js +16 -0
  60. package/es/utils/view.d.ts +32 -0
  61. package/es/utils/view.js +31 -0
  62. package/lib/collector/action/index.js +1 -1
  63. package/lib/collector/application/index.js +2 -2
  64. package/lib/collector/exception/index.js +3 -3
  65. package/lib/collector/longtask/render-block.js +1 -1
  66. package/lib/collector/resource/api.d.ts +1 -0
  67. package/lib/collector/resource/api.js +13 -7
  68. package/lib/collector/resource/static-resource.js +10 -10
  69. package/lib/collector/view/perf.js +6 -5
  70. package/lib/collector/view/pv.js +2 -2
  71. package/lib/configManager.js +6 -5
  72. package/lib/empty.js +2 -0
  73. package/lib/processor/default-processor.js +1 -1
  74. package/lib/processor/session-processor.js +1 -1
  75. package/lib/reporter/index.js +2 -2
  76. package/lib/shell.js +6 -6
  77. package/lib/types/client.d.ts +21 -2
  78. package/lib/utils/api.d.ts +13 -0
  79. package/lib/utils/api.js +3 -1
  80. package/lib/utils/base.js +1 -1
  81. package/lib/utils/hackApp.js +2 -2
  82. package/lib/utils/hackComponent.js +2 -2
  83. package/lib/utils/hackPage.js +2 -2
  84. package/lib/utils/platform.js +1 -1
  85. package/lib/utils/session.js +4 -2
  86. package/lib/utils/sse.d.ts +23 -0
  87. package/lib/utils/sse.js +14 -0
  88. package/lib/utils/url.d.ts +15 -9
  89. package/lib/utils/url.js +10 -19
  90. package/package.json +12 -3
package/lib/utils/url.js CHANGED
@@ -1,25 +1,16 @@
1
- "use strict";exports.__esModule=!0,exports.getPathByURL=getPathByURL,exports.getURL=getURL,exports.isEndpoint=isEndpoint;/**
1
+ "use strict";var _rumCore=require("@arms/rum-core");exports.__esModule=!0,exports.getPathByURL=getPathByURL,exports.getURL=getURL,exports.isEndpoint=isEndpoint;function _createForOfIteratorHelperLoose(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(c)return(c=c.call(a)).next.bind(c);if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0;return function(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(b,c){if(b){if("string"==typeof b)return _arrayLikeToArray(b,c);var a={}.toString.call(b).slice(8,-1);return"Object"===a&&b.constructor&&(a=b.constructor.name),"Map"===a||"Set"===a?Array.from(b):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(b,c):void 0}}function _arrayLikeToArray(b,c){(null==c||c>b.length)&&(c=b.length);for(var d=0,f=Array(c);d<c;d++)f[d]=b[d];return f}/**
2
2
  * 根据指定 URL 获取视图的名称,默认为其path部分
3
3
  * @param url 需要提取路径部分的 URL
4
4
  * @param isHash 是否为 hash 模式路由的 URL
5
- */function getPathByURL(a,b){void 0===b&&(b=!1);try{var c=getURL(a);return b?c.hash:c.pathname}catch(a){return""}}/**
5
+ */function getPathByURL(a,b=!1){try{var c=getURL(a);return b?c.hash:c.pathname}catch(a){return""}}/**
6
6
  * 检查是否为上报域名
7
7
  * @param ctx
8
8
  * @param url 需要提取路径部分的 URL
9
- */function isEndpoint(a,b){var c=a.getConfig(),d=c.endpoint;try{return getURL(b).hostname===getURL(d).hostname}catch(a){return!1}}var REGEX=/^(?:([^:\/?#]+):\/\/)?((?:([^\/?#@]*)@)?([^\/?#:]*)(?:\:(\d*))?)?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n)*))?/i;// function mapSearchParams(search: string) {
10
- // const map = {}
11
- // if (typeof search === 'string') {
12
- // search.split('&').forEach(function (str) {
13
- // let values = str.split('=')
14
- // if (map.hasOwnProperty(values[0])) {
15
- // map[values[0]] = Array.isArray(map[values[0]]) ? map[values[0]] : [map[values[0]]]
16
- // map[values[0]].push(values[1])
17
- // } else {
18
- // map[values[0]] = values[1]
19
- // }
20
- // })
21
- // return map
22
- // }
23
- // }
24
- function getURL(a){var b=decodeURIComponent(a).match(REGEX),c=(b[3]||"").split(":"),d=c.length?(b[2]||"").replace(/(.*\@)/,""):b[2];return{uri:b[0],protocol:b[1],host:d,hostname:b[4],port:b[5],pathname:b[6],search:b[7],// query: mapSearchParams(parts[7]),
25
- hash:b[8]}}
9
+ */function isEndpoint(a,b){var c=a.getConfig(),d=c.endpoint;try{return getURL(b).hostname===getURL(d).hostname}catch(a){return!1}}var REGEX=/^(?:([^:\/?#]+):\/\/)?((?:([^\/?#@]*)@)?([^\/?#:]*)(?:\:(\d*))?)?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n)*))?/i;/**
10
+ * 安全解码 URL 组件,失败时返回原始字符串
11
+ */function safeDecode(a){if(!a)return"";try{return decodeURIComponent(a)}catch(b){return a}}/**
12
+ * 解析查询字符串为键值对对象
13
+ */function getSearchParams(a){var b={};if(!a)return b;for(var c,d,e=a.split("&"),f=_createForOfIteratorHelperLoose(e);!(c=f()).done;)if(d=c.value,d){var g=d.indexOf("=");if(!(0>g)){var h=safeDecode(d.slice(0,g)),i=safeDecode(d.slice(g+1));if(h){var j=b[h];b[h]=void 0===j?i:(0,_rumCore.isArray)(j)?[...j,i]:[j,i]}}}return b}/**
14
+ * 解析 URL 字符串为结构化对象
15
+ */function getURL(a){if("string"!=typeof a||!a)return{uri:"",protocol:void 0,host:void 0,hostname:void 0,port:void 0,pathname:void 0,search:void 0,hash:void 0,searchParams:{}};var b=safeDecode(a),c=b.match(REGEX);if(!c)return{uri:a,protocol:void 0,host:void 0,hostname:void 0,port:void 0,pathname:void 0,search:void 0,hash:void 0,searchParams:{}};// 提取 host,移除认证信息(如果有)
16
+ var d=c[2]||"",e=d.includes("@")?d.replace(/^[^@]+@/,""):d;return{uri:c[0]||"",protocol:c[1],host:e||void 0,hostname:c[4],port:c[5],pathname:c[6],search:c[7],hash:c[8],searchParams:getSearchParams(c[7])}}
package/package.json CHANGED
@@ -1,17 +1,21 @@
1
1
  {
2
2
  "name": "@arms/rum-miniapp",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "arms rum javascript sdk for miniapp",
5
5
  "author": "guangli.fj <guangli.fj@alibaba-inc.com>",
6
6
  "license": "ISC",
7
7
  "main": "dist/miniapp-sdk.js",
8
+ "module": "es/index.js",
8
9
  "directories": {
9
10
  "lib": "lib",
11
+ "es": "es",
10
12
  "test": "__tests__"
11
13
  },
12
14
  "files": [
15
+ "dist",
13
16
  "lib",
14
- "dist"
17
+ "es",
18
+ "docs"
15
19
  ],
16
20
  "publishConfig": {
17
21
  "access": "public"
@@ -23,11 +27,16 @@
23
27
  "test": "node ./__tests__/@arms/miniapp.test.js"
24
28
  },
25
29
  "dependencies": {
26
- "@arms/rum-core": "0.1.3"
30
+ "@arms/rum-core": "0.1.5"
27
31
  },
28
32
  "peerDependencies": {
29
33
  "@babel/runtime": "^7.24.5"
30
34
  },
35
+ "peerDependenciesMeta": {
36
+ "@babel/runtime": {
37
+ "optional": true
38
+ }
39
+ },
31
40
  "devDependencies": {
32
41
  "typescript": "^4.9.4"
33
42
  }