@glimt/record 0.0.55 → 0.0.57
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/record.cjs +66 -13
- package/dist/record.cjs.map +1 -1
- package/dist/record.js +66 -13
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +66 -13
- package/dist/record.umd.cjs.map +2 -2
- package/dist/record.umd.min.cjs +24 -24
- package/dist/record.umd.min.cjs.map +3 -3
- package/package.json +1 -1
package/dist/record.cjs
CHANGED
|
@@ -430,6 +430,9 @@ const index = {
|
|
|
430
430
|
const shouldTryAnonymousFetchingOnCorsError$1 = () => {
|
|
431
431
|
return !("_rrweb_skip_re_fetching_to_suppress_cors_errors" in window && window._rrweb_skip_re_fetching_to_suppress_cors_errors === true);
|
|
432
432
|
};
|
|
433
|
+
const isDebug$1 = () => {
|
|
434
|
+
return "_rrweb_is_debug" in window && window._rrweb_is_debug ? window._rrweb_is_debug : false;
|
|
435
|
+
};
|
|
433
436
|
function isElement(n2) {
|
|
434
437
|
return n2.nodeType === n2.ELEMENT_NODE;
|
|
435
438
|
}
|
|
@@ -815,7 +818,7 @@ function markCssSplits(cssText, style) {
|
|
|
815
818
|
return splitCssText(cssText, style).join("/* rr_split */");
|
|
816
819
|
}
|
|
817
820
|
const CLEANUP_DEBOUNCE_TIME$1 = 1e3 * 30;
|
|
818
|
-
const DATA_ATTRIBUTE_CLONED_NAME$1 = "data-rrweb-link-cloned";
|
|
821
|
+
const DATA_ATTRIBUTE_CLONED_NAME$1 = "data-recapt-rrweb-link-cloned";
|
|
819
822
|
const DISALLOWED_EXTENSIONS$1 = [
|
|
820
823
|
// Fonts
|
|
821
824
|
"woff",
|
|
@@ -1495,6 +1498,7 @@ function serializeElementNode(n2, options) {
|
|
|
1495
1498
|
}
|
|
1496
1499
|
const image = n2;
|
|
1497
1500
|
let overrideImage = null;
|
|
1501
|
+
let calls = 0;
|
|
1498
1502
|
const imageSrc = (image.currentSrc || image.getAttribute("src") || "<unknown-src>") + "";
|
|
1499
1503
|
const imageHeight = image.naturalHeight;
|
|
1500
1504
|
const imageWidth = image.naturalWidth;
|
|
@@ -1502,6 +1506,8 @@ function serializeElementNode(n2, options) {
|
|
|
1502
1506
|
overrideImage = null;
|
|
1503
1507
|
};
|
|
1504
1508
|
const recordInlineImage = () => {
|
|
1509
|
+
calls++;
|
|
1510
|
+
if (calls > 3) return;
|
|
1505
1511
|
(overrideImage ?? image).removeEventListener("error", onImageLoadError);
|
|
1506
1512
|
try {
|
|
1507
1513
|
canvasService.width = imageWidth;
|
|
@@ -1532,9 +1538,10 @@ function serializeElementNode(n2, options) {
|
|
|
1532
1538
|
return;
|
|
1533
1539
|
}
|
|
1534
1540
|
} else {
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1541
|
+
if (isDebug$1())
|
|
1542
|
+
console.warn(
|
|
1543
|
+
`Cannot inline img src=${imageSrc}! Error: ${err}`
|
|
1544
|
+
);
|
|
1538
1545
|
}
|
|
1539
1546
|
}
|
|
1540
1547
|
inlineImageCleanup();
|
|
@@ -1690,7 +1697,7 @@ function serializeNodeWithId(n2, options) {
|
|
|
1690
1697
|
cssCaptured
|
|
1691
1698
|
});
|
|
1692
1699
|
if (!_serializedNode) {
|
|
1693
|
-
console.warn(n2, "not serialized");
|
|
1700
|
+
if (isDebug$1()) console.warn(n2, "not serialized");
|
|
1694
1701
|
return null;
|
|
1695
1702
|
}
|
|
1696
1703
|
let id;
|
|
@@ -5717,7 +5724,7 @@ function absolutifyURLs(cssText, href) {
|
|
|
5717
5724
|
);
|
|
5718
5725
|
}
|
|
5719
5726
|
const CLEANUP_DEBOUNCE_TIME = 1e3 * 30;
|
|
5720
|
-
const DATA_ATTRIBUTE_CLONED_NAME = "data-rrweb-link-cloned";
|
|
5727
|
+
const DATA_ATTRIBUTE_CLONED_NAME = "data-recapt-rrweb-link-cloned";
|
|
5721
5728
|
const DISALLOWED_EXTENSIONS = [
|
|
5722
5729
|
// Fonts
|
|
5723
5730
|
"woff",
|
|
@@ -10144,6 +10151,13 @@ class IframeManager {
|
|
|
10144
10151
|
}
|
|
10145
10152
|
}
|
|
10146
10153
|
}
|
|
10154
|
+
const isDebug = () => {
|
|
10155
|
+
return "_rrweb_is_debug" in window && window._rrweb_is_debug ? window._rrweb_is_debug : false;
|
|
10156
|
+
};
|
|
10157
|
+
const debugLog = (...args) => {
|
|
10158
|
+
if (!isDebug()) return;
|
|
10159
|
+
console.log("[recapt:rrweb]", ...args);
|
|
10160
|
+
};
|
|
10147
10161
|
const _StormSnapshotManager = class _StormSnapshotManager2 {
|
|
10148
10162
|
constructor() {
|
|
10149
10163
|
__publicField(this, "lastFullSnapshot", -1);
|
|
@@ -10179,10 +10193,10 @@ const _StormSnapshotManager = class _StormSnapshotManager2 {
|
|
|
10179
10193
|
}
|
|
10180
10194
|
takeSnapshot() {
|
|
10181
10195
|
if (Date.now() - this.lastFullSnapshot < this.intervalBetweenSnapshots) {
|
|
10182
|
-
|
|
10196
|
+
debugLog("StormSnapshotManager, takeSnapshot: too soon");
|
|
10183
10197
|
return;
|
|
10184
10198
|
}
|
|
10185
|
-
|
|
10199
|
+
debugLog("StormSnapshotManager, takeSnapshot: taking full snapshot");
|
|
10186
10200
|
takeFullSnapshot();
|
|
10187
10201
|
this.lastFullSnapshot = Date.now();
|
|
10188
10202
|
}
|
|
@@ -10271,6 +10285,14 @@ class DoubleLinkedList {
|
|
|
10271
10285
|
}
|
|
10272
10286
|
}
|
|
10273
10287
|
const moveKey = (id, parentId) => `${id}@${parentId}`;
|
|
10288
|
+
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
10289
|
+
function makeid(length = 8) {
|
|
10290
|
+
let result2 = "";
|
|
10291
|
+
for (let i2 = 0; i2 < length; i2++) {
|
|
10292
|
+
result2 += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
10293
|
+
}
|
|
10294
|
+
return result2;
|
|
10295
|
+
}
|
|
10274
10296
|
class MutationBuffer {
|
|
10275
10297
|
constructor() {
|
|
10276
10298
|
__publicField(this, "frozen", false);
|
|
@@ -10307,6 +10329,7 @@ class MutationBuffer {
|
|
|
10307
10329
|
__publicField(this, "canvasManager");
|
|
10308
10330
|
__publicField(this, "processedNodeManager");
|
|
10309
10331
|
__publicField(this, "unattachedDoc");
|
|
10332
|
+
__publicField(this, "bufId", isDebug() ? makeid() : "");
|
|
10310
10333
|
__publicField(this, "stormBatches", []);
|
|
10311
10334
|
__publicField(this, "stormInfo", null);
|
|
10312
10335
|
__publicField(this, "stormSettings", {
|
|
@@ -10320,6 +10343,11 @@ class MutationBuffer {
|
|
|
10320
10343
|
__publicField(this, "handleStormMutations", (muts) => {
|
|
10321
10344
|
const time = Date.now();
|
|
10322
10345
|
if (this.stormInfo == null) {
|
|
10346
|
+
debugLog(
|
|
10347
|
+
"detected probable mutation storm start",
|
|
10348
|
+
"buffer id:",
|
|
10349
|
+
this.bufId
|
|
10350
|
+
);
|
|
10323
10351
|
this.stormInfo = {
|
|
10324
10352
|
startedAt: time,
|
|
10325
10353
|
totalMutations: 0,
|
|
@@ -10350,6 +10378,18 @@ class MutationBuffer {
|
|
|
10350
10378
|
__publicField(this, "handleStormFinish", () => {
|
|
10351
10379
|
if (!this.stormInfo) return;
|
|
10352
10380
|
const { stormExceededLimit } = this.stormInfo;
|
|
10381
|
+
debugLog(
|
|
10382
|
+
"mutation storm finished",
|
|
10383
|
+
"totalMutations:",
|
|
10384
|
+
this.stormInfo.totalMutations,
|
|
10385
|
+
"stormExceededLimit:",
|
|
10386
|
+
stormExceededLimit,
|
|
10387
|
+
"storm duration:",
|
|
10388
|
+
Date.now() - this.stormInfo.startedAt,
|
|
10389
|
+
"ms",
|
|
10390
|
+
"buffer id:",
|
|
10391
|
+
this.bufId
|
|
10392
|
+
);
|
|
10353
10393
|
clearTimeout(this.stormInfo.timeout);
|
|
10354
10394
|
this.stormInfo = null;
|
|
10355
10395
|
if (!stormExceededLimit) {
|
|
@@ -10372,6 +10412,13 @@ class MutationBuffer {
|
|
|
10372
10412
|
for (const mut of muts) {
|
|
10373
10413
|
this.processMutation(mut);
|
|
10374
10414
|
}
|
|
10415
|
+
debugLog(
|
|
10416
|
+
"processed mutations from storm",
|
|
10417
|
+
"overrideStorm:",
|
|
10418
|
+
overrideStorm,
|
|
10419
|
+
"buffer id:",
|
|
10420
|
+
this.bufId
|
|
10421
|
+
);
|
|
10375
10422
|
this.emit();
|
|
10376
10423
|
});
|
|
10377
10424
|
__publicField(this, "processMutations", (mutations) => {
|
|
@@ -10837,7 +10884,6 @@ class MutationBuffer {
|
|
|
10837
10884
|
}
|
|
10838
10885
|
});
|
|
10839
10886
|
}
|
|
10840
|
-
// private bufId: string = makeid();
|
|
10841
10887
|
init(options) {
|
|
10842
10888
|
[
|
|
10843
10889
|
"mutationCb",
|
|
@@ -12684,7 +12730,7 @@ try {
|
|
|
12684
12730
|
document.body.removeChild(cleanFrame);
|
|
12685
12731
|
}
|
|
12686
12732
|
} catch (err) {
|
|
12687
|
-
console.debug("Unable to override Array.from", err);
|
|
12733
|
+
if (isDebug()) console.debug("Unable to override Array.from", err);
|
|
12688
12734
|
}
|
|
12689
12735
|
const mirror = createMirror$2();
|
|
12690
12736
|
function record(options = {}) {
|
|
@@ -12963,7 +13009,8 @@ function record(options = {}) {
|
|
|
12963
13009
|
keepIframeSrcFn
|
|
12964
13010
|
});
|
|
12965
13011
|
if (!node2) {
|
|
12966
|
-
|
|
13012
|
+
if (isDebug()) console.warn("Failed to snapshot the document");
|
|
13013
|
+
return;
|
|
12967
13014
|
}
|
|
12968
13015
|
wrappedEmit(
|
|
12969
13016
|
{
|
|
@@ -13111,7 +13158,10 @@ function record(options = {}) {
|
|
|
13111
13158
|
try {
|
|
13112
13159
|
handlers.push(observe(iframeEl.contentDocument));
|
|
13113
13160
|
} catch (error) {
|
|
13114
|
-
|
|
13161
|
+
if (isDebug()) {
|
|
13162
|
+
console.warn("internal error");
|
|
13163
|
+
console.warn(error);
|
|
13164
|
+
}
|
|
13115
13165
|
}
|
|
13116
13166
|
});
|
|
13117
13167
|
let initedAt = null;
|
|
@@ -13170,7 +13220,10 @@ function record(options = {}) {
|
|
|
13170
13220
|
unregisterErrorHandler();
|
|
13171
13221
|
};
|
|
13172
13222
|
} catch (error) {
|
|
13173
|
-
|
|
13223
|
+
if (isDebug()) {
|
|
13224
|
+
console.warn("internal error1");
|
|
13225
|
+
console.warn(error);
|
|
13226
|
+
}
|
|
13174
13227
|
}
|
|
13175
13228
|
}
|
|
13176
13229
|
record.addCustomEvent = (tag, payload) => {
|