@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/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/rrweb-record.cjs
CHANGED
|
@@ -1136,6 +1136,16 @@ function slimDOMExcluded(sn, slimDOMOptions) {
|
|
|
1136
1136
|
}
|
|
1137
1137
|
return false;
|
|
1138
1138
|
}
|
|
1139
|
+
const DEFAULT_MAX_DEPTH = 50;
|
|
1140
|
+
let _maxDepthWarned = false;
|
|
1141
|
+
let _maxDepthReached = false;
|
|
1142
|
+
function wasMaxDepthReached() {
|
|
1143
|
+
return _maxDepthReached;
|
|
1144
|
+
}
|
|
1145
|
+
function resetMaxDepthState() {
|
|
1146
|
+
_maxDepthReached = false;
|
|
1147
|
+
_maxDepthWarned = false;
|
|
1148
|
+
}
|
|
1139
1149
|
function serializeNodeWithId(n2, options) {
|
|
1140
1150
|
const {
|
|
1141
1151
|
doc,
|
|
@@ -1159,10 +1169,22 @@ function serializeNodeWithId(n2, options) {
|
|
|
1159
1169
|
onStylesheetLoad,
|
|
1160
1170
|
stylesheetLoadTimeout = 5e3,
|
|
1161
1171
|
keepIframeSrcFn = () => false,
|
|
1162
|
-
newlyAddedElement = false
|
|
1172
|
+
newlyAddedElement = false,
|
|
1173
|
+
depth = 0,
|
|
1174
|
+
maxDepth = DEFAULT_MAX_DEPTH
|
|
1163
1175
|
} = options;
|
|
1164
1176
|
let { needsMask } = options;
|
|
1165
1177
|
let { preserveWhiteSpace = true } = options;
|
|
1178
|
+
if (depth >= maxDepth) {
|
|
1179
|
+
_maxDepthReached = true;
|
|
1180
|
+
if (!_maxDepthWarned) {
|
|
1181
|
+
_maxDepthWarned = true;
|
|
1182
|
+
console.warn(
|
|
1183
|
+
`[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.`
|
|
1184
|
+
);
|
|
1185
|
+
}
|
|
1186
|
+
return null;
|
|
1187
|
+
}
|
|
1166
1188
|
if (!needsMask) {
|
|
1167
1189
|
const checkAncestors = needsMask === void 0;
|
|
1168
1190
|
needsMask = needMaskingText(
|
|
@@ -1243,7 +1265,9 @@ function serializeNodeWithId(n2, options) {
|
|
|
1243
1265
|
iframeLoadTimeout,
|
|
1244
1266
|
onStylesheetLoad,
|
|
1245
1267
|
stylesheetLoadTimeout,
|
|
1246
|
-
keepIframeSrcFn
|
|
1268
|
+
keepIframeSrcFn,
|
|
1269
|
+
depth: depth + 1,
|
|
1270
|
+
maxDepth
|
|
1247
1271
|
};
|
|
1248
1272
|
if (serializedNode.type === NodeType$1$1.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
|
|
1249
1273
|
else {
|
|
@@ -1298,7 +1322,9 @@ function serializeNodeWithId(n2, options) {
|
|
|
1298
1322
|
iframeLoadTimeout,
|
|
1299
1323
|
onStylesheetLoad,
|
|
1300
1324
|
stylesheetLoadTimeout,
|
|
1301
|
-
keepIframeSrcFn
|
|
1325
|
+
keepIframeSrcFn,
|
|
1326
|
+
depth: depth + 1,
|
|
1327
|
+
maxDepth
|
|
1302
1328
|
});
|
|
1303
1329
|
if (serializedIframeNode) {
|
|
1304
1330
|
onIframeLoad(
|
|
@@ -1339,7 +1365,9 @@ function serializeNodeWithId(n2, options) {
|
|
|
1339
1365
|
iframeLoadTimeout,
|
|
1340
1366
|
onStylesheetLoad,
|
|
1341
1367
|
stylesheetLoadTimeout,
|
|
1342
|
-
keepIframeSrcFn
|
|
1368
|
+
keepIframeSrcFn,
|
|
1369
|
+
depth,
|
|
1370
|
+
maxDepth
|
|
1343
1371
|
});
|
|
1344
1372
|
if (serializedLinkNode) {
|
|
1345
1373
|
onStylesheetLoad(
|
|
@@ -1375,7 +1403,8 @@ function snapshot(n2, options) {
|
|
|
1375
1403
|
iframeLoadTimeout,
|
|
1376
1404
|
onStylesheetLoad,
|
|
1377
1405
|
stylesheetLoadTimeout,
|
|
1378
|
-
keepIframeSrcFn = () => false
|
|
1406
|
+
keepIframeSrcFn = () => false,
|
|
1407
|
+
maxDepth
|
|
1379
1408
|
} = options || {};
|
|
1380
1409
|
const maskInputOptions = maskAllInputs === true ? {
|
|
1381
1410
|
color: true,
|
|
@@ -1436,7 +1465,8 @@ function snapshot(n2, options) {
|
|
|
1436
1465
|
onStylesheetLoad,
|
|
1437
1466
|
stylesheetLoadTimeout,
|
|
1438
1467
|
keepIframeSrcFn,
|
|
1439
|
-
newlyAddedElement: false
|
|
1468
|
+
newlyAddedElement: false,
|
|
1469
|
+
maxDepth
|
|
1440
1470
|
});
|
|
1441
1471
|
}
|
|
1442
1472
|
function getDefaultExportFromCjs$1(x) {
|
|
@@ -13174,4 +13204,6 @@ const { addCustomEvent } = record;
|
|
|
13174
13204
|
const { freezePage } = record;
|
|
13175
13205
|
const { takeFullSnapshot } = record;
|
|
13176
13206
|
exports.record = record;
|
|
13207
|
+
exports.resetMaxDepthState = resetMaxDepthState;
|
|
13208
|
+
exports.wasMaxDepthReached = wasMaxDepthReached;
|
|
13177
13209
|
//# sourceMappingURL=rrweb-record.cjs.map
|