@glimt/record 0.0.2 → 0.0.3
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 +48 -181
- package/dist/record.cjs.map +1 -1
- package/dist/record.js +48 -181
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +48 -181
- package/dist/record.umd.cjs.map +3 -3
- package/dist/record.umd.min.cjs +24 -24
- package/dist/record.umd.min.cjs.map +4 -4
- package/package.json +1 -1
package/dist/record.js
CHANGED
|
@@ -142,32 +142,6 @@ function querySelectorAll$1(n2, selectors) {
|
|
|
142
142
|
function mutationObserverCtor$1() {
|
|
143
143
|
return getUntaintedPrototype$1("MutationObserver").constructor;
|
|
144
144
|
}
|
|
145
|
-
function patch$1(source, name, replacement) {
|
|
146
|
-
try {
|
|
147
|
-
if (!(name in source)) {
|
|
148
|
-
return () => {
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
const original = source[name];
|
|
152
|
-
const wrapped = replacement(original);
|
|
153
|
-
if (typeof wrapped === "function") {
|
|
154
|
-
wrapped.prototype = wrapped.prototype || {};
|
|
155
|
-
Object.defineProperties(wrapped, {
|
|
156
|
-
__rrweb_original__: {
|
|
157
|
-
enumerable: false,
|
|
158
|
-
value: original
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
source[name] = wrapped;
|
|
163
|
-
return () => {
|
|
164
|
-
source[name] = original;
|
|
165
|
-
};
|
|
166
|
-
} catch {
|
|
167
|
-
return () => {
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
145
|
const index$1 = {
|
|
172
146
|
childNodes: childNodes$1,
|
|
173
147
|
parentNode: parentNode$1,
|
|
@@ -180,8 +154,7 @@ const index$1 = {
|
|
|
180
154
|
shadowRoot: shadowRoot$1,
|
|
181
155
|
querySelector: querySelector$1,
|
|
182
156
|
querySelectorAll: querySelectorAll$1,
|
|
183
|
-
mutationObserver: mutationObserverCtor$1
|
|
184
|
-
patch: patch$1
|
|
157
|
+
mutationObserver: mutationObserverCtor$1
|
|
185
158
|
};
|
|
186
159
|
function isElement(n2) {
|
|
187
160
|
return n2.nodeType === n2.ELEMENT_NODE;
|
|
@@ -450,97 +423,26 @@ function absolutifyURLs(cssText, href) {
|
|
|
450
423
|
}
|
|
451
424
|
);
|
|
452
425
|
}
|
|
453
|
-
function normalizeCssString(cssText
|
|
454
|
-
|
|
455
|
-
return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "");
|
|
456
|
-
} else {
|
|
457
|
-
return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "").replace(/0px/g, "0");
|
|
458
|
-
}
|
|
426
|
+
function normalizeCssString(cssText) {
|
|
427
|
+
return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "");
|
|
459
428
|
}
|
|
460
|
-
function splitCssText(cssText, style
|
|
429
|
+
function splitCssText(cssText, style) {
|
|
461
430
|
const childNodes2 = Array.from(style.childNodes);
|
|
462
431
|
const splits = [];
|
|
463
|
-
let iterCount = 0;
|
|
464
432
|
if (childNodes2.length > 1 && cssText && typeof cssText === "string") {
|
|
465
|
-
|
|
466
|
-
const normFactor = cssTextNorm.length / cssText.length;
|
|
433
|
+
const cssTextNorm = normalizeCssString(cssText);
|
|
467
434
|
for (let i2 = 1; i2 < childNodes2.length; i2++) {
|
|
468
435
|
if (childNodes2[i2].textContent && typeof childNodes2[i2].textContent === "string") {
|
|
469
|
-
const textContentNorm = normalizeCssString(
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
if (
|
|
477
|
-
// keep consuming css identifiers (to get a decent chunk more quickly)
|
|
478
|
-
textContentNorm[j].match(/[a-zA-Z0-9]/) || // substring needs to be unique to this section
|
|
479
|
-
textContentNorm.indexOf(textContentNorm.substring(0, j), 1) !== -1
|
|
480
|
-
) {
|
|
481
|
-
continue;
|
|
482
|
-
}
|
|
483
|
-
break;
|
|
484
|
-
}
|
|
485
|
-
for (; j < textContentNorm.length; j++) {
|
|
486
|
-
let startSubstring = textContentNorm.substring(0, j);
|
|
487
|
-
let cssNormSplits = cssTextNorm.split(startSubstring);
|
|
488
|
-
let splitNorm = -1;
|
|
489
|
-
if (cssNormSplits.length === 2) {
|
|
490
|
-
splitNorm = cssNormSplits[0].length;
|
|
491
|
-
} else if (cssNormSplits.length > 2 && cssNormSplits[0] === "" && childNodes2[i2 - 1].textContent !== "") {
|
|
492
|
-
splitNorm = cssTextNorm.indexOf(startSubstring, 1);
|
|
493
|
-
} else if (cssNormSplits.length === 1) {
|
|
494
|
-
startSubstring = startSubstring.substring(
|
|
495
|
-
0,
|
|
496
|
-
startSubstring.length - 1
|
|
497
|
-
);
|
|
498
|
-
cssNormSplits = cssTextNorm.split(startSubstring);
|
|
499
|
-
if (cssNormSplits.length <= 1) {
|
|
500
|
-
splits.push(cssText);
|
|
501
|
-
return splits;
|
|
502
|
-
}
|
|
503
|
-
j = jLimit + 1;
|
|
504
|
-
} else if (j === textContentNorm.length - 1) {
|
|
505
|
-
splitNorm = cssTextNorm.indexOf(startSubstring);
|
|
506
|
-
}
|
|
507
|
-
if (cssNormSplits.length >= 2 && j > jLimit) {
|
|
508
|
-
const prevTextContent = childNodes2[i2 - 1].textContent;
|
|
509
|
-
if (prevTextContent && typeof prevTextContent === "string") {
|
|
510
|
-
const prevMinLength = normalizeCssString(prevTextContent).length;
|
|
511
|
-
splitNorm = cssTextNorm.indexOf(startSubstring, prevMinLength);
|
|
512
|
-
}
|
|
513
|
-
if (splitNorm === -1) {
|
|
514
|
-
splitNorm = cssNormSplits[0].length;
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
if (splitNorm !== -1) {
|
|
518
|
-
let k = Math.floor(splitNorm / normFactor);
|
|
519
|
-
for (; k > 0 && k < cssText.length; ) {
|
|
520
|
-
iterCount += 1;
|
|
521
|
-
if (iterCount > 50 * childNodes2.length) {
|
|
522
|
-
splits.push(cssText);
|
|
523
|
-
return splits;
|
|
524
|
-
}
|
|
525
|
-
const normPart = normalizeCssString(
|
|
526
|
-
cssText.substring(0, k),
|
|
527
|
-
_testNoPxNorm
|
|
528
|
-
);
|
|
529
|
-
if (normPart.length === splitNorm) {
|
|
436
|
+
const textContentNorm = normalizeCssString(childNodes2[i2].textContent);
|
|
437
|
+
for (let j = 3; j < textContentNorm.length; j++) {
|
|
438
|
+
const bit = textContentNorm.substring(0, j);
|
|
439
|
+
if (cssTextNorm.split(bit).length === 2) {
|
|
440
|
+
const splitNorm = cssTextNorm.indexOf(bit);
|
|
441
|
+
for (let k = splitNorm; k < cssText.length; k++) {
|
|
442
|
+
if (normalizeCssString(cssText.substring(0, k)).length === splitNorm) {
|
|
530
443
|
splits.push(cssText.substring(0, k));
|
|
531
444
|
cssText = cssText.substring(k);
|
|
532
|
-
cssTextNorm = cssTextNorm.substring(splitNorm);
|
|
533
445
|
break;
|
|
534
|
-
} else if (normPart.length < splitNorm) {
|
|
535
|
-
k += Math.max(
|
|
536
|
-
1,
|
|
537
|
-
Math.floor((splitNorm - normPart.length) / normFactor)
|
|
538
|
-
);
|
|
539
|
-
} else {
|
|
540
|
-
k -= Math.max(
|
|
541
|
-
1,
|
|
542
|
-
Math.floor((normPart.length - splitNorm) * normFactor)
|
|
543
|
-
);
|
|
544
446
|
}
|
|
545
447
|
}
|
|
546
448
|
break;
|
|
@@ -1022,19 +924,8 @@ function serializeElementNode(n2, options) {
|
|
|
1022
924
|
const image = n2;
|
|
1023
925
|
const imageSrc = image.currentSrc || image.getAttribute("src") || "<unknown-src>";
|
|
1024
926
|
const priorCrossOrigin = image.crossOrigin;
|
|
1025
|
-
const cleanupCrossOriginAttribute = () => {
|
|
1026
|
-
if (image.crossOrigin === "anonymous") {
|
|
1027
|
-
if (priorCrossOrigin) {
|
|
1028
|
-
image.setAttribute("crossorigin", priorCrossOrigin);
|
|
1029
|
-
attributes.crossOrigin = priorCrossOrigin;
|
|
1030
|
-
} else {
|
|
1031
|
-
image.removeAttribute("crossorigin");
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
};
|
|
1035
927
|
const recordInlineImage = () => {
|
|
1036
928
|
image.removeEventListener("load", recordInlineImage);
|
|
1037
|
-
image.removeEventListener("error", onImageLoadError);
|
|
1038
929
|
try {
|
|
1039
930
|
canvasService.width = image.naturalWidth;
|
|
1040
931
|
canvasService.height = image.naturalHeight;
|
|
@@ -1048,10 +939,7 @@ function serializeElementNode(n2, options) {
|
|
|
1048
939
|
image.crossOrigin = "anonymous";
|
|
1049
940
|
if (image.complete && image.naturalWidth !== 0)
|
|
1050
941
|
recordInlineImage();
|
|
1051
|
-
else
|
|
1052
|
-
image.addEventListener("load", recordInlineImage);
|
|
1053
|
-
image.addEventListener("error", onImageLoadError);
|
|
1054
|
-
}
|
|
942
|
+
else image.addEventListener("load", recordInlineImage);
|
|
1055
943
|
return;
|
|
1056
944
|
} else {
|
|
1057
945
|
console.warn(
|
|
@@ -1059,18 +947,12 @@ function serializeElementNode(n2, options) {
|
|
|
1059
947
|
);
|
|
1060
948
|
}
|
|
1061
949
|
}
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
image.removeEventListener("load", recordInlineImage);
|
|
1066
|
-
image.removeEventListener("error", onImageLoadError);
|
|
1067
|
-
cleanupCrossOriginAttribute();
|
|
950
|
+
if (image.crossOrigin === "anonymous") {
|
|
951
|
+
priorCrossOrigin ? attributes.crossOrigin = priorCrossOrigin : image.removeAttribute("crossorigin");
|
|
952
|
+
}
|
|
1068
953
|
};
|
|
1069
954
|
if (image.complete && image.naturalWidth !== 0) recordInlineImage();
|
|
1070
|
-
else
|
|
1071
|
-
image.addEventListener("load", recordInlineImage);
|
|
1072
|
-
image.addEventListener("error", onImageLoadError);
|
|
1073
|
-
}
|
|
955
|
+
else image.addEventListener("load", recordInlineImage);
|
|
1074
956
|
}
|
|
1075
957
|
if (tagName === "audio" || tagName === "video") {
|
|
1076
958
|
const mediaAttributes = attributes;
|
|
@@ -1132,7 +1014,7 @@ function slimDOMExcluded(sn, slimDOMOptions) {
|
|
|
1132
1014
|
} else if (sn.type === NodeType$3.Element) {
|
|
1133
1015
|
if (slimDOMOptions.script && // script tag
|
|
1134
1016
|
(sn.tagName === "script" || // (module)preload link
|
|
1135
|
-
sn.tagName === "link" && (sn.attributes.rel === "preload"
|
|
1017
|
+
sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") && sn.attributes.as === "script" || // prefetch link
|
|
1136
1018
|
sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && extractFileExtension(sn.attributes.href) === "js")) {
|
|
1137
1019
|
return true;
|
|
1138
1020
|
} else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(
|
|
@@ -1276,10 +1158,7 @@ function serializeNodeWithId(n2, options) {
|
|
|
1276
1158
|
bypassOptions.cssCaptured = true;
|
|
1277
1159
|
}
|
|
1278
1160
|
for (const childN of Array.from(index$1.childNodes(n2))) {
|
|
1279
|
-
const serializedChildNode = serializeNodeWithId(
|
|
1280
|
-
childN,
|
|
1281
|
-
bypassOptions
|
|
1282
|
-
);
|
|
1161
|
+
const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
1283
1162
|
if (serializedChildNode) {
|
|
1284
1163
|
serializedNode.childNodes.push(serializedChildNode);
|
|
1285
1164
|
}
|
|
@@ -1288,10 +1167,7 @@ function serializeNodeWithId(n2, options) {
|
|
|
1288
1167
|
let shadowRootEl = null;
|
|
1289
1168
|
if (isElement(n2) && (shadowRootEl = index$1.shadowRoot(n2))) {
|
|
1290
1169
|
for (const childN of Array.from(index$1.childNodes(shadowRootEl))) {
|
|
1291
|
-
const serializedChildNode = serializeNodeWithId(
|
|
1292
|
-
childN,
|
|
1293
|
-
bypassOptions
|
|
1294
|
-
);
|
|
1170
|
+
const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
1295
1171
|
if (serializedChildNode) {
|
|
1296
1172
|
isNativeShadowDom(shadowRootEl) && (serializedChildNode.isShadow = true);
|
|
1297
1173
|
serializedNode.childNodes.push(serializedChildNode);
|
|
@@ -8759,32 +8635,6 @@ function querySelectorAll(n2, selectors) {
|
|
|
8759
8635
|
function mutationObserverCtor() {
|
|
8760
8636
|
return getUntaintedPrototype("MutationObserver").constructor;
|
|
8761
8637
|
}
|
|
8762
|
-
function patch(source, name, replacement) {
|
|
8763
|
-
try {
|
|
8764
|
-
if (!(name in source)) {
|
|
8765
|
-
return () => {
|
|
8766
|
-
};
|
|
8767
|
-
}
|
|
8768
|
-
const original = source[name];
|
|
8769
|
-
const wrapped = replacement(original);
|
|
8770
|
-
if (typeof wrapped === "function") {
|
|
8771
|
-
wrapped.prototype = wrapped.prototype || {};
|
|
8772
|
-
Object.defineProperties(wrapped, {
|
|
8773
|
-
__rrweb_original__: {
|
|
8774
|
-
enumerable: false,
|
|
8775
|
-
value: original
|
|
8776
|
-
}
|
|
8777
|
-
});
|
|
8778
|
-
}
|
|
8779
|
-
source[name] = wrapped;
|
|
8780
|
-
return () => {
|
|
8781
|
-
source[name] = original;
|
|
8782
|
-
};
|
|
8783
|
-
} catch {
|
|
8784
|
-
return () => {
|
|
8785
|
-
};
|
|
8786
|
-
}
|
|
8787
|
-
}
|
|
8788
8638
|
const index = {
|
|
8789
8639
|
childNodes,
|
|
8790
8640
|
parentNode,
|
|
@@ -8797,8 +8647,7 @@ const index = {
|
|
|
8797
8647
|
shadowRoot,
|
|
8798
8648
|
querySelector,
|
|
8799
8649
|
querySelectorAll,
|
|
8800
|
-
mutationObserver: mutationObserverCtor
|
|
8801
|
-
patch
|
|
8650
|
+
mutationObserver: mutationObserverCtor
|
|
8802
8651
|
};
|
|
8803
8652
|
function on(type, fn, target = document) {
|
|
8804
8653
|
const options = { capture: true, passive: true };
|
|
@@ -8881,6 +8730,32 @@ function hookSetter(target, key, d, isRevoked, win = window) {
|
|
|
8881
8730
|
);
|
|
8882
8731
|
return () => hookSetter(target, key, original || {}, true);
|
|
8883
8732
|
}
|
|
8733
|
+
function patch(source, name, replacement) {
|
|
8734
|
+
try {
|
|
8735
|
+
if (!(name in source)) {
|
|
8736
|
+
return () => {
|
|
8737
|
+
};
|
|
8738
|
+
}
|
|
8739
|
+
const original = source[name];
|
|
8740
|
+
const wrapped = replacement(original);
|
|
8741
|
+
if (typeof wrapped === "function") {
|
|
8742
|
+
wrapped.prototype = wrapped.prototype || {};
|
|
8743
|
+
Object.defineProperties(wrapped, {
|
|
8744
|
+
__rrweb_original__: {
|
|
8745
|
+
enumerable: false,
|
|
8746
|
+
value: original
|
|
8747
|
+
}
|
|
8748
|
+
});
|
|
8749
|
+
}
|
|
8750
|
+
source[name] = wrapped;
|
|
8751
|
+
return () => {
|
|
8752
|
+
source[name] = original;
|
|
8753
|
+
};
|
|
8754
|
+
} catch {
|
|
8755
|
+
return () => {
|
|
8756
|
+
};
|
|
8757
|
+
}
|
|
8758
|
+
}
|
|
8884
8759
|
let nowTimestamp = Date.now;
|
|
8885
8760
|
if (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {
|
|
8886
8761
|
nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();
|
|
@@ -9442,18 +9317,10 @@ class MutationBuffer {
|
|
|
9442
9317
|
this.attributes.push(item);
|
|
9443
9318
|
this.attributeMap.set(textarea, item);
|
|
9444
9319
|
}
|
|
9445
|
-
|
|
9320
|
+
item.attributes.value = Array.from(
|
|
9446
9321
|
index.childNodes(textarea),
|
|
9447
9322
|
(cn) => index.textContent(cn) || ""
|
|
9448
9323
|
).join("");
|
|
9449
|
-
item.attributes.value = maskInputValue({
|
|
9450
|
-
element: textarea,
|
|
9451
|
-
maskInputOptions: this.maskInputOptions,
|
|
9452
|
-
tagName: textarea.tagName,
|
|
9453
|
-
type: getInputType(textarea),
|
|
9454
|
-
value,
|
|
9455
|
-
maskInputFn: this.maskInputFn
|
|
9456
|
-
});
|
|
9457
9324
|
});
|
|
9458
9325
|
__publicField(this, "processMutation", (m) => {
|
|
9459
9326
|
if (isIgnored(m.target, this.mirror, this.slimDOMOptions)) {
|