@glimt/record 0.0.43 → 0.0.45
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 +160 -22
- package/dist/record.cjs.map +1 -1
- package/dist/record.js +160 -22
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +160 -22
- package/dist/record.umd.cjs.map +2 -2
- package/dist/record.umd.min.cjs +28 -28
- 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 *
|
|
815
|
+
const CLEANUP_DEBOUNCE_TIME$1 = 1e3 * 30;
|
|
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,12 +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
871
|
const clone = document.querySelector(
|
|
827
872
|
`link[data-rrweb-link-cloned="${this.clones[href].cloneNodeAttrId}"]`
|
|
828
873
|
);
|
|
829
874
|
if (!clone) return;
|
|
830
|
-
|
|
875
|
+
(_a2 = clone.parentNode) == null ? void 0 : _a2.removeChild(clone);
|
|
831
876
|
}
|
|
832
877
|
onLoad(href) {
|
|
833
878
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
@@ -862,10 +907,17 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
862
907
|
);
|
|
863
908
|
this.clones[href].cssText = newCssText;
|
|
864
909
|
this.clones[href].loaded = true;
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
Date.now().toString()
|
|
910
|
+
const original = document.querySelector(
|
|
911
|
+
`link[data-rrweb-link-cloned="source-${this.clones[href].cloneNodeAttrId}"]`
|
|
868
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
|
+
}
|
|
869
921
|
}
|
|
870
922
|
onLoadError(href) {
|
|
871
923
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
@@ -878,13 +930,13 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
878
930
|
}
|
|
879
931
|
onCleanTimeout() {
|
|
880
932
|
console.log("AsyncStylesheetManager, onCleanTimeout: cleaning up");
|
|
881
|
-
|
|
882
|
-
|
|
933
|
+
asyncStylesheetManager$1.cleanTimeout = null;
|
|
934
|
+
asyncStylesheetManager$1.removeAllCloneElements();
|
|
883
935
|
}
|
|
884
936
|
blowCache() {
|
|
885
937
|
console.log("AsyncStylesheetManager, blowCache: blowing cache");
|
|
886
|
-
this.clones = {};
|
|
887
938
|
this.removeAllCloneElements();
|
|
939
|
+
this.clones = {};
|
|
888
940
|
}
|
|
889
941
|
registerClone({ forElement }) {
|
|
890
942
|
if (this.currentHref != null && document.location.href !== this.currentHref)
|
|
@@ -894,6 +946,16 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
894
946
|
if (!href) return;
|
|
895
947
|
if (href in this.clones && this.clones[href] !== void 0) return;
|
|
896
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.trim().toLowerCase())) return;
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
}
|
|
897
959
|
console.log(
|
|
898
960
|
"AsyncStylesheetManager, registerClone: registering clone for href:",
|
|
899
961
|
href
|
|
@@ -902,6 +964,10 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
902
964
|
const cloneNodeAttrId = Math.random().toString(36).slice(2);
|
|
903
965
|
clone.setAttribute("crossorigin", "anonymous");
|
|
904
966
|
clone.setAttribute("data-rrweb-link-cloned", cloneNodeAttrId);
|
|
967
|
+
forElement.setAttribute(
|
|
968
|
+
"data-rrweb-link-cloned",
|
|
969
|
+
`source-${cloneNodeAttrId}`
|
|
970
|
+
);
|
|
905
971
|
document.head.appendChild(clone);
|
|
906
972
|
this.clones[href] = {
|
|
907
973
|
original: forElement,
|
|
@@ -917,7 +983,10 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
917
983
|
this.onLoadError(href);
|
|
918
984
|
};
|
|
919
985
|
if (this.cleanTimeout) clearTimeout(this.cleanTimeout);
|
|
920
|
-
this.cleanTimeout = setTimeout(
|
|
986
|
+
this.cleanTimeout = setTimeout(
|
|
987
|
+
asyncStylesheetManager$1.onCleanTimeout,
|
|
988
|
+
CLEANUP_DEBOUNCE_TIME$1
|
|
989
|
+
);
|
|
921
990
|
}
|
|
922
991
|
getClonedCssTextIfAvailable(href) {
|
|
923
992
|
if (href in this.clones && this.clones[href] !== void 0 && this.clones[href].loaded === true) {
|
|
@@ -932,7 +1001,7 @@ const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
|
|
|
932
1001
|
};
|
|
933
1002
|
__publicField$1(_AsyncStylesheetManager$1, "instance");
|
|
934
1003
|
let AsyncStylesheetManager$1 = _AsyncStylesheetManager$1;
|
|
935
|
-
const asyncStylesheetManager = new AsyncStylesheetManager$1();
|
|
1004
|
+
const asyncStylesheetManager$1 = new AsyncStylesheetManager$1();
|
|
936
1005
|
let _id = 1;
|
|
937
1006
|
const tagNameRegex = new RegExp("[^a-z0-9-_:]");
|
|
938
1007
|
const IGNORED_NODE = -2;
|
|
@@ -1337,7 +1406,7 @@ function serializeElementNode(n2, options) {
|
|
|
1337
1406
|
cssText = stringifyStylesheet$1(stylesheet);
|
|
1338
1407
|
}
|
|
1339
1408
|
if (!cssText) {
|
|
1340
|
-
cssText = asyncStylesheetManager.getClonedCssTextIfAvailable(
|
|
1409
|
+
cssText = asyncStylesheetManager$1.getClonedCssTextIfAvailable(
|
|
1341
1410
|
n2.href
|
|
1342
1411
|
);
|
|
1343
1412
|
}
|
|
@@ -1346,7 +1415,7 @@ function serializeElementNode(n2, options) {
|
|
|
1346
1415
|
delete attributes.href;
|
|
1347
1416
|
attributes._cssText = cssText;
|
|
1348
1417
|
} else {
|
|
1349
|
-
asyncStylesheetManager.registerClone({
|
|
1418
|
+
asyncStylesheetManager$1.registerClone({
|
|
1350
1419
|
forElement: n2
|
|
1351
1420
|
});
|
|
1352
1421
|
}
|
|
@@ -5635,7 +5704,51 @@ function absolutifyURLs(cssText, href) {
|
|
|
5635
5704
|
}
|
|
5636
5705
|
);
|
|
5637
5706
|
}
|
|
5638
|
-
const CLEANUP_DEBOUNCE_TIME = 1e3 *
|
|
5707
|
+
const CLEANUP_DEBOUNCE_TIME = 1e3 * 30;
|
|
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
|
+
];
|
|
5639
5752
|
const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
5640
5753
|
constructor() {
|
|
5641
5754
|
__publicField22(this, "currentHref", null);
|
|
@@ -5645,12 +5758,13 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5645
5758
|
_AsyncStylesheetManager22.instance = this;
|
|
5646
5759
|
}
|
|
5647
5760
|
removeCloneNode(href) {
|
|
5761
|
+
var _a2;
|
|
5648
5762
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
5649
5763
|
const clone = document.querySelector(
|
|
5650
5764
|
`link[data-rrweb-link-cloned="${this.clones[href].cloneNodeAttrId}"]`
|
|
5651
5765
|
);
|
|
5652
5766
|
if (!clone) return;
|
|
5653
|
-
|
|
5767
|
+
(_a2 = clone.parentNode) == null ? void 0 : _a2.removeChild(clone);
|
|
5654
5768
|
}
|
|
5655
5769
|
onLoad(href) {
|
|
5656
5770
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
@@ -5685,10 +5799,17 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5685
5799
|
);
|
|
5686
5800
|
this.clones[href].cssText = newCssText;
|
|
5687
5801
|
this.clones[href].loaded = true;
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
Date.now().toString()
|
|
5802
|
+
const original = document.querySelector(
|
|
5803
|
+
`link[data-rrweb-link-cloned="source-${this.clones[href].cloneNodeAttrId}"]`
|
|
5691
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
|
+
}
|
|
5692
5813
|
}
|
|
5693
5814
|
onLoadError(href) {
|
|
5694
5815
|
if (!(href in this.clones) || this.clones[href] === void 0) return;
|
|
@@ -5701,13 +5822,13 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5701
5822
|
}
|
|
5702
5823
|
onCleanTimeout() {
|
|
5703
5824
|
console.log("AsyncStylesheetManager, onCleanTimeout: cleaning up");
|
|
5704
|
-
|
|
5705
|
-
|
|
5825
|
+
asyncStylesheetManager.cleanTimeout = null;
|
|
5826
|
+
asyncStylesheetManager.removeAllCloneElements();
|
|
5706
5827
|
}
|
|
5707
5828
|
blowCache() {
|
|
5708
5829
|
console.log("AsyncStylesheetManager, blowCache: blowing cache");
|
|
5709
|
-
this.clones = {};
|
|
5710
5830
|
this.removeAllCloneElements();
|
|
5831
|
+
this.clones = {};
|
|
5711
5832
|
}
|
|
5712
5833
|
registerClone({ forElement }) {
|
|
5713
5834
|
if (this.currentHref != null && document.location.href !== this.currentHref)
|
|
@@ -5717,6 +5838,16 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5717
5838
|
if (!href) return;
|
|
5718
5839
|
if (href in this.clones && this.clones[href] !== void 0) return;
|
|
5719
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.trim().toLowerCase())) return;
|
|
5848
|
+
}
|
|
5849
|
+
}
|
|
5850
|
+
}
|
|
5720
5851
|
console.log(
|
|
5721
5852
|
"AsyncStylesheetManager, registerClone: registering clone for href:",
|
|
5722
5853
|
href
|
|
@@ -5725,6 +5856,10 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5725
5856
|
const cloneNodeAttrId = Math.random().toString(36).slice(2);
|
|
5726
5857
|
clone.setAttribute("crossorigin", "anonymous");
|
|
5727
5858
|
clone.setAttribute("data-rrweb-link-cloned", cloneNodeAttrId);
|
|
5859
|
+
forElement.setAttribute(
|
|
5860
|
+
"data-rrweb-link-cloned",
|
|
5861
|
+
`source-${cloneNodeAttrId}`
|
|
5862
|
+
);
|
|
5728
5863
|
document.head.appendChild(clone);
|
|
5729
5864
|
this.clones[href] = {
|
|
5730
5865
|
original: forElement,
|
|
@@ -5740,7 +5875,10 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5740
5875
|
this.onLoadError(href);
|
|
5741
5876
|
};
|
|
5742
5877
|
if (this.cleanTimeout) clearTimeout(this.cleanTimeout);
|
|
5743
|
-
this.cleanTimeout = setTimeout(
|
|
5878
|
+
this.cleanTimeout = setTimeout(
|
|
5879
|
+
asyncStylesheetManager.onCleanTimeout,
|
|
5880
|
+
CLEANUP_DEBOUNCE_TIME
|
|
5881
|
+
);
|
|
5744
5882
|
}
|
|
5745
5883
|
getClonedCssTextIfAvailable(href) {
|
|
5746
5884
|
if (href in this.clones && this.clones[href] !== void 0 && this.clones[href].loaded === true) {
|
|
@@ -5755,7 +5893,7 @@ const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
|
|
|
5755
5893
|
};
|
|
5756
5894
|
__publicField22(_AsyncStylesheetManager2, "instance");
|
|
5757
5895
|
let AsyncStylesheetManager = _AsyncStylesheetManager2;
|
|
5758
|
-
new AsyncStylesheetManager();
|
|
5896
|
+
const asyncStylesheetManager = new AsyncStylesheetManager();
|
|
5759
5897
|
function getDefaultExportFromCjs(x2) {
|
|
5760
5898
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
5761
5899
|
}
|