@glimt/record 0.0.52 → 0.0.54

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.
@@ -460,16 +460,11 @@ const index = {
460
460
  patch
461
461
  };
462
462
  const shouldTryAnonymousFetchingOnCorsError$1 = () => {
463
- try {
464
- console.log(
465
- "window._rrweb_skip_re_fetching_to_suppress_cors_errors",
466
- //@ts-expect-error
467
- window._rrweb_skip_re_fetching_to_suppress_cors_errors
468
- );
469
- } catch (err) {
470
- }
471
463
  return !("_rrweb_skip_re_fetching_to_suppress_cors_errors" in window && window._rrweb_skip_re_fetching_to_suppress_cors_errors === true);
472
464
  };
465
+ const isDebug$1 = () => {
466
+ return "_rrweb_is_debug" in window && window._rrweb_is_debug ? window._rrweb_is_debug : false;
467
+ };
473
468
  function isElement(n2) {
474
469
  return n2.nodeType === n2.ELEMENT_NODE;
475
470
  }
@@ -1539,9 +1534,7 @@ function serializeElementNode(n2, options) {
1539
1534
  const imageSrc = (image.currentSrc || image.getAttribute("src") || "<unknown-src>") + "";
1540
1535
  const imageHeight = image.naturalHeight;
1541
1536
  const imageWidth = image.naturalWidth;
1542
- console.log("handling inline image", image, imageSrc);
1543
1537
  const inlineImageCleanup = () => {
1544
- console.log("cleaning up", imageSrc);
1545
1538
  overrideImage = null;
1546
1539
  };
1547
1540
  const recordInlineImage = () => {
@@ -1555,11 +1548,8 @@ function serializeElementNode(n2, options) {
1555
1548
  dataURLOptions.quality
1556
1549
  );
1557
1550
  } catch (err) {
1558
- console.log("detected inline image error", err, imageSrc);
1559
1551
  if (image.crossOrigin !== "anonymous") {
1560
- console.log("crossOrigin is not anonymous", imageSrc);
1561
1552
  if (shouldTryAnonymousFetchingOnCorsError$1()) {
1562
- console.log("overriding image", imageSrc);
1563
1553
  overrideImage = new Image();
1564
1554
  overrideImage.src = imageSrc;
1565
1555
  overrideImage.crossOrigin = "anonymous";
@@ -1578,9 +1568,10 @@ function serializeElementNode(n2, options) {
1578
1568
  return;
1579
1569
  }
1580
1570
  } else {
1581
- console.warn(
1582
- `Cannot inline img src=${imageSrc}! Error: ${err}`
1583
- );
1571
+ if (isDebug$1())
1572
+ console.warn(
1573
+ `Cannot inline img src=${imageSrc}! Error: ${err}`
1574
+ );
1584
1575
  }
1585
1576
  }
1586
1577
  inlineImageCleanup();
@@ -1736,7 +1727,7 @@ function serializeNodeWithId(n2, options) {
1736
1727
  cssCaptured
1737
1728
  });
1738
1729
  if (!_serializedNode) {
1739
- console.warn(n2, "not serialized");
1730
+ if (isDebug$1()) console.warn(n2, "not serialized");
1740
1731
  return null;
1741
1732
  }
1742
1733
  let id;
@@ -5635,14 +5626,6 @@ var __defProp222 = Object.defineProperty;
5635
5626
  var __defNormalProp222 = (obj, key, value) => key in obj ? __defProp222(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5636
5627
  var __publicField22 = (obj, key, value) => __defNormalProp222(obj, typeof key !== "symbol" ? key + "" : key, value);
5637
5628
  const shouldTryAnonymousFetchingOnCorsError = () => {
5638
- try {
5639
- console.log(
5640
- "window._rrweb_skip_re_fetching_to_suppress_cors_errors",
5641
- //@ts-expect-error
5642
- window._rrweb_skip_re_fetching_to_suppress_cors_errors
5643
- );
5644
- } catch (err) {
5645
- }
5646
5629
  return !("_rrweb_skip_re_fetching_to_suppress_cors_errors" in window && window._rrweb_skip_re_fetching_to_suppress_cors_errors === true);
5647
5630
  };
5648
5631
  function fixBrowserCompatibilityIssuesInCSS(cssText) {
@@ -12731,6 +12714,9 @@ class StylesheetManager {
12731
12714
  trackStylesheetInLinkElement(_linkEl) {
12732
12715
  }
12733
12716
  }
12717
+ const isDebug = () => {
12718
+ return "_rrweb_is_debug" in window && window._rrweb_is_debug ? window._rrweb_is_debug : false;
12719
+ };
12734
12720
  let wrappedEmit;
12735
12721
  let takeFullSnapshot$1;
12736
12722
  let canvasManager;
@@ -12743,7 +12729,7 @@ try {
12743
12729
  document.body.removeChild(cleanFrame);
12744
12730
  }
12745
12731
  } catch (err) {
12746
- console.debug("Unable to override Array.from", err);
12732
+ if (isDebug()) console.debug("Unable to override Array.from", err);
12747
12733
  }
12748
12734
  const mirror = createMirror$2();
12749
12735
  function record(options = {}) {
@@ -13018,7 +13004,8 @@ function record(options = {}) {
13018
13004
  keepIframeSrcFn
13019
13005
  });
13020
13006
  if (!node2) {
13021
- return console.warn("Failed to snapshot the document");
13007
+ if (isDebug()) console.warn("Failed to snapshot the document");
13008
+ return;
13022
13009
  }
13023
13010
  wrappedEmit(
13024
13011
  {
@@ -13157,7 +13144,10 @@ function record(options = {}) {
13157
13144
  try {
13158
13145
  handlers.push(observe(iframeEl.contentDocument));
13159
13146
  } catch (error) {
13160
- console.warn(error);
13147
+ if (isDebug()) {
13148
+ console.warn("internal error");
13149
+ console.warn(error);
13150
+ }
13161
13151
  }
13162
13152
  });
13163
13153
  let initedAt = null;
@@ -13216,7 +13206,10 @@ function record(options = {}) {
13216
13206
  unregisterErrorHandler();
13217
13207
  };
13218
13208
  } catch (error) {
13219
- console.warn(error);
13209
+ if (isDebug()) {
13210
+ console.warn("internal error1");
13211
+ console.warn(error);
13212
+ }
13220
13213
  }
13221
13214
  }
13222
13215
  record.addCustomEvent = (tag, payload) => {