@sentry-internal/browser-utils
Advanced tools
Comparing version
@@ -1,5 +0,1 @@ | ||
var { | ||
_optionalChain | ||
} = require('@sentry/core'); | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
@@ -63,6 +59,10 @@ | ||
const unsubscribeStartNavigation = _optionalChain([client, 'optionalAccess', _ => _.on, 'call', _2 => _2('startNavigationSpan', () => { | ||
if (!client) { | ||
return; | ||
} | ||
const unsubscribeStartNavigation = client.on('startNavigationSpan', () => { | ||
_collectClsOnce(); | ||
unsubscribeStartNavigation && unsubscribeStartNavigation(); | ||
})]); | ||
}); | ||
@@ -81,6 +81,6 @@ const activeSpan = core.getActiveSpan(); | ||
const startTime = utils.msToSec((core.browserPerformanceTimeOrigin || 0) + (_optionalChain([entry, 'optionalAccess', _3 => _3.startTime]) || 0)); | ||
const startTime = utils.msToSec((core.browserPerformanceTimeOrigin || 0) + ((entry && entry.startTime) || 0)); | ||
const routeName = core.getCurrentScope().getScopeData().transactionName; | ||
const name = entry ? core.htmlTreeAsString(_optionalChain([entry, 'access', _4 => _4.sources, 'access', _5 => _5[0], 'optionalAccess', _6 => _6.node])) : 'Layout shift'; | ||
const name = entry ? core.htmlTreeAsString(entry.sources[0] && entry.sources[0].node) : 'Layout shift'; | ||
@@ -90,3 +90,3 @@ const attributes = core.dropUndefinedKeys({ | ||
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.webvital.cls', | ||
[core.SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: _optionalChain([entry, 'optionalAccess', _7 => _7.duration]) || 0, | ||
[core.SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: (entry && entry.duration) || 0, | ||
// attach the pageload span id to the CLS span so that we can link them in the UI | ||
@@ -103,10 +103,12 @@ 'sentry.pageload.span_id': pageloadSpanId, | ||
_optionalChain([span, 'optionalAccess', _8 => _8.addEvent, 'call', _9 => _9('cls', { | ||
[core.SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: '', | ||
[core.SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: clsValue, | ||
})]); | ||
if (span) { | ||
span.addEvent('cls', { | ||
[core.SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: '', | ||
[core.SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: clsValue, | ||
}); | ||
// LayoutShift performance entries always have a duration of 0, so we don't need to add `entry.duration` here | ||
// see: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/duration | ||
_optionalChain([span, 'optionalAccess', _10 => _10.end, 'call', _11 => _11(startTime)]); | ||
// LayoutShift performance entries always have a duration of 0, so we don't need to add `entry.duration` here | ||
// see: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/duration | ||
span.end(startTime); | ||
} | ||
} | ||
@@ -116,3 +118,3 @@ | ||
try { | ||
return _optionalChain([PerformanceObserver, 'access', _12 => _12.supportedEntryTypes, 'optionalAccess', _13 => _13.includes, 'call', _14 => _14('layout-shift')]); | ||
return PerformanceObserver.supportedEntryTypes.includes('layout-shift'); | ||
} catch (e) { | ||
@@ -119,0 +121,0 @@ return false; |
@@ -1,5 +0,1 @@ | ||
var { | ||
_optionalChain | ||
} = require('@sentry/core'); | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
@@ -105,8 +101,10 @@ | ||
_optionalChain([span, 'optionalAccess', _ => _.addEvent, 'call', _2 => _2('inp', { | ||
[core.SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: 'millisecond', | ||
[core.SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: metric.value, | ||
})]); | ||
if (span) { | ||
span.addEvent('inp', { | ||
[core.SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: 'millisecond', | ||
[core.SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: metric.value, | ||
}); | ||
_optionalChain([span, 'optionalAccess', _3 => _3.end, 'call', _4 => _4(startTime + duration)]); | ||
span.end(startTime + duration); | ||
} | ||
}); | ||
@@ -113,0 +111,0 @@ } |
@@ -65,3 +65,2 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const existingInteraction = longestInteractionMap[entry.interactionId]; | ||
@@ -82,3 +81,2 @@ | ||
const interaction = { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
id: entry.interactionId, | ||
@@ -85,0 +83,0 @@ latency: entry.duration, |
@@ -1,2 +0,1 @@ | ||
import { _optionalChain } from '@sentry/core'; | ||
import { getClient, getActiveSpan, getRootSpan, spanToJSON, logger, browserPerformanceTimeOrigin, getCurrentScope, htmlTreeAsString, dropUndefinedKeys, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE } from '@sentry/core'; | ||
@@ -58,6 +57,10 @@ import { DEBUG_BUILD } from '../debug-build.js'; | ||
const unsubscribeStartNavigation = _optionalChain([client, 'optionalAccess', _ => _.on, 'call', _2 => _2('startNavigationSpan', () => { | ||
if (!client) { | ||
return; | ||
} | ||
const unsubscribeStartNavigation = client.on('startNavigationSpan', () => { | ||
_collectClsOnce(); | ||
unsubscribeStartNavigation && unsubscribeStartNavigation(); | ||
})]); | ||
}); | ||
@@ -76,6 +79,6 @@ const activeSpan = getActiveSpan(); | ||
const startTime = msToSec((browserPerformanceTimeOrigin || 0) + (_optionalChain([entry, 'optionalAccess', _3 => _3.startTime]) || 0)); | ||
const startTime = msToSec((browserPerformanceTimeOrigin || 0) + ((entry && entry.startTime) || 0)); | ||
const routeName = getCurrentScope().getScopeData().transactionName; | ||
const name = entry ? htmlTreeAsString(_optionalChain([entry, 'access', _4 => _4.sources, 'access', _5 => _5[0], 'optionalAccess', _6 => _6.node])) : 'Layout shift'; | ||
const name = entry ? htmlTreeAsString(entry.sources[0] && entry.sources[0].node) : 'Layout shift'; | ||
@@ -85,3 +88,3 @@ const attributes = dropUndefinedKeys({ | ||
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.webvital.cls', | ||
[SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: _optionalChain([entry, 'optionalAccess', _7 => _7.duration]) || 0, | ||
[SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: (entry && entry.duration) || 0, | ||
// attach the pageload span id to the CLS span so that we can link them in the UI | ||
@@ -98,10 +101,12 @@ 'sentry.pageload.span_id': pageloadSpanId, | ||
_optionalChain([span, 'optionalAccess', _8 => _8.addEvent, 'call', _9 => _9('cls', { | ||
[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: '', | ||
[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: clsValue, | ||
})]); | ||
if (span) { | ||
span.addEvent('cls', { | ||
[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: '', | ||
[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: clsValue, | ||
}); | ||
// LayoutShift performance entries always have a duration of 0, so we don't need to add `entry.duration` here | ||
// see: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/duration | ||
_optionalChain([span, 'optionalAccess', _10 => _10.end, 'call', _11 => _11(startTime)]); | ||
// LayoutShift performance entries always have a duration of 0, so we don't need to add `entry.duration` here | ||
// see: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/duration | ||
span.end(startTime); | ||
} | ||
} | ||
@@ -111,3 +116,3 @@ | ||
try { | ||
return _optionalChain([PerformanceObserver, 'access', _12 => _12.supportedEntryTypes, 'optionalAccess', _13 => _13.includes, 'call', _14 => _14('layout-shift')]); | ||
return PerformanceObserver.supportedEntryTypes.includes('layout-shift'); | ||
} catch (e) { | ||
@@ -114,0 +119,0 @@ return false; |
@@ -1,2 +0,1 @@ | ||
import { _optionalChain } from '@sentry/core'; | ||
import { browserPerformanceTimeOrigin, getActiveSpan, getRootSpan, spanToJSON, getCurrentScope, htmlTreeAsString, dropUndefinedKeys, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE } from '@sentry/core'; | ||
@@ -100,8 +99,10 @@ import { addInpInstrumentationHandler, addPerformanceInstrumentationHandler, isPerformanceEventTiming } from './instrument.js'; | ||
_optionalChain([span, 'optionalAccess', _ => _.addEvent, 'call', _2 => _2('inp', { | ||
[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: 'millisecond', | ||
[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: metric.value, | ||
})]); | ||
if (span) { | ||
span.addEvent('inp', { | ||
[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: 'millisecond', | ||
[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: metric.value, | ||
}); | ||
_optionalChain([span, 'optionalAccess', _3 => _3.end, 'call', _4 => _4(startTime + duration)]); | ||
span.end(startTime + duration); | ||
} | ||
}); | ||
@@ -108,0 +109,0 @@ } |
@@ -63,3 +63,2 @@ import { WINDOW } from '../../types.js'; | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const existingInteraction = longestInteractionMap[entry.interactionId]; | ||
@@ -80,3 +79,2 @@ | ||
const interaction = { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
id: entry.interactionId, | ||
@@ -83,0 +81,0 @@ latency: entry.duration, |
@@ -1,1 +0,1 @@ | ||
{"type":"module","version":"8.41.0-beta.0","sideEffects":false} | ||
{"type":"module","version":"8.41.0-beta.1","sideEffects":false} |
{ | ||
"name": "@sentry-internal/browser-utils", | ||
"version": "8.41.0-beta.0", | ||
"version": "8.41.0-beta.1", | ||
"description": "Browser Utilities for all Sentry JavaScript SDKs", | ||
@@ -42,4 +42,4 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/core": "8.41.0-beta.0", | ||
"@sentry/types": "8.41.0-beta.0" | ||
"@sentry/core": "8.41.0-beta.1", | ||
"@sentry/types": "8.41.0-beta.1" | ||
}, | ||
@@ -46,0 +46,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
7483
0.03%695961
-6.6%+ Added
+ Added
- Removed
- Removed
Updated
Updated