@posthog/rrweb-snapshot 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/record-B2nV9UFB.js +995 -0
- package/dist/record-B2nV9UFB.js.map +1 -0
- package/dist/record-oACzRSl-.cjs +994 -0
- package/dist/record-oACzRSl-.cjs.map +1 -0
- package/dist/record-oACzRSl-.umd.cjs +1569 -0
- package/dist/record-oACzRSl-.umd.cjs.map +7 -0
- package/dist/record-oACzRSl-.umd.min.cjs +20 -0
- package/dist/record-oACzRSl-.umd.min.cjs.map +7 -0
- package/dist/record.cjs +13 -958
- package/dist/record.cjs.map +1 -1
- package/dist/record.d.cts +8 -0
- package/dist/record.d.ts +8 -0
- package/dist/record.js +29 -975
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +956 -902
- package/dist/record.umd.cjs.map +3 -3
- package/dist/record.umd.min.cjs +1 -1
- package/dist/record.umd.min.cjs.map +4 -4
- package/dist/rrweb-snapshot.cjs +4 -1
- package/dist/rrweb-snapshot.cjs.map +1 -1
- package/dist/rrweb-snapshot.d.cts +10 -0
- package/dist/rrweb-snapshot.d.ts +10 -0
- package/dist/rrweb-snapshot.js +24 -21
- package/dist/rrweb-snapshot.umd.cjs +46 -32
- package/dist/rrweb-snapshot.umd.cjs.map +2 -2
- package/dist/rrweb-snapshot.umd.min.cjs +11 -11
- package/dist/rrweb-snapshot.umd.min.cjs.map +3 -3
- package/package.json +3 -3
|
@@ -53,6 +53,8 @@ declare interface CSSImportRule_2 extends CSSRule {
|
|
|
53
53
|
readonly supportsText?: string | null;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
export declare const DEFAULT_MAX_DEPTH = 50;
|
|
57
|
+
|
|
56
58
|
export declare type DialogAttributes = {
|
|
57
59
|
open: string;
|
|
58
60
|
rr_open_mode: 'modal' | 'non-modal';
|
|
@@ -192,6 +194,8 @@ export declare function rebuild(n: serializedNodeWithId, options: {
|
|
|
192
194
|
|
|
193
195
|
export declare function recompressBase64Image(img: HTMLImageElement, dataURL: string, type?: string, quality?: number): string;
|
|
194
196
|
|
|
197
|
+
export declare function resetMaxDepthState(): void;
|
|
198
|
+
|
|
195
199
|
export declare type serializedElementNodeWithId = Extract<serializedNodeWithId, Record<'type', NodeType.Element>>;
|
|
196
200
|
|
|
197
201
|
export declare type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & {
|
|
@@ -225,6 +229,9 @@ export declare function serializeNodeWithId(n: Node, options: {
|
|
|
225
229
|
iframeLoadTimeout?: number;
|
|
226
230
|
onStylesheetLoad?: (linkNode: HTMLLinkElement, node: serializedElementNodeWithId_2) => unknown;
|
|
227
231
|
stylesheetLoadTimeout?: number;
|
|
232
|
+
depth?: number;
|
|
233
|
+
maxDepth?: number;
|
|
234
|
+
onMaxDepthReached?: () => void;
|
|
228
235
|
}): serializedNodeWithId | null;
|
|
229
236
|
|
|
230
237
|
export declare type SlimDOMOptions = Partial<{
|
|
@@ -262,6 +269,7 @@ export declare function snapshot(n: Document, options?: {
|
|
|
262
269
|
onStylesheetLoad?: (linkNode: HTMLLinkElement, node: serializedElementNodeWithId_2) => unknown;
|
|
263
270
|
stylesheetLoadTimeout?: number;
|
|
264
271
|
keepIframeSrcFn?: KeepIframeSrcFn;
|
|
272
|
+
maxDepth?: number;
|
|
265
273
|
}): serializedNodeWithId | null;
|
|
266
274
|
|
|
267
275
|
export declare function stringifyRule(rule: CSSRule, sheetHref: string | null): string;
|
|
@@ -284,4 +292,6 @@ export declare function transformAttribute(doc: Document, tagName: Lowercase<str
|
|
|
284
292
|
|
|
285
293
|
export declare function visitSnapshot(node: serializedNodeWithId, onVisit: (node: serializedNodeWithId) => unknown): void;
|
|
286
294
|
|
|
295
|
+
export declare function wasMaxDepthReached(): boolean;
|
|
296
|
+
|
|
287
297
|
export { }
|
package/dist/rrweb-snapshot.d.ts
CHANGED
|
@@ -53,6 +53,8 @@ declare interface CSSImportRule_2 extends CSSRule {
|
|
|
53
53
|
readonly supportsText?: string | null;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
export declare const DEFAULT_MAX_DEPTH = 50;
|
|
57
|
+
|
|
56
58
|
export declare type DialogAttributes = {
|
|
57
59
|
open: string;
|
|
58
60
|
rr_open_mode: 'modal' | 'non-modal';
|
|
@@ -192,6 +194,8 @@ export declare function rebuild(n: serializedNodeWithId, options: {
|
|
|
192
194
|
|
|
193
195
|
export declare function recompressBase64Image(img: HTMLImageElement, dataURL: string, type?: string, quality?: number): string;
|
|
194
196
|
|
|
197
|
+
export declare function resetMaxDepthState(): void;
|
|
198
|
+
|
|
195
199
|
export declare type serializedElementNodeWithId = Extract<serializedNodeWithId, Record<'type', NodeType.Element>>;
|
|
196
200
|
|
|
197
201
|
export declare type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & {
|
|
@@ -225,6 +229,9 @@ export declare function serializeNodeWithId(n: Node, options: {
|
|
|
225
229
|
iframeLoadTimeout?: number;
|
|
226
230
|
onStylesheetLoad?: (linkNode: HTMLLinkElement, node: serializedElementNodeWithId_2) => unknown;
|
|
227
231
|
stylesheetLoadTimeout?: number;
|
|
232
|
+
depth?: number;
|
|
233
|
+
maxDepth?: number;
|
|
234
|
+
onMaxDepthReached?: () => void;
|
|
228
235
|
}): serializedNodeWithId | null;
|
|
229
236
|
|
|
230
237
|
export declare type SlimDOMOptions = Partial<{
|
|
@@ -262,6 +269,7 @@ export declare function snapshot(n: Document, options?: {
|
|
|
262
269
|
onStylesheetLoad?: (linkNode: HTMLLinkElement, node: serializedElementNodeWithId_2) => unknown;
|
|
263
270
|
stylesheetLoadTimeout?: number;
|
|
264
271
|
keepIframeSrcFn?: KeepIframeSrcFn;
|
|
272
|
+
maxDepth?: number;
|
|
265
273
|
}): serializedNodeWithId | null;
|
|
266
274
|
|
|
267
275
|
export declare function stringifyRule(rule: CSSRule, sheetHref: string | null): string;
|
|
@@ -284,4 +292,6 @@ export declare function transformAttribute(doc: Document, tagName: Lowercase<str
|
|
|
284
292
|
|
|
285
293
|
export declare function visitSnapshot(node: serializedNodeWithId, onVisit: (node: serializedNodeWithId) => unknown): void;
|
|
286
294
|
|
|
295
|
+
export declare function wasMaxDepthReached(): boolean;
|
|
296
|
+
|
|
287
297
|
export { }
|
package/dist/rrweb-snapshot.js
CHANGED
|
@@ -1,41 +1,44 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D, I, b, c, g, i, n, r, a, s, t, v, w } from "./record-B2nV9UFB.js";
|
|
2
2
|
import { adaptCssForReplay, buildNodeWithSN, createCache, rebuild } from "./replay.js";
|
|
3
|
-
import { M, N, o, p, h, e, n, f, l, j, d, g, i, b, k, a, m, r, c, s, t } from "./types-OLXvwyjP.js";
|
|
3
|
+
import { M, N, o, p, h, e, n as n2, f, l, j, d, g as g2, i as i2, b as b2, k, a as a2, m, r as r2, c as c2, s as s2, t as t2 } from "./types-OLXvwyjP.js";
|
|
4
4
|
export {
|
|
5
|
-
|
|
5
|
+
D as DEFAULT_MAX_DEPTH,
|
|
6
|
+
I as IGNORED_NODE,
|
|
6
7
|
M as Mirror,
|
|
7
8
|
N as NodeType,
|
|
8
9
|
o as absolutifyURLs,
|
|
9
10
|
adaptCssForReplay,
|
|
10
11
|
buildNodeWithSN,
|
|
11
12
|
p as checkDataURLSize,
|
|
12
|
-
classMatchesRegex,
|
|
13
|
-
cleanupSnapshot,
|
|
13
|
+
b as classMatchesRegex,
|
|
14
|
+
c as cleanupSnapshot,
|
|
14
15
|
createCache,
|
|
15
16
|
h as createMirror,
|
|
16
17
|
e as escapeImportStatement,
|
|
17
|
-
|
|
18
|
+
n2 as extractFileExtension,
|
|
18
19
|
f as fixSafariColons,
|
|
19
|
-
genId,
|
|
20
|
+
g as genId,
|
|
20
21
|
l as getInputType,
|
|
21
|
-
ignoreAttribute,
|
|
22
|
+
i as ignoreAttribute,
|
|
22
23
|
j as is2DCanvasBlank,
|
|
23
24
|
d as isCSSImportRule,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
g2 as isCSSStyleRule,
|
|
26
|
+
i2 as isElement,
|
|
27
|
+
b2 as isNativeShadowDom,
|
|
27
28
|
k as isNodeMetaEqual,
|
|
28
|
-
|
|
29
|
+
a2 as isShadowRoot,
|
|
29
30
|
m as maskInputValue,
|
|
30
|
-
needMaskingText,
|
|
31
|
+
n as needMaskingText,
|
|
31
32
|
rebuild,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
r2 as recompressBase64Image,
|
|
34
|
+
r as resetMaxDepthState,
|
|
35
|
+
a as serializeNodeWithId,
|
|
36
|
+
s as snapshot,
|
|
37
|
+
c2 as stringifyRule,
|
|
38
|
+
s2 as stringifyStylesheet,
|
|
39
|
+
t2 as toLowerCase,
|
|
40
|
+
t as transformAttribute,
|
|
41
|
+
v as visitSnapshot,
|
|
42
|
+
w as wasMaxDepthReached
|
|
40
43
|
};
|
|
41
44
|
//# sourceMappingURL=rrweb-snapshot.js.map
|
|
@@ -587,11 +587,10 @@ var require_types_B7TTv7Jc = __commonJS({
|
|
|
587
587
|
}
|
|
588
588
|
});
|
|
589
589
|
|
|
590
|
-
// dist/record
|
|
591
|
-
var
|
|
592
|
-
"dist/record
|
|
590
|
+
// dist/record-oACzRSl-.cjs
|
|
591
|
+
var require_record_oACzRSl = __commonJS({
|
|
592
|
+
"dist/record-oACzRSl-.cjs"(exports2) {
|
|
593
593
|
"use strict";
|
|
594
|
-
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
595
594
|
var types2 = require_types_B7TTv7Jc();
|
|
596
595
|
var _id = 1;
|
|
597
596
|
var tagNameRegex = new RegExp("[^a-z0-9-_:]");
|
|
@@ -1226,6 +1225,16 @@ var require_record = __commonJS({
|
|
|
1226
1225
|
}
|
|
1227
1226
|
return false;
|
|
1228
1227
|
}
|
|
1228
|
+
var DEFAULT_MAX_DEPTH = 50;
|
|
1229
|
+
var _maxDepthWarned = false;
|
|
1230
|
+
var _maxDepthReached = false;
|
|
1231
|
+
function wasMaxDepthReached() {
|
|
1232
|
+
return _maxDepthReached;
|
|
1233
|
+
}
|
|
1234
|
+
function resetMaxDepthState() {
|
|
1235
|
+
_maxDepthReached = false;
|
|
1236
|
+
_maxDepthWarned = false;
|
|
1237
|
+
}
|
|
1229
1238
|
function serializeNodeWithId(n, options) {
|
|
1230
1239
|
const {
|
|
1231
1240
|
doc,
|
|
@@ -1249,10 +1258,22 @@ var require_record = __commonJS({
|
|
|
1249
1258
|
onStylesheetLoad,
|
|
1250
1259
|
stylesheetLoadTimeout = 5e3,
|
|
1251
1260
|
keepIframeSrcFn = () => false,
|
|
1252
|
-
newlyAddedElement = false
|
|
1261
|
+
newlyAddedElement = false,
|
|
1262
|
+
depth = 0,
|
|
1263
|
+
maxDepth = DEFAULT_MAX_DEPTH
|
|
1253
1264
|
} = options;
|
|
1254
1265
|
let { needsMask } = options;
|
|
1255
1266
|
let { preserveWhiteSpace = true } = options;
|
|
1267
|
+
if (depth >= maxDepth) {
|
|
1268
|
+
_maxDepthReached = true;
|
|
1269
|
+
if (!_maxDepthWarned) {
|
|
1270
|
+
_maxDepthWarned = true;
|
|
1271
|
+
console.warn(
|
|
1272
|
+
`[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.`
|
|
1273
|
+
);
|
|
1274
|
+
}
|
|
1275
|
+
return null;
|
|
1276
|
+
}
|
|
1256
1277
|
if (!needsMask) {
|
|
1257
1278
|
const checkAncestors = needsMask === void 0;
|
|
1258
1279
|
needsMask = needMaskingText(
|
|
@@ -1333,7 +1354,9 @@ var require_record = __commonJS({
|
|
|
1333
1354
|
iframeLoadTimeout,
|
|
1334
1355
|
onStylesheetLoad,
|
|
1335
1356
|
stylesheetLoadTimeout,
|
|
1336
|
-
keepIframeSrcFn
|
|
1357
|
+
keepIframeSrcFn,
|
|
1358
|
+
depth: depth + 1,
|
|
1359
|
+
maxDepth
|
|
1337
1360
|
};
|
|
1338
1361
|
if (serializedNode.type === types2.NodeType$1.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
|
|
1339
1362
|
else {
|
|
@@ -1388,7 +1411,9 @@ var require_record = __commonJS({
|
|
|
1388
1411
|
iframeLoadTimeout,
|
|
1389
1412
|
onStylesheetLoad,
|
|
1390
1413
|
stylesheetLoadTimeout,
|
|
1391
|
-
keepIframeSrcFn
|
|
1414
|
+
keepIframeSrcFn,
|
|
1415
|
+
depth: depth + 1,
|
|
1416
|
+
maxDepth
|
|
1392
1417
|
});
|
|
1393
1418
|
if (serializedIframeNode) {
|
|
1394
1419
|
onIframeLoad(
|
|
@@ -1429,7 +1454,9 @@ var require_record = __commonJS({
|
|
|
1429
1454
|
iframeLoadTimeout,
|
|
1430
1455
|
onStylesheetLoad,
|
|
1431
1456
|
stylesheetLoadTimeout,
|
|
1432
|
-
keepIframeSrcFn
|
|
1457
|
+
keepIframeSrcFn,
|
|
1458
|
+
depth,
|
|
1459
|
+
maxDepth
|
|
1433
1460
|
});
|
|
1434
1461
|
if (serializedLinkNode) {
|
|
1435
1462
|
onStylesheetLoad(
|
|
@@ -1465,7 +1492,8 @@ var require_record = __commonJS({
|
|
|
1465
1492
|
iframeLoadTimeout,
|
|
1466
1493
|
onStylesheetLoad,
|
|
1467
1494
|
stylesheetLoadTimeout,
|
|
1468
|
-
keepIframeSrcFn = () => false
|
|
1495
|
+
keepIframeSrcFn = () => false,
|
|
1496
|
+
maxDepth
|
|
1469
1497
|
} = options || {};
|
|
1470
1498
|
const maskInputOptions = maskAllInputs === true ? {
|
|
1471
1499
|
color: true,
|
|
@@ -1526,7 +1554,8 @@ var require_record = __commonJS({
|
|
|
1526
1554
|
onStylesheetLoad,
|
|
1527
1555
|
stylesheetLoadTimeout,
|
|
1528
1556
|
keepIframeSrcFn,
|
|
1529
|
-
newlyAddedElement: false
|
|
1557
|
+
newlyAddedElement: false,
|
|
1558
|
+
maxDepth
|
|
1530
1559
|
});
|
|
1531
1560
|
}
|
|
1532
1561
|
function visitSnapshot(node, onVisit) {
|
|
@@ -1541,37 +1570,19 @@ var require_record = __commonJS({
|
|
|
1541
1570
|
function cleanupSnapshot() {
|
|
1542
1571
|
_id = 1;
|
|
1543
1572
|
}
|
|
1544
|
-
exports2.
|
|
1545
|
-
exports2.NodeType = types2.NodeType;
|
|
1546
|
-
exports2.absolutifyURLs = types2.absolutifyURLs;
|
|
1547
|
-
exports2.checkDataURLSize = types2.checkDataURLSize;
|
|
1548
|
-
exports2.createMirror = types2.createMirror;
|
|
1549
|
-
exports2.escapeImportStatement = types2.escapeImportStatement;
|
|
1550
|
-
exports2.extractFileExtension = types2.extractFileExtension;
|
|
1551
|
-
exports2.fixSafariColons = types2.fixSafariColons;
|
|
1552
|
-
exports2.getInputType = types2.getInputType;
|
|
1553
|
-
exports2.is2DCanvasBlank = types2.is2DCanvasBlank;
|
|
1554
|
-
exports2.isCSSImportRule = types2.isCSSImportRule;
|
|
1555
|
-
exports2.isCSSStyleRule = types2.isCSSStyleRule;
|
|
1556
|
-
exports2.isElement = types2.isElement;
|
|
1557
|
-
exports2.isNativeShadowDom = types2.isNativeShadowDom;
|
|
1558
|
-
exports2.isNodeMetaEqual = types2.isNodeMetaEqual;
|
|
1559
|
-
exports2.isShadowRoot = types2.isShadowRoot;
|
|
1560
|
-
exports2.maskInputValue = types2.maskInputValue;
|
|
1561
|
-
exports2.recompressBase64Image = types2.recompressBase64Image;
|
|
1562
|
-
exports2.stringifyRule = types2.stringifyRule;
|
|
1563
|
-
exports2.stringifyStylesheet = types2.stringifyStylesheet;
|
|
1564
|
-
exports2.toLowerCase = types2.toLowerCase;
|
|
1573
|
+
exports2.DEFAULT_MAX_DEPTH = DEFAULT_MAX_DEPTH;
|
|
1565
1574
|
exports2.IGNORED_NODE = IGNORED_NODE;
|
|
1566
1575
|
exports2.classMatchesRegex = classMatchesRegex;
|
|
1567
1576
|
exports2.cleanupSnapshot = cleanupSnapshot;
|
|
1568
1577
|
exports2.genId = genId;
|
|
1569
1578
|
exports2.ignoreAttribute = ignoreAttribute;
|
|
1570
1579
|
exports2.needMaskingText = needMaskingText;
|
|
1580
|
+
exports2.resetMaxDepthState = resetMaxDepthState;
|
|
1571
1581
|
exports2.serializeNodeWithId = serializeNodeWithId;
|
|
1572
1582
|
exports2.snapshot = snapshot;
|
|
1573
1583
|
exports2.transformAttribute = transformAttribute;
|
|
1574
1584
|
exports2.visitSnapshot = visitSnapshot;
|
|
1585
|
+
exports2.wasMaxDepthReached = wasMaxDepthReached;
|
|
1575
1586
|
}
|
|
1576
1587
|
});
|
|
1577
1588
|
|
|
@@ -5973,19 +5984,22 @@ var require_replay = __commonJS({
|
|
|
5973
5984
|
|
|
5974
5985
|
// dist/rrweb-snapshot.cjs
|
|
5975
5986
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
5976
|
-
var record =
|
|
5987
|
+
var record = require_record_oACzRSl();
|
|
5977
5988
|
var replay = require_replay();
|
|
5978
5989
|
var types = require_types_B7TTv7Jc();
|
|
5990
|
+
exports.DEFAULT_MAX_DEPTH = record.DEFAULT_MAX_DEPTH;
|
|
5979
5991
|
exports.IGNORED_NODE = record.IGNORED_NODE;
|
|
5980
5992
|
exports.classMatchesRegex = record.classMatchesRegex;
|
|
5981
5993
|
exports.cleanupSnapshot = record.cleanupSnapshot;
|
|
5982
5994
|
exports.genId = record.genId;
|
|
5983
5995
|
exports.ignoreAttribute = record.ignoreAttribute;
|
|
5984
5996
|
exports.needMaskingText = record.needMaskingText;
|
|
5997
|
+
exports.resetMaxDepthState = record.resetMaxDepthState;
|
|
5985
5998
|
exports.serializeNodeWithId = record.serializeNodeWithId;
|
|
5986
5999
|
exports.snapshot = record.snapshot;
|
|
5987
6000
|
exports.transformAttribute = record.transformAttribute;
|
|
5988
6001
|
exports.visitSnapshot = record.visitSnapshot;
|
|
6002
|
+
exports.wasMaxDepthReached = record.wasMaxDepthReached;
|
|
5989
6003
|
exports.adaptCssForReplay = replay.adaptCssForReplay;
|
|
5990
6004
|
exports.buildNodeWithSN = replay.buildNodeWithSN;
|
|
5991
6005
|
exports.createCache = replay.createCache;
|