@openreplay/tracker 3.5.8 → 3.5.11
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/cjs/app/context.js +4 -2
- package/cjs/app/index.d.ts +12 -13
- package/cjs/app/index.js +23 -21
- package/cjs/app/observer/iframe_observer.js +2 -2
- package/cjs/app/observer/observer.js +13 -13
- package/cjs/app/observer/shadow_root_observer.js +2 -2
- package/cjs/app/observer/top_observer.js +2 -2
- package/cjs/app/session.js +3 -3
- package/cjs/{messages/index.d.ts → common/messages.d.ts} +2 -3
- package/cjs/{messages/index.js → common/messages.js} +0 -0
- package/cjs/common/types.d.ts +9 -0
- package/cjs/{messages/message.js → common/types.js} +0 -0
- package/cjs/common/webworker.d.ts +19 -0
- package/cjs/{messages → common}/webworker.js +0 -0
- package/cjs/index.d.ts +2 -2
- package/cjs/index.js +7 -7
- package/cjs/modules/connection.js +2 -2
- package/cjs/modules/console.js +2 -2
- package/cjs/modules/cssrules.js +4 -4
- package/cjs/modules/exception.d.ts +1 -1
- package/cjs/modules/exception.js +4 -4
- package/cjs/modules/img.js +7 -7
- package/cjs/modules/input.js +5 -5
- package/cjs/modules/longtasks.js +2 -2
- package/cjs/modules/mouse.js +3 -7
- package/cjs/modules/performance.js +2 -2
- package/cjs/modules/scroll.js +3 -3
- package/cjs/modules/timing.js +15 -18
- package/cjs/modules/viewport.js +4 -4
- package/lib/app/context.js +4 -2
- package/lib/app/index.d.ts +12 -13
- package/lib/app/index.js +22 -20
- package/lib/app/observer/iframe_observer.js +1 -1
- package/lib/app/observer/observer.js +1 -1
- package/lib/app/observer/shadow_root_observer.js +1 -1
- package/lib/app/observer/top_observer.js +1 -1
- package/lib/app/session.js +1 -1
- package/lib/{messages/index.d.ts → common/messages.d.ts} +2 -3
- package/lib/{messages/index.js → common/messages.js} +0 -0
- package/lib/common/tsconfig.tsbuildinfo +1 -0
- package/lib/common/types.d.ts +9 -0
- package/lib/{messages/message.js → common/types.js} +0 -0
- package/lib/common/webworker.d.ts +19 -0
- package/lib/{messages → common}/webworker.js +0 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.js +4 -4
- package/lib/modules/connection.js +1 -1
- package/lib/modules/console.js +1 -1
- package/lib/modules/cssrules.js +1 -1
- package/lib/modules/exception.d.ts +1 -1
- package/lib/modules/exception.js +1 -1
- package/lib/modules/img.js +1 -1
- package/lib/modules/input.js +1 -1
- package/lib/modules/longtasks.js +1 -1
- package/lib/modules/mouse.js +1 -5
- package/lib/modules/performance.js +1 -1
- package/lib/modules/scroll.js +1 -1
- package/lib/modules/timing.js +13 -16
- package/lib/modules/viewport.js +1 -1
- package/package.json +1 -1
- package/cjs/messages/message.d.ts +0 -4
- package/cjs/messages/webworker.d.ts +0 -17
- package/cjs/messages/writer.d.ts +0 -15
- package/cjs/messages/writer.js +0 -115
- package/lib/messages/message.d.ts +0 -4
- package/lib/messages/tsconfig.tsbuildinfo +0 -1
- package/lib/messages/webworker.d.ts +0 -17
- package/lib/messages/writer.d.ts +0 -15
- package/lib/messages/writer.js +0 -112
package/lib/messages/writer.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
const textEncoder = typeof TextEncoder === 'function'
|
|
2
|
-
? new TextEncoder()
|
|
3
|
-
: {
|
|
4
|
-
// Based on https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder
|
|
5
|
-
encode(str) {
|
|
6
|
-
const Len = str.length, resArr = new Uint8Array(Len * 3);
|
|
7
|
-
let resPos = -1;
|
|
8
|
-
for (var point = 0, nextcode = 0, i = 0; i !== Len;) {
|
|
9
|
-
(point = str.charCodeAt(i)), (i += 1);
|
|
10
|
-
if (point >= 0xd800 && point <= 0xdbff) {
|
|
11
|
-
if (i === Len) {
|
|
12
|
-
resArr[(resPos += 1)] = 0xef /*0b11101111*/;
|
|
13
|
-
resArr[(resPos += 1)] = 0xbf /*0b10111111*/;
|
|
14
|
-
resArr[(resPos += 1)] = 0xbd /*0b10111101*/;
|
|
15
|
-
break;
|
|
16
|
-
}
|
|
17
|
-
// https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
|
|
18
|
-
nextcode = str.charCodeAt(i);
|
|
19
|
-
if (nextcode >= 0xdc00 && nextcode <= 0xdfff) {
|
|
20
|
-
point = (point - 0xd800) * 0x400 + nextcode - 0xdc00 + 0x10000;
|
|
21
|
-
i += 1;
|
|
22
|
-
if (point > 0xffff) {
|
|
23
|
-
resArr[(resPos += 1)] =
|
|
24
|
-
(0x1e /*0b11110*/ << 3) | (point >>> 18);
|
|
25
|
-
resArr[(resPos += 1)] =
|
|
26
|
-
(0x2 /*0b10*/ << 6) |
|
|
27
|
-
((point >>> 12) & 0x3f) /*0b00111111*/;
|
|
28
|
-
resArr[(resPos += 1)] =
|
|
29
|
-
(0x2 /*0b10*/ << 6) | ((point >>> 6) & 0x3f) /*0b00111111*/;
|
|
30
|
-
resArr[(resPos += 1)] =
|
|
31
|
-
(0x2 /*0b10*/ << 6) | (point & 0x3f) /*0b00111111*/;
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
resArr[(resPos += 1)] = 0xef /*0b11101111*/;
|
|
37
|
-
resArr[(resPos += 1)] = 0xbf /*0b10111111*/;
|
|
38
|
-
resArr[(resPos += 1)] = 0xbd /*0b10111101*/;
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (point <= 0x007f) {
|
|
43
|
-
resArr[(resPos += 1)] = (0x0 /*0b0*/ << 7) | point;
|
|
44
|
-
}
|
|
45
|
-
else if (point <= 0x07ff) {
|
|
46
|
-
resArr[(resPos += 1)] = (0x6 /*0b110*/ << 5) | (point >>> 6);
|
|
47
|
-
resArr[(resPos += 1)] =
|
|
48
|
-
(0x2 /*0b10*/ << 6) | (point & 0x3f) /*0b00111111*/;
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
resArr[(resPos += 1)] = (0xe /*0b1110*/ << 4) | (point >>> 12);
|
|
52
|
-
resArr[(resPos += 1)] =
|
|
53
|
-
(0x2 /*0b10*/ << 6) | ((point >>> 6) & 0x3f) /*0b00111111*/;
|
|
54
|
-
resArr[(resPos += 1)] =
|
|
55
|
-
(0x2 /*0b10*/ << 6) | (point & 0x3f) /*0b00111111*/;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return resArr.subarray(0, resPos + 1);
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
export default class Writer {
|
|
62
|
-
constructor(size) {
|
|
63
|
-
this.size = size;
|
|
64
|
-
this.offset = 0;
|
|
65
|
-
this.checkpointOffset = 0;
|
|
66
|
-
this.data = new Uint8Array(size);
|
|
67
|
-
}
|
|
68
|
-
checkpoint() {
|
|
69
|
-
this.checkpointOffset = this.offset;
|
|
70
|
-
}
|
|
71
|
-
isEmpty() {
|
|
72
|
-
return this.offset === 0;
|
|
73
|
-
}
|
|
74
|
-
boolean(value) {
|
|
75
|
-
this.data[this.offset++] = +value;
|
|
76
|
-
return this.offset <= this.size;
|
|
77
|
-
}
|
|
78
|
-
uint(value) {
|
|
79
|
-
if (value < 0 || value > Number.MAX_SAFE_INTEGER) {
|
|
80
|
-
value = 0;
|
|
81
|
-
}
|
|
82
|
-
while (value >= 0x80) {
|
|
83
|
-
this.data[this.offset++] = value % 0x100 | 0x80;
|
|
84
|
-
value = Math.floor(value / 128);
|
|
85
|
-
}
|
|
86
|
-
this.data[this.offset++] = value;
|
|
87
|
-
return this.offset <= this.size;
|
|
88
|
-
}
|
|
89
|
-
int(value) {
|
|
90
|
-
value = Math.round(value);
|
|
91
|
-
return this.uint(value >= 0 ? value * 2 : value * -2 - 1);
|
|
92
|
-
}
|
|
93
|
-
string(value) {
|
|
94
|
-
const encoded = textEncoder.encode(value);
|
|
95
|
-
const length = encoded.byteLength;
|
|
96
|
-
if (!this.uint(length) || this.offset + length > this.size) {
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
this.data.set(encoded, this.offset);
|
|
100
|
-
this.offset += length;
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
reset() {
|
|
104
|
-
this.offset = 0;
|
|
105
|
-
this.checkpointOffset = 0;
|
|
106
|
-
}
|
|
107
|
-
flush() {
|
|
108
|
-
const data = this.data.slice(0, this.checkpointOffset);
|
|
109
|
-
this.reset();
|
|
110
|
-
return data;
|
|
111
|
-
}
|
|
112
|
-
}
|