@sentry/replay 11.4.0 → 11.6.0
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/build/npm/cjs/index.js +46 -23
- package/build/npm/cjs/index.js.map +1 -1
- package/build/npm/esm/index.js +47 -24
- package/build/npm/esm/index.js.map +1 -1
- package/build/npm/esm/package.json +1 -1
- package/build/npm/types/util/createPerformanceEntries.d.ts +5 -0
- package/build/npm/types/util/createPerformanceEntries.d.ts.map +1 -1
- package/package.json +6 -6
package/build/npm/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GLOBAL_OBJ, normalize, isObjectLike, fill,
|
|
1
|
+
import { GLOBAL_OBJ, normalize, isObjectLike, fill, _INTERNAL_performanceTimeToSeconds, debug as debug$1, severityLevelFromString, captureException, addBreadcrumb, uuid4, getClient, getCurrentScope, getActiveSpan, getDynamicSamplingContextFromSpan, isSentryRequestUrl, stringMatchesSomePattern, addEventProcessor, debounce as debounce$1, createEnvelope, createEventEnvelopeHeaders, getSdkMetadataForEnvelopeHeader, prepareEvent, getIsolationScope, updateRateLimits, isRateLimited, setContext, getRootSpan, spanToJSON, isBrowser, safeSetSpanJSONAttributes, parseSampleRate, consoleSandbox } from '@sentry/core';
|
|
2
2
|
import { setTimeout as setTimeout$3, htmlTreeAsString, addPerformanceInstrumentationHandler, addLcpInstrumentationHandler, addClsInstrumentationHandler, addInpInstrumentationHandler, getLocationHref, serializeFormData, getFetchRequestArgBody, getBodyString, SENTRY_XHR_DATA_KEY, parseXhrResponseHeaders, addClickKeypressInstrumentationHandler, addHistoryInstrumentationHandler } from '@sentry/browser-utils';
|
|
3
3
|
|
|
4
4
|
const WINDOW = GLOBAL_OBJ;
|
|
@@ -21,7 +21,7 @@ const MIN_REPLAY_DURATION = 4999;
|
|
|
21
21
|
const MIN_REPLAY_DURATION_LIMIT = 5e4;
|
|
22
22
|
const MAX_REPLAY_DURATION = 36e5;
|
|
23
23
|
|
|
24
|
-
const
|
|
24
|
+
const jd="sentry.segment.name.source";
|
|
25
25
|
|
|
26
26
|
var __defProp = Object.defineProperty;
|
|
27
27
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -156,6 +156,9 @@ class Mirror {
|
|
|
156
156
|
(childNode) => this.removeNodeFromMap(childNode)
|
|
157
157
|
);
|
|
158
158
|
}
|
|
159
|
+
if (isElement$1(n) && n.shadowRoot) {
|
|
160
|
+
this.removeNodeFromMap(n.shadowRoot);
|
|
161
|
+
}
|
|
159
162
|
}
|
|
160
163
|
has(id) {
|
|
161
164
|
return this.idNodeMap.has(id);
|
|
@@ -272,8 +275,9 @@ function getImplementation$1(name) {
|
|
|
272
275
|
if (cached) {
|
|
273
276
|
return cached;
|
|
274
277
|
}
|
|
278
|
+
const windowImpl = window[name].bind(window);
|
|
279
|
+
let impl = windowImpl;
|
|
275
280
|
const document2 = window.document;
|
|
276
|
-
let impl = window[name];
|
|
277
281
|
if (document2 && typeof document2.createElement === "function") {
|
|
278
282
|
try {
|
|
279
283
|
const sandbox = document2.createElement("iframe");
|
|
@@ -281,16 +285,21 @@ function getImplementation$1(name) {
|
|
|
281
285
|
document2.head.appendChild(sandbox);
|
|
282
286
|
const contentWindow = sandbox.contentWindow;
|
|
283
287
|
if (contentWindow && contentWindow[name]) {
|
|
284
|
-
|
|
285
|
-
|
|
288
|
+
const sandboxImpl = contentWindow[name].bind(window);
|
|
289
|
+
impl = (...args) => {
|
|
290
|
+
try {
|
|
291
|
+
return sandboxImpl(...args);
|
|
292
|
+
} catch {
|
|
293
|
+
cachedImplementations$1[name] = windowImpl;
|
|
294
|
+
return windowImpl(...args);
|
|
295
|
+
}
|
|
296
|
+
};
|
|
286
297
|
}
|
|
287
298
|
document2.head.removeChild(sandbox);
|
|
288
299
|
} catch (e) {
|
|
289
300
|
}
|
|
290
301
|
}
|
|
291
|
-
return cachedImplementations$1[name] = impl
|
|
292
|
-
window
|
|
293
|
-
);
|
|
302
|
+
return cachedImplementations$1[name] = impl;
|
|
294
303
|
}
|
|
295
304
|
function setTimeout$1(...rest) {
|
|
296
305
|
return getImplementation$1("setTimeout")(...rest);
|
|
@@ -549,6 +558,9 @@ function elementClassMatchesRegex(el, regex) {
|
|
|
549
558
|
}
|
|
550
559
|
function distanceToMatch(node, matchPredicate, limit = Infinity, distance = 0) {
|
|
551
560
|
if (!node) return -1;
|
|
561
|
+
if (isShadowRoot(node)) {
|
|
562
|
+
return distanceToMatch(node.host, matchPredicate, limit, distance + 1);
|
|
563
|
+
}
|
|
552
564
|
if (node.nodeType !== node.ELEMENT_NODE) return -1;
|
|
553
565
|
if (distance > limit) return -1;
|
|
554
566
|
if (matchPredicate(node)) return distance;
|
|
@@ -1749,8 +1761,9 @@ function getImplementation(name) {
|
|
|
1749
1761
|
if (cached) {
|
|
1750
1762
|
return cached;
|
|
1751
1763
|
}
|
|
1764
|
+
const windowImpl = window[name].bind(window);
|
|
1765
|
+
let impl = windowImpl;
|
|
1752
1766
|
const document2 = window.document;
|
|
1753
|
-
let impl = window[name];
|
|
1754
1767
|
if (document2 && typeof document2.createElement === "function") {
|
|
1755
1768
|
try {
|
|
1756
1769
|
const sandbox = document2.createElement("iframe");
|
|
@@ -1758,16 +1771,21 @@ function getImplementation(name) {
|
|
|
1758
1771
|
document2.head.appendChild(sandbox);
|
|
1759
1772
|
const contentWindow = sandbox.contentWindow;
|
|
1760
1773
|
if (contentWindow && contentWindow[name]) {
|
|
1761
|
-
|
|
1762
|
-
|
|
1774
|
+
const sandboxImpl = contentWindow[name].bind(window);
|
|
1775
|
+
impl = (...args) => {
|
|
1776
|
+
try {
|
|
1777
|
+
return sandboxImpl(...args);
|
|
1778
|
+
} catch {
|
|
1779
|
+
cachedImplementations[name] = windowImpl;
|
|
1780
|
+
return windowImpl(...args);
|
|
1781
|
+
}
|
|
1782
|
+
};
|
|
1763
1783
|
}
|
|
1764
1784
|
document2.head.removeChild(sandbox);
|
|
1765
1785
|
} catch (e) {
|
|
1766
1786
|
}
|
|
1767
1787
|
}
|
|
1768
|
-
return cachedImplementations[name] = impl
|
|
1769
|
-
window
|
|
1770
|
-
);
|
|
1788
|
+
return cachedImplementations[name] = impl;
|
|
1771
1789
|
}
|
|
1772
1790
|
function onRequestAnimationFrame(...rest) {
|
|
1773
1791
|
return getImplementation("requestAnimationFrame")(...rest);
|
|
@@ -3904,10 +3922,14 @@ class ShadowDomManager {
|
|
|
3904
3922
|
const iframeDoc = getIFrameContentDocument(iframeElement);
|
|
3905
3923
|
const iframeWindow = getIFrameContentWindow(iframeElement);
|
|
3906
3924
|
if (!iframeDoc || !iframeWindow) return;
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
)
|
|
3925
|
+
let iframeElementConstructor;
|
|
3926
|
+
try {
|
|
3927
|
+
iframeElementConstructor = iframeWindow.Element;
|
|
3928
|
+
} catch (e2) {
|
|
3929
|
+
return;
|
|
3930
|
+
}
|
|
3931
|
+
if (!iframeElementConstructor) return;
|
|
3932
|
+
this.patchAttachShadow(iframeElementConstructor, iframeDoc);
|
|
3911
3933
|
}
|
|
3912
3934
|
/**
|
|
3913
3935
|
* Patch 'attachShadow' to observe newly added shadow doms.
|
|
@@ -5054,8 +5076,8 @@ function createPerformanceEntry(entry) {
|
|
|
5054
5076
|
}
|
|
5055
5077
|
return entryType(entry);
|
|
5056
5078
|
}
|
|
5057
|
-
function getAbsoluteTime(time) {
|
|
5058
|
-
return (
|
|
5079
|
+
function getAbsoluteTime(time, entryStartTime = time) {
|
|
5080
|
+
return _INTERNAL_performanceTimeToSeconds(time, entryStartTime);
|
|
5059
5081
|
}
|
|
5060
5082
|
function createPaintEntry(entry) {
|
|
5061
5083
|
const { duration, entryType, name, startTime } = entry;
|
|
@@ -5092,7 +5114,7 @@ function createNavigationEntry(entry) {
|
|
|
5092
5114
|
return {
|
|
5093
5115
|
type: `${entryType}.${type}`,
|
|
5094
5116
|
start: getAbsoluteTime(startTime),
|
|
5095
|
-
end: getAbsoluteTime(domComplete),
|
|
5117
|
+
end: getAbsoluteTime(domComplete, startTime),
|
|
5096
5118
|
name,
|
|
5097
5119
|
data: {
|
|
5098
5120
|
size: transferSize,
|
|
@@ -5127,7 +5149,7 @@ function createResourceEntry(entry) {
|
|
|
5127
5149
|
return {
|
|
5128
5150
|
type: `${entryType}.${initiatorType}`,
|
|
5129
5151
|
start: getAbsoluteTime(startTime),
|
|
5130
|
-
end: getAbsoluteTime(responseEnd),
|
|
5152
|
+
end: getAbsoluteTime(responseEnd, startTime),
|
|
5131
5153
|
name,
|
|
5132
5154
|
data: {
|
|
5133
5155
|
size: transferSize,
|
|
@@ -5173,7 +5195,8 @@ function getInteractionToNextPaint(metric) {
|
|
|
5173
5195
|
function getWebVital(metric, name, nodes, attributions) {
|
|
5174
5196
|
const value = metric.value;
|
|
5175
5197
|
const rating = metric.rating;
|
|
5176
|
-
const
|
|
5198
|
+
const lastEntry = metric.entries[metric.entries.length - 1];
|
|
5199
|
+
const end = getAbsoluteTime(lastEntry?.startTime ?? (metric.navigationStartTime ?? 0) + value);
|
|
5177
5200
|
return {
|
|
5178
5201
|
type: "web-vital",
|
|
5179
5202
|
name,
|
|
@@ -7711,7 +7734,7 @@ class ReplayContainer {
|
|
|
7711
7734
|
return void 0;
|
|
7712
7735
|
}
|
|
7713
7736
|
const spanJson = spanToJSON(lastRootSpan);
|
|
7714
|
-
const source = spanJson.attributes[
|
|
7737
|
+
const source = spanJson.attributes[jd];
|
|
7715
7738
|
if (!source || !["route", "custom"].includes(source)) {
|
|
7716
7739
|
return void 0;
|
|
7717
7740
|
}
|