@glimt/record 0.0.42 → 0.0.44
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 +170 -20
- package/dist/record.cjs.map +1 -1
- package/dist/record.js +170 -20
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +170 -20
- 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.umd.cjs
CHANGED
|
@@ -845,7 +845,51 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
|
|
|
845
845
|
function markCssSplits(cssText, style) {
|
|
846
846
|
return splitCssText(cssText, style).join("/* rr_split */");
|
|
847
847
|
}
|
|
848
|
-
const CLEANUP_DEBOUNCE_TIME$1 = 1e3 * 60 *
|
|
848
|
+
const CLEANUP_DEBOUNCE_TIME$1 = 1e3 * 60 * 2;
|
|
849
|
+
const DISALLOWED_EXTENSIONS$1 = [
|
|
850
|
+
// Fonts
|
|
851
|
+
"woff",
|
|
852
|
+
"woff2",
|
|
853
|
+
"ttf",
|
|
854
|
+
"otf",
|
|
855
|
+
// Embedded OpenType font
|
|
856
|
+
"eot",
|
|
857
|
+
// Images
|
|
858
|
+
"png",
|
|
859
|
+
"jpg",
|
|
860
|
+
"jpeg",
|
|
861
|
+
"gif",
|
|
862
|
+
"svg",
|
|
863
|
+
"webp",
|
|
864
|
+
"ico",
|
|
865
|
+
// Scripts
|
|
866
|
+
"js",
|
|
867
|
+
"mjs",
|
|
868
|
+
"ts",
|
|
869
|
+
"jsx",
|
|
870
|
+
"tsx",
|
|
871
|
+
// Data files
|
|
872
|
+
"json",
|
|
873
|
+
"map",
|
|
874
|
+
// Media
|
|
875
|
+
"mp4",
|
|
876
|
+
"webm",
|
|
877
|
+
"ogg",
|
|
878
|
+
"mp3",
|
|
879
|
+
"wav",
|
|
880
|
+
// Archives
|
|
881
|
+
"zip",
|
|
882
|
+
"rar",
|
|
883
|
+
"7z",
|
|
884
|
+
"tar",
|
|
885
|
+
"gz",
|
|
886
|
+
// Documents
|
|
887
|
+
"pdf",
|
|
888
|
+
"doc",
|
|
889
|
+
"docx",
|
|
890
|
+
"xls",
|
|
891
|
+
"xlsx"
|
|
892
|
+
];
|
|
849
893
|
const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
850
894
|
constructor() {
|
|
851
895
|
__publicField$1(this, "currentHref", null);
|
|
@@ -855,8 +899,13 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
855
899
|
_AsyncStylesheetManager.instance = this;
|
|
856
900
|
}
|
|
857
901
|
removeCloneNode(href) {
|
|
902
|
+
var _a2;
|
|
858
903
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
859
|
-
document.
|
|
904
|
+
const clone = document.querySelector(
|
|
905
|
+
`link[data-rrweb-link-cloned="${this.clones[href].cloneNodeAttrId}"]`
|
|
906
|
+
);
|
|
907
|
+
if (!clone) return;
|
|
908
|
+
(_a2 = clone.parentNode) == null ? void 0 : _a2.removeChild(clone);
|
|
860
909
|
}
|
|
861
910
|
onLoad(href) {
|
|
862
911
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
@@ -891,10 +940,17 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
891
940
|
);
|
|
892
941
|
this.clones[href].cssText = newCssText;
|
|
893
942
|
this.clones[href].loaded = true;
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
Date.now().toString()
|
|
943
|
+
const original = document.querySelector(
|
|
944
|
+
`link[data-rrweb-link-cloned="source-${this.clones[href].cloneNodeAttrId}"]`
|
|
897
945
|
);
|
|
946
|
+
if (!original) {
|
|
947
|
+
this.clones[href].original.setAttribute(
|
|
948
|
+
"data-rrweb-mutation",
|
|
949
|
+
Date.now().toString()
|
|
950
|
+
);
|
|
951
|
+
} else {
|
|
952
|
+
original.setAttribute("data-rrweb-mutation", Date.now().toString());
|
|
953
|
+
}
|
|
898
954
|
}
|
|
899
955
|
onLoadError(href) {
|
|
900
956
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
@@ -923,19 +979,35 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
923
979
|
if (!href) return;
|
|
924
980
|
if (href in this.clones && this.clones[href] !== void 0) return;
|
|
925
981
|
if (forElement.getAttribute("crossorigin") === "anonymous") return;
|
|
982
|
+
if (forElement.rel !== "stylesheet") {
|
|
983
|
+
const last = href.split("/").pop();
|
|
984
|
+
if (last && last.includes(".")) {
|
|
985
|
+
const [filename] = last.split("?");
|
|
986
|
+
const ext = filename.split(".").pop();
|
|
987
|
+
if (ext) {
|
|
988
|
+
if (DISALLOWED_EXTENSIONS$1.includes(ext.toLowerCase())) return;
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
}
|
|
926
992
|
console.log(
|
|
927
993
|
"AsyncStylesheetManager, registerClone: registering clone for href:",
|
|
928
994
|
href
|
|
929
995
|
);
|
|
930
996
|
const clone = forElement.cloneNode();
|
|
997
|
+
const cloneNodeAttrId = Math.random().toString(36).slice(2);
|
|
931
998
|
clone.setAttribute("crossorigin", "anonymous");
|
|
932
|
-
clone.setAttribute("data-rrweb-link-cloned",
|
|
999
|
+
clone.setAttribute("data-rrweb-link-cloned", cloneNodeAttrId);
|
|
1000
|
+
forElement.setAttribute(
|
|
1001
|
+
"data-rrweb-link-cloned",
|
|
1002
|
+
`source-${cloneNodeAttrId}`
|
|
1003
|
+
);
|
|
933
1004
|
document.head.appendChild(clone);
|
|
934
1005
|
this.clones[href] = {
|
|
935
1006
|
original: forElement,
|
|
936
1007
|
clone,
|
|
937
1008
|
loaded: false,
|
|
938
|
-
cssText: null
|
|
1009
|
+
cssText: null,
|
|
1010
|
+
cloneNodeAttrId
|
|
939
1011
|
};
|
|
940
1012
|
clone.onload = () => {
|
|
941
1013
|
this.onLoad(href);
|
|
@@ -944,7 +1016,10 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
944
1016
|
this.onLoadError(href);
|
|
945
1017
|
};
|
|
946
1018
|
if (this.cleanTimeout) clearTimeout(this.cleanTimeout);
|
|
947
|
-
this.cleanTimeout = setTimeout(
|
|
1019
|
+
this.cleanTimeout = setTimeout(
|
|
1020
|
+
asyncStylesheetManager$1.onCleanTimeout,
|
|
1021
|
+
CLEANUP_DEBOUNCE_TIME$1
|
|
1022
|
+
);
|
|
948
1023
|
}
|
|
949
1024
|
getClonedCssTextIfAvailable(href) {
|
|
950
1025
|
if (href in this.clones && this.clones[href] !== void 0 && this.clones[href].loaded === true) {
|
|
@@ -959,7 +1034,7 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
959
1034
|
};
|
|
960
1035
|
__publicField$1(_AsyncStylesheetManager$1, "instance");
|
|
961
1036
|
let AsyncStylesheetManager$1 = _AsyncStylesheetManager$1;
|
|
962
|
-
const asyncStylesheetManager = new AsyncStylesheetManager$1();
|
|
1037
|
+
const asyncStylesheetManager$1 = new AsyncStylesheetManager$1();
|
|
963
1038
|
let _id = 1;
|
|
964
1039
|
const tagNameRegex = new RegExp("[^a-z0-9-_:]");
|
|
965
1040
|
const IGNORED_NODE = -2;
|
|
@@ -1364,7 +1439,7 @@ function serializeElementNode(n2, options) {
|
|
|
1364
1439
|
cssText = stringifyStylesheet$1(stylesheet);
|
|
1365
1440
|
}
|
|
1366
1441
|
if (!cssText) {
|
|
1367
|
-
cssText = asyncStylesheetManager.getClonedCssTextIfAvailable(
|
|
1442
|
+
cssText = asyncStylesheetManager$1.getClonedCssTextIfAvailable(
|
|
1368
1443
|
n2.href
|
|
1369
1444
|
);
|
|
1370
1445
|
}
|
|
@@ -1373,7 +1448,7 @@ function serializeElementNode(n2, options) {
|
|
|
1373
1448
|
delete attributes.href;
|
|
1374
1449
|
attributes._cssText = cssText;
|
|
1375
1450
|
} else {
|
|
1376
|
-
asyncStylesheetManager.registerClone({
|
|
1451
|
+
asyncStylesheetManager$1.registerClone({
|
|
1377
1452
|
forElement: n2
|
|
1378
1453
|
});
|
|
1379
1454
|
}
|
|
@@ -5666,7 +5741,51 @@ function absolutifyURLs(cssText, href) {
|
|
|
5666
5741
|
}
|
|
5667
5742
|
);
|
|
5668
5743
|
}
|
|
5669
|
-
const CLEANUP_DEBOUNCE_TIME = 1e3 * 60 *
|
|
5744
|
+
const CLEANUP_DEBOUNCE_TIME = 1e3 * 60 * 2;
|
|
5745
|
+
const DISALLOWED_EXTENSIONS = [
|
|
5746
|
+
// Fonts
|
|
5747
|
+
"woff",
|
|
5748
|
+
"woff2",
|
|
5749
|
+
"ttf",
|
|
5750
|
+
"otf",
|
|
5751
|
+
// Embedded OpenType font
|
|
5752
|
+
"eot",
|
|
5753
|
+
// Images
|
|
5754
|
+
"png",
|
|
5755
|
+
"jpg",
|
|
5756
|
+
"jpeg",
|
|
5757
|
+
"gif",
|
|
5758
|
+
"svg",
|
|
5759
|
+
"webp",
|
|
5760
|
+
"ico",
|
|
5761
|
+
// Scripts
|
|
5762
|
+
"js",
|
|
5763
|
+
"mjs",
|
|
5764
|
+
"ts",
|
|
5765
|
+
"jsx",
|
|
5766
|
+
"tsx",
|
|
5767
|
+
// Data files
|
|
5768
|
+
"json",
|
|
5769
|
+
"map",
|
|
5770
|
+
// Media
|
|
5771
|
+
"mp4",
|
|
5772
|
+
"webm",
|
|
5773
|
+
"ogg",
|
|
5774
|
+
"mp3",
|
|
5775
|
+
"wav",
|
|
5776
|
+
// Archives
|
|
5777
|
+
"zip",
|
|
5778
|
+
"rar",
|
|
5779
|
+
"7z",
|
|
5780
|
+
"tar",
|
|
5781
|
+
"gz",
|
|
5782
|
+
// Documents
|
|
5783
|
+
"pdf",
|
|
5784
|
+
"doc",
|
|
5785
|
+
"docx",
|
|
5786
|
+
"xls",
|
|
5787
|
+
"xlsx"
|
|
5788
|
+
];
|
|
5670
5789
|
const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
5671
5790
|
constructor() {
|
|
5672
5791
|
__publicField22(this, "currentHref", null);
|
|
@@ -5676,8 +5795,13 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5676
5795
|
_AsyncStylesheetManager22.instance = this;
|
|
5677
5796
|
}
|
|
5678
5797
|
removeCloneNode(href) {
|
|
5798
|
+
var _a2;
|
|
5679
5799
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
5680
|
-
document.
|
|
5800
|
+
const clone = document.querySelector(
|
|
5801
|
+
`link[data-rrweb-link-cloned="${this.clones[href].cloneNodeAttrId}"]`
|
|
5802
|
+
);
|
|
5803
|
+
if (!clone) return;
|
|
5804
|
+
(_a2 = clone.parentNode) == null ? void 0 : _a2.removeChild(clone);
|
|
5681
5805
|
}
|
|
5682
5806
|
onLoad(href) {
|
|
5683
5807
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
@@ -5712,10 +5836,17 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5712
5836
|
);
|
|
5713
5837
|
this.clones[href].cssText = newCssText;
|
|
5714
5838
|
this.clones[href].loaded = true;
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
Date.now().toString()
|
|
5839
|
+
const original = document.querySelector(
|
|
5840
|
+
`link[data-rrweb-link-cloned="source-${this.clones[href].cloneNodeAttrId}"]`
|
|
5718
5841
|
);
|
|
5842
|
+
if (!original) {
|
|
5843
|
+
this.clones[href].original.setAttribute(
|
|
5844
|
+
"data-rrweb-mutation",
|
|
5845
|
+
Date.now().toString()
|
|
5846
|
+
);
|
|
5847
|
+
} else {
|
|
5848
|
+
original.setAttribute("data-rrweb-mutation", Date.now().toString());
|
|
5849
|
+
}
|
|
5719
5850
|
}
|
|
5720
5851
|
onLoadError(href) {
|
|
5721
5852
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
@@ -5744,19 +5875,35 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5744
5875
|
if (!href) return;
|
|
5745
5876
|
if (href in this.clones && this.clones[href] !== void 0) return;
|
|
5746
5877
|
if (forElement.getAttribute("crossorigin") === "anonymous") return;
|
|
5878
|
+
if (forElement.rel !== "stylesheet") {
|
|
5879
|
+
const last = href.split("/").pop();
|
|
5880
|
+
if (last && last.includes(".")) {
|
|
5881
|
+
const [filename] = last.split("?");
|
|
5882
|
+
const ext = filename.split(".").pop();
|
|
5883
|
+
if (ext) {
|
|
5884
|
+
if (DISALLOWED_EXTENSIONS.includes(ext.toLowerCase())) return;
|
|
5885
|
+
}
|
|
5886
|
+
}
|
|
5887
|
+
}
|
|
5747
5888
|
console.log(
|
|
5748
5889
|
"AsyncStylesheetManager, registerClone: registering clone for href:",
|
|
5749
5890
|
href
|
|
5750
5891
|
);
|
|
5751
5892
|
const clone = forElement.cloneNode();
|
|
5893
|
+
const cloneNodeAttrId = Math.random().toString(36).slice(2);
|
|
5752
5894
|
clone.setAttribute("crossorigin", "anonymous");
|
|
5753
|
-
clone.setAttribute("data-rrweb-link-cloned",
|
|
5895
|
+
clone.setAttribute("data-rrweb-link-cloned", cloneNodeAttrId);
|
|
5896
|
+
forElement.setAttribute(
|
|
5897
|
+
"data-rrweb-link-cloned",
|
|
5898
|
+
`source-${cloneNodeAttrId}`
|
|
5899
|
+
);
|
|
5754
5900
|
document.head.appendChild(clone);
|
|
5755
5901
|
this.clones[href] = {
|
|
5756
5902
|
original: forElement,
|
|
5757
5903
|
clone,
|
|
5758
5904
|
loaded: false,
|
|
5759
|
-
cssText: null
|
|
5905
|
+
cssText: null,
|
|
5906
|
+
cloneNodeAttrId
|
|
5760
5907
|
};
|
|
5761
5908
|
clone.onload = () => {
|
|
5762
5909
|
this.onLoad(href);
|
|
@@ -5765,7 +5912,10 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5765
5912
|
this.onLoadError(href);
|
|
5766
5913
|
};
|
|
5767
5914
|
if (this.cleanTimeout) clearTimeout(this.cleanTimeout);
|
|
5768
|
-
this.cleanTimeout = setTimeout(
|
|
5915
|
+
this.cleanTimeout = setTimeout(
|
|
5916
|
+
asyncStylesheetManager.onCleanTimeout,
|
|
5917
|
+
CLEANUP_DEBOUNCE_TIME
|
|
5918
|
+
);
|
|
5769
5919
|
}
|
|
5770
5920
|
getClonedCssTextIfAvailable(href) {
|
|
5771
5921
|
if (href in this.clones && this.clones[href] !== void 0 && this.clones[href].loaded === true) {
|
|
@@ -5780,7 +5930,7 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5780
5930
|
};
|
|
5781
5931
|
__publicField22(_AsyncStylesheetManager2, "instance");
|
|
5782
5932
|
let AsyncStylesheetManager = _AsyncStylesheetManager2;
|
|
5783
|
-
new AsyncStylesheetManager();
|
|
5933
|
+
const asyncStylesheetManager = new AsyncStylesheetManager();
|
|
5784
5934
|
function getDefaultExportFromCjs(x2) {
|
|
5785
5935
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
5786
5936
|
}
|