@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.cjs
CHANGED
|
@@ -812,7 +812,51 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
|
|
|
812
812
|
function markCssSplits(cssText, style) {
|
|
813
813
|
return splitCssText(cssText, style).join("/* rr_split */");
|
|
814
814
|
}
|
|
815
|
-
const CLEANUP_DEBOUNCE_TIME$1 = 1e3 * 60 *
|
|
815
|
+
const CLEANUP_DEBOUNCE_TIME$1 = 1e3 * 60 * 2;
|
|
816
|
+
const DISALLOWED_EXTENSIONS$1 = [
|
|
817
|
+
// Fonts
|
|
818
|
+
"woff",
|
|
819
|
+
"woff2",
|
|
820
|
+
"ttf",
|
|
821
|
+
"otf",
|
|
822
|
+
// Embedded OpenType font
|
|
823
|
+
"eot",
|
|
824
|
+
// Images
|
|
825
|
+
"png",
|
|
826
|
+
"jpg",
|
|
827
|
+
"jpeg",
|
|
828
|
+
"gif",
|
|
829
|
+
"svg",
|
|
830
|
+
"webp",
|
|
831
|
+
"ico",
|
|
832
|
+
// Scripts
|
|
833
|
+
"js",
|
|
834
|
+
"mjs",
|
|
835
|
+
"ts",
|
|
836
|
+
"jsx",
|
|
837
|
+
"tsx",
|
|
838
|
+
// Data files
|
|
839
|
+
"json",
|
|
840
|
+
"map",
|
|
841
|
+
// Media
|
|
842
|
+
"mp4",
|
|
843
|
+
"webm",
|
|
844
|
+
"ogg",
|
|
845
|
+
"mp3",
|
|
846
|
+
"wav",
|
|
847
|
+
// Archives
|
|
848
|
+
"zip",
|
|
849
|
+
"rar",
|
|
850
|
+
"7z",
|
|
851
|
+
"tar",
|
|
852
|
+
"gz",
|
|
853
|
+
// Documents
|
|
854
|
+
"pdf",
|
|
855
|
+
"doc",
|
|
856
|
+
"docx",
|
|
857
|
+
"xls",
|
|
858
|
+
"xlsx"
|
|
859
|
+
];
|
|
816
860
|
const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
817
861
|
constructor() {
|
|
818
862
|
__publicField$1(this, "currentHref", null);
|
|
@@ -822,8 +866,13 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
822
866
|
_AsyncStylesheetManager.instance = this;
|
|
823
867
|
}
|
|
824
868
|
removeCloneNode(href) {
|
|
869
|
+
var _a2;
|
|
825
870
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
826
|
-
document.
|
|
871
|
+
const clone = document.querySelector(
|
|
872
|
+
`link[data-rrweb-link-cloned="${this.clones[href].cloneNodeAttrId}"]`
|
|
873
|
+
);
|
|
874
|
+
if (!clone) return;
|
|
875
|
+
(_a2 = clone.parentNode) == null ? void 0 : _a2.removeChild(clone);
|
|
827
876
|
}
|
|
828
877
|
onLoad(href) {
|
|
829
878
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
@@ -858,10 +907,17 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
858
907
|
);
|
|
859
908
|
this.clones[href].cssText = newCssText;
|
|
860
909
|
this.clones[href].loaded = true;
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
Date.now().toString()
|
|
910
|
+
const original = document.querySelector(
|
|
911
|
+
`link[data-rrweb-link-cloned="source-${this.clones[href].cloneNodeAttrId}"]`
|
|
864
912
|
);
|
|
913
|
+
if (!original) {
|
|
914
|
+
this.clones[href].original.setAttribute(
|
|
915
|
+
"data-rrweb-mutation",
|
|
916
|
+
Date.now().toString()
|
|
917
|
+
);
|
|
918
|
+
} else {
|
|
919
|
+
original.setAttribute("data-rrweb-mutation", Date.now().toString());
|
|
920
|
+
}
|
|
865
921
|
}
|
|
866
922
|
onLoadError(href) {
|
|
867
923
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
@@ -890,19 +946,35 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
890
946
|
if (!href) return;
|
|
891
947
|
if (href in this.clones && this.clones[href] !== void 0) return;
|
|
892
948
|
if (forElement.getAttribute("crossorigin") === "anonymous") return;
|
|
949
|
+
if (forElement.rel !== "stylesheet") {
|
|
950
|
+
const last = href.split("/").pop();
|
|
951
|
+
if (last && last.includes(".")) {
|
|
952
|
+
const [filename] = last.split("?");
|
|
953
|
+
const ext = filename.split(".").pop();
|
|
954
|
+
if (ext) {
|
|
955
|
+
if (DISALLOWED_EXTENSIONS$1.includes(ext.toLowerCase())) return;
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
}
|
|
893
959
|
console.log(
|
|
894
960
|
"AsyncStylesheetManager, registerClone: registering clone for href:",
|
|
895
961
|
href
|
|
896
962
|
);
|
|
897
963
|
const clone = forElement.cloneNode();
|
|
964
|
+
const cloneNodeAttrId = Math.random().toString(36).slice(2);
|
|
898
965
|
clone.setAttribute("crossorigin", "anonymous");
|
|
899
|
-
clone.setAttribute("data-rrweb-link-cloned",
|
|
966
|
+
clone.setAttribute("data-rrweb-link-cloned", cloneNodeAttrId);
|
|
967
|
+
forElement.setAttribute(
|
|
968
|
+
"data-rrweb-link-cloned",
|
|
969
|
+
`source-${cloneNodeAttrId}`
|
|
970
|
+
);
|
|
900
971
|
document.head.appendChild(clone);
|
|
901
972
|
this.clones[href] = {
|
|
902
973
|
original: forElement,
|
|
903
974
|
clone,
|
|
904
975
|
loaded: false,
|
|
905
|
-
cssText: null
|
|
976
|
+
cssText: null,
|
|
977
|
+
cloneNodeAttrId
|
|
906
978
|
};
|
|
907
979
|
clone.onload = () => {
|
|
908
980
|
this.onLoad(href);
|
|
@@ -911,7 +983,10 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
911
983
|
this.onLoadError(href);
|
|
912
984
|
};
|
|
913
985
|
if (this.cleanTimeout) clearTimeout(this.cleanTimeout);
|
|
914
|
-
this.cleanTimeout = setTimeout(
|
|
986
|
+
this.cleanTimeout = setTimeout(
|
|
987
|
+
asyncStylesheetManager$1.onCleanTimeout,
|
|
988
|
+
CLEANUP_DEBOUNCE_TIME$1
|
|
989
|
+
);
|
|
915
990
|
}
|
|
916
991
|
getClonedCssTextIfAvailable(href) {
|
|
917
992
|
if (href in this.clones && this.clones[href] !== void 0 && this.clones[href].loaded === true) {
|
|
@@ -926,7 +1001,7 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
926
1001
|
};
|
|
927
1002
|
__publicField$1(_AsyncStylesheetManager$1, "instance");
|
|
928
1003
|
let AsyncStylesheetManager$1 = _AsyncStylesheetManager$1;
|
|
929
|
-
const asyncStylesheetManager = new AsyncStylesheetManager$1();
|
|
1004
|
+
const asyncStylesheetManager$1 = new AsyncStylesheetManager$1();
|
|
930
1005
|
let _id = 1;
|
|
931
1006
|
const tagNameRegex = new RegExp("[^a-z0-9-_:]");
|
|
932
1007
|
const IGNORED_NODE = -2;
|
|
@@ -1331,7 +1406,7 @@ function serializeElementNode(n2, options) {
|
|
|
1331
1406
|
cssText = stringifyStylesheet$1(stylesheet);
|
|
1332
1407
|
}
|
|
1333
1408
|
if (!cssText) {
|
|
1334
|
-
cssText = asyncStylesheetManager.getClonedCssTextIfAvailable(
|
|
1409
|
+
cssText = asyncStylesheetManager$1.getClonedCssTextIfAvailable(
|
|
1335
1410
|
n2.href
|
|
1336
1411
|
);
|
|
1337
1412
|
}
|
|
@@ -1340,7 +1415,7 @@ function serializeElementNode(n2, options) {
|
|
|
1340
1415
|
delete attributes.href;
|
|
1341
1416
|
attributes._cssText = cssText;
|
|
1342
1417
|
} else {
|
|
1343
|
-
asyncStylesheetManager.registerClone({
|
|
1418
|
+
asyncStylesheetManager$1.registerClone({
|
|
1344
1419
|
forElement: n2
|
|
1345
1420
|
});
|
|
1346
1421
|
}
|
|
@@ -5629,7 +5704,51 @@ function absolutifyURLs(cssText, href) {
|
|
|
5629
5704
|
}
|
|
5630
5705
|
);
|
|
5631
5706
|
}
|
|
5632
|
-
const CLEANUP_DEBOUNCE_TIME = 1e3 * 60 *
|
|
5707
|
+
const CLEANUP_DEBOUNCE_TIME = 1e3 * 60 * 2;
|
|
5708
|
+
const DISALLOWED_EXTENSIONS = [
|
|
5709
|
+
// Fonts
|
|
5710
|
+
"woff",
|
|
5711
|
+
"woff2",
|
|
5712
|
+
"ttf",
|
|
5713
|
+
"otf",
|
|
5714
|
+
// Embedded OpenType font
|
|
5715
|
+
"eot",
|
|
5716
|
+
// Images
|
|
5717
|
+
"png",
|
|
5718
|
+
"jpg",
|
|
5719
|
+
"jpeg",
|
|
5720
|
+
"gif",
|
|
5721
|
+
"svg",
|
|
5722
|
+
"webp",
|
|
5723
|
+
"ico",
|
|
5724
|
+
// Scripts
|
|
5725
|
+
"js",
|
|
5726
|
+
"mjs",
|
|
5727
|
+
"ts",
|
|
5728
|
+
"jsx",
|
|
5729
|
+
"tsx",
|
|
5730
|
+
// Data files
|
|
5731
|
+
"json",
|
|
5732
|
+
"map",
|
|
5733
|
+
// Media
|
|
5734
|
+
"mp4",
|
|
5735
|
+
"webm",
|
|
5736
|
+
"ogg",
|
|
5737
|
+
"mp3",
|
|
5738
|
+
"wav",
|
|
5739
|
+
// Archives
|
|
5740
|
+
"zip",
|
|
5741
|
+
"rar",
|
|
5742
|
+
"7z",
|
|
5743
|
+
"tar",
|
|
5744
|
+
"gz",
|
|
5745
|
+
// Documents
|
|
5746
|
+
"pdf",
|
|
5747
|
+
"doc",
|
|
5748
|
+
"docx",
|
|
5749
|
+
"xls",
|
|
5750
|
+
"xlsx"
|
|
5751
|
+
];
|
|
5633
5752
|
const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
5634
5753
|
constructor() {
|
|
5635
5754
|
__publicField22(this, "currentHref", null);
|
|
@@ -5639,8 +5758,13 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5639
5758
|
_AsyncStylesheetManager22.instance = this;
|
|
5640
5759
|
}
|
|
5641
5760
|
removeCloneNode(href) {
|
|
5761
|
+
var _a2;
|
|
5642
5762
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
5643
|
-
document.
|
|
5763
|
+
const clone = document.querySelector(
|
|
5764
|
+
`link[data-rrweb-link-cloned="${this.clones[href].cloneNodeAttrId}"]`
|
|
5765
|
+
);
|
|
5766
|
+
if (!clone) return;
|
|
5767
|
+
(_a2 = clone.parentNode) == null ? void 0 : _a2.removeChild(clone);
|
|
5644
5768
|
}
|
|
5645
5769
|
onLoad(href) {
|
|
5646
5770
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
@@ -5675,10 +5799,17 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5675
5799
|
);
|
|
5676
5800
|
this.clones[href].cssText = newCssText;
|
|
5677
5801
|
this.clones[href].loaded = true;
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
Date.now().toString()
|
|
5802
|
+
const original = document.querySelector(
|
|
5803
|
+
`link[data-rrweb-link-cloned="source-${this.clones[href].cloneNodeAttrId}"]`
|
|
5681
5804
|
);
|
|
5805
|
+
if (!original) {
|
|
5806
|
+
this.clones[href].original.setAttribute(
|
|
5807
|
+
"data-rrweb-mutation",
|
|
5808
|
+
Date.now().toString()
|
|
5809
|
+
);
|
|
5810
|
+
} else {
|
|
5811
|
+
original.setAttribute("data-rrweb-mutation", Date.now().toString());
|
|
5812
|
+
}
|
|
5682
5813
|
}
|
|
5683
5814
|
onLoadError(href) {
|
|
5684
5815
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
@@ -5707,19 +5838,35 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5707
5838
|
if (!href) return;
|
|
5708
5839
|
if (href in this.clones && this.clones[href] !== void 0) return;
|
|
5709
5840
|
if (forElement.getAttribute("crossorigin") === "anonymous") return;
|
|
5841
|
+
if (forElement.rel !== "stylesheet") {
|
|
5842
|
+
const last = href.split("/").pop();
|
|
5843
|
+
if (last && last.includes(".")) {
|
|
5844
|
+
const [filename] = last.split("?");
|
|
5845
|
+
const ext = filename.split(".").pop();
|
|
5846
|
+
if (ext) {
|
|
5847
|
+
if (DISALLOWED_EXTENSIONS.includes(ext.toLowerCase())) return;
|
|
5848
|
+
}
|
|
5849
|
+
}
|
|
5850
|
+
}
|
|
5710
5851
|
console.log(
|
|
5711
5852
|
"AsyncStylesheetManager, registerClone: registering clone for href:",
|
|
5712
5853
|
href
|
|
5713
5854
|
);
|
|
5714
5855
|
const clone = forElement.cloneNode();
|
|
5856
|
+
const cloneNodeAttrId = Math.random().toString(36).slice(2);
|
|
5715
5857
|
clone.setAttribute("crossorigin", "anonymous");
|
|
5716
|
-
clone.setAttribute("data-rrweb-link-cloned",
|
|
5858
|
+
clone.setAttribute("data-rrweb-link-cloned", cloneNodeAttrId);
|
|
5859
|
+
forElement.setAttribute(
|
|
5860
|
+
"data-rrweb-link-cloned",
|
|
5861
|
+
`source-${cloneNodeAttrId}`
|
|
5862
|
+
);
|
|
5717
5863
|
document.head.appendChild(clone);
|
|
5718
5864
|
this.clones[href] = {
|
|
5719
5865
|
original: forElement,
|
|
5720
5866
|
clone,
|
|
5721
5867
|
loaded: false,
|
|
5722
|
-
cssText: null
|
|
5868
|
+
cssText: null,
|
|
5869
|
+
cloneNodeAttrId
|
|
5723
5870
|
};
|
|
5724
5871
|
clone.onload = () => {
|
|
5725
5872
|
this.onLoad(href);
|
|
@@ -5728,7 +5875,10 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5728
5875
|
this.onLoadError(href);
|
|
5729
5876
|
};
|
|
5730
5877
|
if (this.cleanTimeout) clearTimeout(this.cleanTimeout);
|
|
5731
|
-
this.cleanTimeout = setTimeout(
|
|
5878
|
+
this.cleanTimeout = setTimeout(
|
|
5879
|
+
asyncStylesheetManager.onCleanTimeout,
|
|
5880
|
+
CLEANUP_DEBOUNCE_TIME
|
|
5881
|
+
);
|
|
5732
5882
|
}
|
|
5733
5883
|
getClonedCssTextIfAvailable(href) {
|
|
5734
5884
|
if (href in this.clones && this.clones[href] !== void 0 && this.clones[href].loaded === true) {
|
|
@@ -5743,7 +5893,7 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5743
5893
|
};
|
|
5744
5894
|
__publicField22(_AsyncStylesheetManager2, "instance");
|
|
5745
5895
|
let AsyncStylesheetManager = _AsyncStylesheetManager2;
|
|
5746
|
-
new AsyncStylesheetManager();
|
|
5896
|
+
const asyncStylesheetManager = new AsyncStylesheetManager();
|
|
5747
5897
|
function getDefaultExportFromCjs(x2) {
|
|
5748
5898
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
5749
5899
|
}
|