web-tracing-core 2.1.0 → 2.1.1
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/README.md → README.md} +8 -0
- package/{dist/index.cjs → index.cjs} +24 -5
- package/{dist/index.iife.js → index.iife.js} +24 -5
- package/{dist/index.iife.min.js → index.iife.min.js} +9 -9
- package/{dist/index.mjs → index.mjs} +24 -5
- package/package.json +9 -9
- package/__test__/css/performance.css +0 -3
- package/__test__/err-batch.spec.ts +0 -47
- package/__test__/err.spec.ts +0 -82
- package/__test__/event.spec.ts +0 -62
- package/__test__/html/performance.html +0 -57
- package/__test__/html/recordscreen.html +0 -39
- package/__test__/http.spec.ts +0 -143
- package/__test__/img/performance.png +0 -0
- package/__test__/js/performance.js +0 -3
- package/__test__/performance.spec.ts +0 -112
- package/__test__/recordscreen.spec.ts +0 -50
- package/__test__/utils/index.ts +0 -99
- package/__test__/utils/pollify.ts +0 -14
- package/__test__/utils.spec.ts +0 -18
- package/dist/package.json +0 -49
- package/index.ts +0 -75
- package/src/common/config.ts +0 -13
- package/src/common/constant.ts +0 -57
- package/src/common/index.ts +0 -2
- package/src/lib/base.ts +0 -129
- package/src/lib/err-batch.ts +0 -134
- package/src/lib/err.ts +0 -323
- package/src/lib/event-dwell.ts +0 -63
- package/src/lib/event.ts +0 -252
- package/src/lib/eventBus.ts +0 -97
- package/src/lib/exportMethods.ts +0 -208
- package/src/lib/http.ts +0 -197
- package/src/lib/intersectionObserver.ts +0 -164
- package/src/lib/line-status.ts +0 -45
- package/src/lib/options.ts +0 -325
- package/src/lib/performance.ts +0 -302
- package/src/lib/pv.ts +0 -199
- package/src/lib/recordscreen.ts +0 -169
- package/src/lib/replace.ts +0 -371
- package/src/lib/sendData.ts +0 -264
- package/src/observer/computed.ts +0 -52
- package/src/observer/config.ts +0 -1
- package/src/observer/dep.ts +0 -21
- package/src/observer/index.ts +0 -91
- package/src/observer/ref.ts +0 -80
- package/src/observer/types.ts +0 -22
- package/src/observer/watch.ts +0 -19
- package/src/observer/watcher.ts +0 -88
- package/src/types/index.ts +0 -126
- package/src/utils/debug.ts +0 -17
- package/src/utils/element.ts +0 -47
- package/src/utils/fingerprintjs.ts +0 -2132
- package/src/utils/getIps.ts +0 -127
- package/src/utils/global.ts +0 -49
- package/src/utils/index.ts +0 -551
- package/src/utils/is.ts +0 -78
- package/src/utils/localStorage.ts +0 -70
- package/src/utils/session.ts +0 -27
- /package/{dist/LICENSE → LICENSE} +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
|
|
20
20
|
[vue3版本 https://github.com/M-cheng-web/web-tracing-examples-vue3](https://github.com/M-cheng-web/web-tracing-examples-vue3)
|
|
21
21
|
|
|
22
|
+
[react版本 https://github.com/boychina/web-tracing-examples-react](https://github.com/boychina/web-tracing-examples-react)
|
|
23
|
+
|
|
24
|
+
[nuxt版本 https://github.com/boychina/web-tracing-examples-nuxt](https://github.com/boychina/web-tracing-examples-nuxt)
|
|
25
|
+
|
|
22
26
|
## 演示
|
|
23
27
|
### 事件监听
|
|
24
28
|
<img src="https://github.com/M-cheng-web/image-provider/raw/main/web-tracing/image.4388hbrc1gc0.jpg" width="1200" alt="logo" />
|
|
@@ -63,6 +67,10 @@
|
|
|
63
67
|
|
|
64
68
|
针对首屏加载的监控做出更多精细化的东西,例如考虑sdk的绝对轻量化
|
|
65
69
|
|
|
70
|
+
## 三方监控平台
|
|
71
|
+
目前支持的三方监控平台有:
|
|
72
|
+
+ [WebTracingAnalysis](https://github.com/boychina/web-tracing-analysis) : Spring Boot + MySQL + React + Ant Design(支持容器化部署)
|
|
73
|
+
|
|
66
74
|
## 联系我
|
|
67
75
|
<img align="left" width="180" src="https://github.com/M-cheng-web/image-provider/raw/main/web-tracing/image.19hrnxwgkdpc.jpg" />
|
|
68
76
|
|
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
if (typeof window === "undefined" && typeof global !== "undefined") {
|
|
6
|
+
global.window = global;
|
|
7
|
+
global.self = global;
|
|
8
|
+
if (!global.requestAnimationFrame) {
|
|
9
|
+
global.requestAnimationFrame = (callback) => setTimeout(callback, 0);
|
|
10
|
+
}
|
|
11
|
+
if (!global.cancelAnimationFrame) {
|
|
12
|
+
global.cancelAnimationFrame = (id) => clearTimeout(id);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
5
16
|
function isType(type) {
|
|
6
17
|
return function(value) {
|
|
7
18
|
return Object.prototype.toString.call(value) === `[object ${type}]`;
|
|
@@ -22,7 +33,7 @@ function isEmpty(wat) {
|
|
|
22
33
|
}
|
|
23
34
|
|
|
24
35
|
const isBrowserEnv = isWindow(typeof window !== "undefined" ? window : 0);
|
|
25
|
-
const isElectronEnv = !!window
|
|
36
|
+
const isElectronEnv = typeof window !== "undefined" && !!window.process?.versions?.electron;
|
|
26
37
|
const isTestEnv = typeof navigator !== "undefined" && navigator.userAgent.includes("jsdom") || // @ts-expect-error: jsdom
|
|
27
38
|
typeof window !== "undefined" && window.jsdom;
|
|
28
39
|
function getGlobal() {
|
|
@@ -681,6 +692,8 @@ function uuid() {
|
|
|
681
692
|
return `${guid.slice(0, 8)}-${guid.slice(8, 16)}-${guid.slice(16)}`;
|
|
682
693
|
}
|
|
683
694
|
function getCookieByName(name) {
|
|
695
|
+
if (typeof document === "undefined")
|
|
696
|
+
return void 0;
|
|
684
697
|
const result = document.cookie.match(new RegExp(`${name}=([^;]+)(;|$)`));
|
|
685
698
|
return result ? result[1] : void 0;
|
|
686
699
|
}
|
|
@@ -764,7 +777,7 @@ const arrayFilter = Array.prototype.filter || function filterPolyfill(fn) {
|
|
|
764
777
|
function filter(arr, fn) {
|
|
765
778
|
return arrayFilter.call(arr, fn);
|
|
766
779
|
}
|
|
767
|
-
const nextTime = window.requestIdleCallback || window.requestAnimationFrame || ((callback) => setTimeout(callback, 17));
|
|
780
|
+
const nextTime = typeof window !== "undefined" && window.requestIdleCallback || typeof window !== "undefined" && window.requestAnimationFrame || ((callback) => setTimeout(callback, 17));
|
|
768
781
|
function isObjectOverSizeLimit(object, limitInKB) {
|
|
769
782
|
const serializedObject = JSON.stringify(object);
|
|
770
783
|
const sizeInBytes = new TextEncoder().encode(serializedObject).length;
|
|
@@ -813,7 +826,7 @@ function off(target, eventName, handler, opitons = false) {
|
|
|
813
826
|
target.removeEventListener(eventName, handler, opitons);
|
|
814
827
|
}
|
|
815
828
|
|
|
816
|
-
var version$1 = "2.1.
|
|
829
|
+
var version$1 = "2.1.1";
|
|
817
830
|
|
|
818
831
|
const DEVICE_KEY = "_webtracing_device_id";
|
|
819
832
|
const SESSION_KEY = "_webtracing_session_id";
|
|
@@ -2836,7 +2849,9 @@ function refreshSession() {
|
|
|
2836
2849
|
function getSessionId() {
|
|
2837
2850
|
return getCookieByName(SESSION_KEY) || refreshSession();
|
|
2838
2851
|
}
|
|
2839
|
-
|
|
2852
|
+
if (typeof document !== "undefined") {
|
|
2853
|
+
refreshSession();
|
|
2854
|
+
}
|
|
2840
2855
|
|
|
2841
2856
|
function is_ipv4(d) {
|
|
2842
2857
|
return regex_v4.test(d);
|
|
@@ -15681,7 +15696,11 @@ class Intersection {
|
|
|
15681
15696
|
sendData.emit({
|
|
15682
15697
|
eventType: SEDNEVENTTYPES.INTERSECTION,
|
|
15683
15698
|
triggerPageUrl: getLocationHref(),
|
|
15684
|
-
|
|
15699
|
+
threshold: targetObj.threshold,
|
|
15700
|
+
observeTime: targetObj.observeTime,
|
|
15701
|
+
showTime: targetObj.showTime,
|
|
15702
|
+
showEndTime: targetObj.showEndTime,
|
|
15703
|
+
params: targetObj.params
|
|
15685
15704
|
});
|
|
15686
15705
|
}
|
|
15687
15706
|
/**
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
(function (exports) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
if (typeof window === "undefined" && typeof global !== "undefined") {
|
|
5
|
+
global.window = global;
|
|
6
|
+
global.self = global;
|
|
7
|
+
if (!global.requestAnimationFrame) {
|
|
8
|
+
global.requestAnimationFrame = (callback) => setTimeout(callback, 0);
|
|
9
|
+
}
|
|
10
|
+
if (!global.cancelAnimationFrame) {
|
|
11
|
+
global.cancelAnimationFrame = (id) => clearTimeout(id);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
4
15
|
function isType(type) {
|
|
5
16
|
return function(value) {
|
|
6
17
|
return Object.prototype.toString.call(value) === `[object ${type}]`;
|
|
@@ -21,7 +32,7 @@
|
|
|
21
32
|
}
|
|
22
33
|
|
|
23
34
|
const isBrowserEnv = isWindow(typeof window !== "undefined" ? window : 0);
|
|
24
|
-
const isElectronEnv = !!window
|
|
35
|
+
const isElectronEnv = typeof window !== "undefined" && !!window.process?.versions?.electron;
|
|
25
36
|
const isTestEnv = typeof navigator !== "undefined" && navigator.userAgent.includes("jsdom") || // @ts-expect-error: jsdom
|
|
26
37
|
typeof window !== "undefined" && window.jsdom;
|
|
27
38
|
function getGlobal() {
|
|
@@ -680,6 +691,8 @@
|
|
|
680
691
|
return `${guid.slice(0, 8)}-${guid.slice(8, 16)}-${guid.slice(16)}`;
|
|
681
692
|
}
|
|
682
693
|
function getCookieByName(name) {
|
|
694
|
+
if (typeof document === "undefined")
|
|
695
|
+
return void 0;
|
|
683
696
|
const result = document.cookie.match(new RegExp(`${name}=([^;]+)(;|$)`));
|
|
684
697
|
return result ? result[1] : void 0;
|
|
685
698
|
}
|
|
@@ -763,7 +776,7 @@
|
|
|
763
776
|
function filter(arr, fn) {
|
|
764
777
|
return arrayFilter.call(arr, fn);
|
|
765
778
|
}
|
|
766
|
-
const nextTime = window.requestIdleCallback || window.requestAnimationFrame || ((callback) => setTimeout(callback, 17));
|
|
779
|
+
const nextTime = typeof window !== "undefined" && window.requestIdleCallback || typeof window !== "undefined" && window.requestAnimationFrame || ((callback) => setTimeout(callback, 17));
|
|
767
780
|
function isObjectOverSizeLimit(object, limitInKB) {
|
|
768
781
|
const serializedObject = JSON.stringify(object);
|
|
769
782
|
const sizeInBytes = new TextEncoder().encode(serializedObject).length;
|
|
@@ -812,7 +825,7 @@
|
|
|
812
825
|
target.removeEventListener(eventName, handler, opitons);
|
|
813
826
|
}
|
|
814
827
|
|
|
815
|
-
var version$1 = "2.1.
|
|
828
|
+
var version$1 = "2.1.1";
|
|
816
829
|
|
|
817
830
|
const DEVICE_KEY = "_webtracing_device_id";
|
|
818
831
|
const SESSION_KEY = "_webtracing_session_id";
|
|
@@ -2835,7 +2848,9 @@
|
|
|
2835
2848
|
function getSessionId() {
|
|
2836
2849
|
return getCookieByName(SESSION_KEY) || refreshSession();
|
|
2837
2850
|
}
|
|
2838
|
-
|
|
2851
|
+
if (typeof document !== "undefined") {
|
|
2852
|
+
refreshSession();
|
|
2853
|
+
}
|
|
2839
2854
|
|
|
2840
2855
|
function is_ipv4(d) {
|
|
2841
2856
|
return regex_v4.test(d);
|
|
@@ -15680,7 +15695,11 @@
|
|
|
15680
15695
|
sendData.emit({
|
|
15681
15696
|
eventType: SEDNEVENTTYPES.INTERSECTION,
|
|
15682
15697
|
triggerPageUrl: getLocationHref(),
|
|
15683
|
-
|
|
15698
|
+
threshold: targetObj.threshold,
|
|
15699
|
+
observeTime: targetObj.observeTime,
|
|
15700
|
+
showTime: targetObj.showTime,
|
|
15701
|
+
showEndTime: targetObj.showEndTime,
|
|
15702
|
+
params: targetObj.params
|
|
15684
15703
|
});
|
|
15685
15704
|
}
|
|
15686
15705
|
/**
|