@posthog/rrweb-record 0.0.40 → 0.0.42
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/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/rrweb-record.cjs +38 -6
- package/dist/rrweb-record.cjs.map +1 -1
- package/dist/rrweb-record.js +39 -7
- package/dist/rrweb-record.js.map +1 -1
- package/dist/rrweb-record.umd.cjs +38 -6
- package/dist/rrweb-record.umd.cjs.map +2 -2
- package/dist/rrweb-record.umd.min.cjs +17 -17
- package/dist/rrweb-record.umd.min.cjs.map +3 -3
- package/package.json +4 -4
package/dist/rrweb-record.js
CHANGED
|
@@ -1134,6 +1134,16 @@ function slimDOMExcluded(sn, slimDOMOptions) {
|
|
|
1134
1134
|
}
|
|
1135
1135
|
return false;
|
|
1136
1136
|
}
|
|
1137
|
+
const DEFAULT_MAX_DEPTH = 50;
|
|
1138
|
+
let _maxDepthWarned = false;
|
|
1139
|
+
let _maxDepthReached = false;
|
|
1140
|
+
function wasMaxDepthReached() {
|
|
1141
|
+
return _maxDepthReached;
|
|
1142
|
+
}
|
|
1143
|
+
function resetMaxDepthState() {
|
|
1144
|
+
_maxDepthReached = false;
|
|
1145
|
+
_maxDepthWarned = false;
|
|
1146
|
+
}
|
|
1137
1147
|
function serializeNodeWithId(n2, options) {
|
|
1138
1148
|
const {
|
|
1139
1149
|
doc,
|
|
@@ -1157,10 +1167,22 @@ function serializeNodeWithId(n2, options) {
|
|
|
1157
1167
|
onStylesheetLoad,
|
|
1158
1168
|
stylesheetLoadTimeout = 5e3,
|
|
1159
1169
|
keepIframeSrcFn = () => false,
|
|
1160
|
-
newlyAddedElement = false
|
|
1170
|
+
newlyAddedElement = false,
|
|
1171
|
+
depth = 0,
|
|
1172
|
+
maxDepth = DEFAULT_MAX_DEPTH
|
|
1161
1173
|
} = options;
|
|
1162
1174
|
let { needsMask } = options;
|
|
1163
1175
|
let { preserveWhiteSpace = true } = options;
|
|
1176
|
+
if (depth >= maxDepth) {
|
|
1177
|
+
_maxDepthReached = true;
|
|
1178
|
+
if (!_maxDepthWarned) {
|
|
1179
|
+
_maxDepthWarned = true;
|
|
1180
|
+
console.warn(
|
|
1181
|
+
`[rrweb-snapshot] DOM tree depth exceeded max depth of ${maxDepth}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`
|
|
1182
|
+
);
|
|
1183
|
+
}
|
|
1184
|
+
return null;
|
|
1185
|
+
}
|
|
1164
1186
|
if (!needsMask) {
|
|
1165
1187
|
const checkAncestors = needsMask === void 0;
|
|
1166
1188
|
needsMask = needMaskingText(
|
|
@@ -1241,7 +1263,9 @@ function serializeNodeWithId(n2, options) {
|
|
|
1241
1263
|
iframeLoadTimeout,
|
|
1242
1264
|
onStylesheetLoad,
|
|
1243
1265
|
stylesheetLoadTimeout,
|
|
1244
|
-
keepIframeSrcFn
|
|
1266
|
+
keepIframeSrcFn,
|
|
1267
|
+
depth: depth + 1,
|
|
1268
|
+
maxDepth
|
|
1245
1269
|
};
|
|
1246
1270
|
if (serializedNode.type === NodeType$1$1.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
|
|
1247
1271
|
else {
|
|
@@ -1296,7 +1320,9 @@ function serializeNodeWithId(n2, options) {
|
|
|
1296
1320
|
iframeLoadTimeout,
|
|
1297
1321
|
onStylesheetLoad,
|
|
1298
1322
|
stylesheetLoadTimeout,
|
|
1299
|
-
keepIframeSrcFn
|
|
1323
|
+
keepIframeSrcFn,
|
|
1324
|
+
depth: depth + 1,
|
|
1325
|
+
maxDepth
|
|
1300
1326
|
});
|
|
1301
1327
|
if (serializedIframeNode) {
|
|
1302
1328
|
onIframeLoad(
|
|
@@ -1337,7 +1363,9 @@ function serializeNodeWithId(n2, options) {
|
|
|
1337
1363
|
iframeLoadTimeout,
|
|
1338
1364
|
onStylesheetLoad,
|
|
1339
1365
|
stylesheetLoadTimeout,
|
|
1340
|
-
keepIframeSrcFn
|
|
1366
|
+
keepIframeSrcFn,
|
|
1367
|
+
depth,
|
|
1368
|
+
maxDepth
|
|
1341
1369
|
});
|
|
1342
1370
|
if (serializedLinkNode) {
|
|
1343
1371
|
onStylesheetLoad(
|
|
@@ -1373,7 +1401,8 @@ function snapshot(n2, options) {
|
|
|
1373
1401
|
iframeLoadTimeout,
|
|
1374
1402
|
onStylesheetLoad,
|
|
1375
1403
|
stylesheetLoadTimeout,
|
|
1376
|
-
keepIframeSrcFn = () => false
|
|
1404
|
+
keepIframeSrcFn = () => false,
|
|
1405
|
+
maxDepth
|
|
1377
1406
|
} = options || {};
|
|
1378
1407
|
const maskInputOptions = maskAllInputs === true ? {
|
|
1379
1408
|
color: true,
|
|
@@ -1434,7 +1463,8 @@ function snapshot(n2, options) {
|
|
|
1434
1463
|
onStylesheetLoad,
|
|
1435
1464
|
stylesheetLoadTimeout,
|
|
1436
1465
|
keepIframeSrcFn,
|
|
1437
|
-
newlyAddedElement: false
|
|
1466
|
+
newlyAddedElement: false,
|
|
1467
|
+
maxDepth
|
|
1438
1468
|
});
|
|
1439
1469
|
}
|
|
1440
1470
|
function getDefaultExportFromCjs$1(x) {
|
|
@@ -13172,6 +13202,8 @@ const { addCustomEvent } = record;
|
|
|
13172
13202
|
const { freezePage } = record;
|
|
13173
13203
|
const { takeFullSnapshot } = record;
|
|
13174
13204
|
export {
|
|
13175
|
-
record
|
|
13205
|
+
record,
|
|
13206
|
+
resetMaxDepthState,
|
|
13207
|
+
wasMaxDepthReached
|
|
13176
13208
|
};
|
|
13177
13209
|
//# sourceMappingURL=rrweb-record.js.map
|