@sentry/browser 6.17.8-beta.0 → 6.18.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.
Files changed (45) hide show
  1. package/build/bundle.es6.js +266 -340
  2. package/build/bundle.es6.js.map +1 -1
  3. package/build/bundle.es6.min.js +2 -2
  4. package/build/bundle.es6.min.js.map +1 -1
  5. package/build/bundle.js +298 -356
  6. package/build/bundle.js.map +1 -1
  7. package/build/bundle.min.js +2 -2
  8. package/build/bundle.min.js.map +1 -1
  9. package/dist/eventbuilder.d.ts.map +1 -1
  10. package/dist/eventbuilder.js +7 -13
  11. package/dist/eventbuilder.js.map +1 -1
  12. package/dist/integrations/linkederrors.d.ts.map +1 -1
  13. package/dist/integrations/linkederrors.js +1 -3
  14. package/dist/integrations/linkederrors.js.map +1 -1
  15. package/dist/parsers.d.ts +7 -7
  16. package/dist/parsers.d.ts.map +1 -1
  17. package/dist/parsers.js +55 -42
  18. package/dist/parsers.js.map +1 -1
  19. package/dist/stack-parsers.d.ts +7 -0
  20. package/dist/stack-parsers.d.ts.map +1 -0
  21. package/dist/stack-parsers.js +117 -0
  22. package/dist/stack-parsers.js.map +1 -0
  23. package/esm/eventbuilder.d.ts.map +1 -1
  24. package/esm/eventbuilder.js +8 -14
  25. package/esm/eventbuilder.js.map +1 -1
  26. package/esm/integrations/linkederrors.d.ts.map +1 -1
  27. package/esm/integrations/linkederrors.js +2 -4
  28. package/esm/integrations/linkederrors.js.map +1 -1
  29. package/esm/parsers.d.ts +7 -7
  30. package/esm/parsers.d.ts.map +1 -1
  31. package/esm/parsers.js +53 -40
  32. package/esm/parsers.js.map +1 -1
  33. package/esm/stack-parsers.d.ts +7 -0
  34. package/esm/stack-parsers.d.ts.map +1 -0
  35. package/esm/stack-parsers.js +116 -0
  36. package/esm/stack-parsers.js.map +1 -0
  37. package/package.json +4 -7
  38. package/dist/tracekit.d.ts +0 -23
  39. package/dist/tracekit.d.ts.map +0 -1
  40. package/dist/tracekit.js +0 -184
  41. package/dist/tracekit.js.map +0 -1
  42. package/esm/tracekit.d.ts +0 -23
  43. package/esm/tracekit.d.ts.map +0 -1
  44. package/esm/tracekit.js +0 -182
  45. package/esm/tracekit.js.map +0 -1
@@ -1,8 +1,10 @@
1
- /*! @sentry/browser 6.17.8-beta.0 (07f9257) | https://github.com/getsentry/sentry-javascript */
1
+ /*! @sentry/browser 6.18.0 (70c1d77) | https://github.com/getsentry/sentry-javascript */
2
2
  var Sentry = (function (exports) {
3
+
3
4
  /**
4
5
  * TODO(v7): Remove this enum and replace with SeverityLevel
5
6
  */
7
+ exports.Severity = void 0;
6
8
  (function (Severity) {
7
9
  /** JSDoc */
8
10
  Severity["Fatal"] = "fatal";
@@ -49,41 +51,7 @@ var Sentry = (function (exports) {
49
51
  * @returns true if this is a debug build
50
52
  */
51
53
  function isDebugBuild() {
52
- return typeof __SENTRY_NO_DEBUG__ !== 'undefined' && !__SENTRY_BROWSER_BUNDLE__;
53
- }
54
- /**
55
- * Figures out if we're building a browser bundle.
56
- *
57
- * @returns true if this is a browser bundle build.
58
- */
59
- function isBrowserBundle() {
60
- return typeof __SENTRY_BROWSER_BUNDLE__ !== 'undefined' && !!__SENTRY_BROWSER_BUNDLE__;
61
- }
62
-
63
- /**
64
- * NOTE: In order to avoid circular dependencies, if you add a function to this module and it needs to print something,
65
- * you must either a) use `console.log` rather than the logger, or b) put your function elsewhere.
66
- */
67
- /**
68
- * Checks whether we're in the Node.js or Browser environment
69
- *
70
- * @returns Answer to given question
71
- */
72
- function isNodeEnv() {
73
- // explicitly check for browser bundles as those can be optimized statically
74
- // by terser/rollup.
75
- return (!isBrowserBundle() &&
76
- Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]');
77
- }
78
- /**
79
- * Requires a module which is protected against bundler minification.
80
- *
81
- * @param request The module path to resolve
82
- */
83
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
84
- function dynamicRequire(mod, request) {
85
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
86
- return mod.require(request);
54
+ return typeof __SENTRY_NO_DEBUG__ !== 'undefined' && !true;
87
55
  }
88
56
 
89
57
  /**
@@ -97,9 +65,7 @@ var Sentry = (function (exports) {
97
65
  * @returns Global scope object
98
66
  */
99
67
  function getGlobalObject() {
100
- return (isNodeEnv()
101
- ? global
102
- : typeof window !== 'undefined' // eslint-disable-line no-restricted-globals
68
+ return (typeof window !== 'undefined' // eslint-disable-line no-restricted-globals
103
69
  ? window // eslint-disable-line no-restricted-globals
104
70
  : typeof self !== 'undefined'
105
71
  ? self
@@ -480,7 +446,7 @@ var Sentry = (function (exports) {
480
446
  const SeverityLevels = ['fatal', 'error', 'warning', 'log', 'info', 'debug', 'critical'];
481
447
 
482
448
  // TODO: Implement different loggers for different environments
483
- const global$1 = getGlobalObject();
449
+ const global$6 = getGlobalObject();
484
450
  /** Prefix for logging strings */
485
451
  const PREFIX = 'Sentry Logger ';
486
452
  /**
@@ -535,7 +501,7 @@ var Sentry = (function (exports) {
535
501
  return;
536
502
  }
537
503
  consoleSandbox(() => {
538
- global$1.console.log(`${PREFIX}[Log]: ${args.join(' ')}`);
504
+ global$6.console.log(`${PREFIX}[Log]: ${args.join(' ')}`);
539
505
  });
540
506
  }
541
507
  /** JSDoc */
@@ -544,7 +510,7 @@ var Sentry = (function (exports) {
544
510
  return;
545
511
  }
546
512
  consoleSandbox(() => {
547
- global$1.console.warn(`${PREFIX}[Warn]: ${args.join(' ')}`);
513
+ global$6.console.warn(`${PREFIX}[Warn]: ${args.join(' ')}`);
548
514
  });
549
515
  }
550
516
  /** JSDoc */
@@ -553,13 +519,13 @@ var Sentry = (function (exports) {
553
519
  return;
554
520
  }
555
521
  consoleSandbox(() => {
556
- global$1.console.error(`${PREFIX}[Error]: ${args.join(' ')}`);
522
+ global$6.console.error(`${PREFIX}[Error]: ${args.join(' ')}`);
557
523
  });
558
524
  }
559
525
  }
560
526
  // Ensure we only have a single logger instance, even if multiple versions of @sentry/utils are being used
561
- global$1.__SENTRY__ = global$1.__SENTRY__ || {};
562
- const logger = global$1.__SENTRY__.logger || (global$1.__SENTRY__.logger = new Logger());
527
+ global$6.__SENTRY__ = global$6.__SENTRY__ || {};
528
+ const logger = global$6.__SENTRY__.logger || (global$6.__SENTRY__.logger = new Logger());
563
529
 
564
530
  /* eslint-disable @typescript-eslint/no-unsafe-member-access */
565
531
  /* eslint-disable @typescript-eslint/no-explicit-any */
@@ -603,6 +569,53 @@ var Sentry = (function (exports) {
603
569
  return [memoize, unmemoize];
604
570
  }
605
571
 
572
+ const STACKTRACE_LIMIT = 50;
573
+ /**
574
+ * Creates a stack parser with the supplied line parsers
575
+ *
576
+ * StackFrames are returned in the correct order for Sentry Exception
577
+ * frames and with Sentry SDK internal frames removed from the top and bottom
578
+ *
579
+ * */
580
+ function createStackParser(...parsers) {
581
+ return (stack, skipFirst = 0) => {
582
+ const frames = [];
583
+ for (const line of stack.split('\n').slice(skipFirst)) {
584
+ for (const parser of parsers) {
585
+ const frame = parser(line);
586
+ if (frame) {
587
+ frames.push(frame);
588
+ break;
589
+ }
590
+ }
591
+ }
592
+ return stripSentryFramesAndReverse(frames);
593
+ };
594
+ }
595
+ /**
596
+ * @hidden
597
+ */
598
+ function stripSentryFramesAndReverse(stack) {
599
+ if (!stack.length) {
600
+ return [];
601
+ }
602
+ let localStack = stack;
603
+ const firstFrameFunction = localStack[0].function || '';
604
+ const lastFrameFunction = localStack[localStack.length - 1].function || '';
605
+ // If stack starts with one of our API calls, remove it (starts, meaning it's the top of the stack - aka last call)
606
+ if (firstFrameFunction.indexOf('captureMessage') !== -1 || firstFrameFunction.indexOf('captureException') !== -1) {
607
+ localStack = localStack.slice(1);
608
+ }
609
+ // If stack ends with one of our internal API calls, remove it (ends, meaning it's the bottom of the stack - aka top-most call)
610
+ if (lastFrameFunction.indexOf('sentryWrapped') !== -1) {
611
+ localStack = localStack.slice(0, -1);
612
+ }
613
+ // The frame where the crash happened, should be the last entry in the array
614
+ return localStack
615
+ .slice(0, STACKTRACE_LIMIT)
616
+ .map(frame => (Object.assign(Object.assign({}, frame), { filename: frame.filename || localStack[0].filename, function: frame.function || '?' })))
617
+ .reverse();
618
+ }
606
619
  const defaultFunctionName = '<anonymous>';
607
620
  /**
608
621
  * Safely extract function name from itself
@@ -1134,7 +1147,7 @@ var Sentry = (function (exports) {
1134
1147
  return !isChromePackagedApp && hasHistoryApi;
1135
1148
  }
1136
1149
 
1137
- const global$2 = getGlobalObject();
1150
+ const global$5 = getGlobalObject();
1138
1151
  /**
1139
1152
  * Instrument native APIs to call handlers that can be used to create breadcrumbs, APM spans etc.
1140
1153
  * - Console API
@@ -1207,19 +1220,19 @@ var Sentry = (function (exports) {
1207
1220
  }
1208
1221
  /** JSDoc */
1209
1222
  function instrumentConsole() {
1210
- if (!('console' in global$2)) {
1223
+ if (!('console' in global$5)) {
1211
1224
  return;
1212
1225
  }
1213
1226
  ['debug', 'info', 'warn', 'error', 'log', 'assert'].forEach(function (level) {
1214
- if (!(level in global$2.console)) {
1227
+ if (!(level in global$5.console)) {
1215
1228
  return;
1216
1229
  }
1217
- fill(global$2.console, level, function (originalConsoleMethod) {
1230
+ fill(global$5.console, level, function (originalConsoleMethod) {
1218
1231
  return function (...args) {
1219
1232
  triggerHandlers('console', { args, level });
1220
1233
  // this fails for some browsers. :(
1221
1234
  if (originalConsoleMethod) {
1222
- originalConsoleMethod.call(global$2.console, args);
1235
+ originalConsoleMethod.apply(global$5.console, args);
1223
1236
  }
1224
1237
  };
1225
1238
  });
@@ -1230,7 +1243,7 @@ var Sentry = (function (exports) {
1230
1243
  if (!supportsNativeFetch()) {
1231
1244
  return;
1232
1245
  }
1233
- fill(global$2, 'fetch', function (originalFetch) {
1246
+ fill(global$5, 'fetch', function (originalFetch) {
1234
1247
  return function (...args) {
1235
1248
  const handlerData = {
1236
1249
  args,
@@ -1242,7 +1255,7 @@ var Sentry = (function (exports) {
1242
1255
  };
1243
1256
  triggerHandlers('fetch', Object.assign({}, handlerData));
1244
1257
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1245
- return originalFetch.apply(global$2, args).then((response) => {
1258
+ return originalFetch.apply(global$5, args).then((response) => {
1246
1259
  triggerHandlers('fetch', Object.assign(Object.assign({}, handlerData), { endTimestamp: Date.now(), response }));
1247
1260
  return response;
1248
1261
  }, (error) => {
@@ -1258,7 +1271,7 @@ var Sentry = (function (exports) {
1258
1271
  /* eslint-disable @typescript-eslint/no-unsafe-member-access */
1259
1272
  /** Extract `method` from fetch call arguments */
1260
1273
  function getFetchMethod(fetchArgs = []) {
1261
- if ('Request' in global$2 && isInstanceOf(fetchArgs[0], Request) && fetchArgs[0].method) {
1274
+ if ('Request' in global$5 && isInstanceOf(fetchArgs[0], Request) && fetchArgs[0].method) {
1262
1275
  return String(fetchArgs[0].method).toUpperCase();
1263
1276
  }
1264
1277
  if (fetchArgs[1] && fetchArgs[1].method) {
@@ -1271,7 +1284,7 @@ var Sentry = (function (exports) {
1271
1284
  if (typeof fetchArgs[0] === 'string') {
1272
1285
  return fetchArgs[0];
1273
1286
  }
1274
- if ('Request' in global$2 && isInstanceOf(fetchArgs[0], Request)) {
1287
+ if ('Request' in global$5 && isInstanceOf(fetchArgs[0], Request)) {
1275
1288
  return fetchArgs[0].url;
1276
1289
  }
1277
1290
  return String(fetchArgs[0]);
@@ -1279,7 +1292,7 @@ var Sentry = (function (exports) {
1279
1292
  /* eslint-enable @typescript-eslint/no-unsafe-member-access */
1280
1293
  /** JSDoc */
1281
1294
  function instrumentXHR() {
1282
- if (!('XMLHttpRequest' in global$2)) {
1295
+ if (!('XMLHttpRequest' in global$5)) {
1283
1296
  return;
1284
1297
  }
1285
1298
  const xhrproto = XMLHttpRequest.prototype;
@@ -1350,9 +1363,9 @@ var Sentry = (function (exports) {
1350
1363
  if (!supportsHistory()) {
1351
1364
  return;
1352
1365
  }
1353
- const oldOnPopState = global$2.onpopstate;
1354
- global$2.onpopstate = function (...args) {
1355
- const to = global$2.location.href;
1366
+ const oldOnPopState = global$5.onpopstate;
1367
+ global$5.onpopstate = function (...args) {
1368
+ const to = global$5.location.href;
1356
1369
  // keep track of the current URL state, as we always receive only the updated state
1357
1370
  const from = lastHref;
1358
1371
  lastHref = to;
@@ -1390,8 +1403,8 @@ var Sentry = (function (exports) {
1390
1403
  return originalHistoryFunction.apply(this, args);
1391
1404
  };
1392
1405
  }
1393
- fill(global$2.history, 'pushState', historyReplacementFunction);
1394
- fill(global$2.history, 'replaceState', historyReplacementFunction);
1406
+ fill(global$5.history, 'pushState', historyReplacementFunction);
1407
+ fill(global$5.history, 'replaceState', historyReplacementFunction);
1395
1408
  }
1396
1409
  const debounceDuration = 1000;
1397
1410
  let debounceTimerID;
@@ -1493,14 +1506,14 @@ var Sentry = (function (exports) {
1493
1506
  }
1494
1507
  // Start a new debounce timer that will prevent us from capturing multiple events that should be grouped together.
1495
1508
  clearTimeout(debounceTimerID);
1496
- debounceTimerID = global$2.setTimeout(() => {
1509
+ debounceTimerID = global$5.setTimeout(() => {
1497
1510
  debounceTimerID = undefined;
1498
1511
  }, debounceDuration);
1499
1512
  };
1500
1513
  }
1501
1514
  /** JSDoc */
1502
1515
  function instrumentDOM() {
1503
- if (!('document' in global$2)) {
1516
+ if (!('document' in global$5)) {
1504
1517
  return;
1505
1518
  }
1506
1519
  // Make it so that any click or keypress that is unhandled / bubbled up all the way to the document triggers our dom
@@ -1508,8 +1521,8 @@ var Sentry = (function (exports) {
1508
1521
  // we instrument `addEventListener` so that we don't end up attaching this handler twice.
1509
1522
  const triggerDOMHandler = triggerHandlers.bind(null, 'dom');
1510
1523
  const globalDOMEventHandler = makeDOMEventHandler(triggerDOMHandler, true);
1511
- global$2.document.addEventListener('click', globalDOMEventHandler, false);
1512
- global$2.document.addEventListener('keypress', globalDOMEventHandler, false);
1524
+ global$5.document.addEventListener('click', globalDOMEventHandler, false);
1525
+ global$5.document.addEventListener('keypress', globalDOMEventHandler, false);
1513
1526
  // After hooking into click and keypress events bubbled up to `document`, we also hook into user-handled
1514
1527
  // clicks & keypresses, by adding an event listener of our own to any element to which they add a listener. That
1515
1528
  // way, whenever one of their handlers is triggered, ours will be, too. (This is needed because their handler
@@ -1517,7 +1530,7 @@ var Sentry = (function (exports) {
1517
1530
  // guaranteed to fire at least once.)
1518
1531
  ['EventTarget', 'Node'].forEach((target) => {
1519
1532
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1520
- const proto = global$2[target] && global$2[target].prototype;
1533
+ const proto = global$5[target] && global$5[target].prototype;
1521
1534
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, no-prototype-builtins
1522
1535
  if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty('addEventListener')) {
1523
1536
  return;
@@ -1578,8 +1591,8 @@ var Sentry = (function (exports) {
1578
1591
  let _oldOnErrorHandler = null;
1579
1592
  /** JSDoc */
1580
1593
  function instrumentError() {
1581
- _oldOnErrorHandler = global$2.onerror;
1582
- global$2.onerror = function (msg, url, line, column, error) {
1594
+ _oldOnErrorHandler = global$5.onerror;
1595
+ global$5.onerror = function (msg, url, line, column, error) {
1583
1596
  triggerHandlers('error', {
1584
1597
  column,
1585
1598
  error,
@@ -1597,8 +1610,8 @@ var Sentry = (function (exports) {
1597
1610
  let _oldOnUnhandledRejectionHandler = null;
1598
1611
  /** JSDoc */
1599
1612
  function instrumentUnhandledRejection() {
1600
- _oldOnUnhandledRejectionHandler = global$2.onunhandledrejection;
1601
- global$2.onunhandledrejection = function (e) {
1613
+ _oldOnUnhandledRejectionHandler = global$5.onunhandledrejection;
1614
+ global$5.onunhandledrejection = function (e) {
1602
1615
  triggerHandlers('unhandledrejection', e);
1603
1616
  if (_oldOnUnhandledRejectionHandler) {
1604
1617
  // eslint-disable-next-line prefer-rest-params
@@ -2109,23 +2122,10 @@ var Sentry = (function (exports) {
2109
2122
  timeOrigin,
2110
2123
  };
2111
2124
  }
2112
- /**
2113
- * Returns the native Performance API implementation from Node.js. Returns undefined in old Node.js versions that don't
2114
- * implement the API.
2115
- */
2116
- function getNodePerformance() {
2117
- try {
2118
- const perfHooks = dynamicRequire(module, 'perf_hooks');
2119
- return perfHooks.performance;
2120
- }
2121
- catch (_) {
2122
- return undefined;
2123
- }
2124
- }
2125
2125
  /**
2126
2126
  * The Performance API implementation for the current platform, if available.
2127
2127
  */
2128
- const platformPerformance = isNodeEnv() ? getNodePerformance() : getBrowserPerformance();
2128
+ const platformPerformance = getBrowserPerformance();
2129
2129
  const timestampSource = platformPerformance === undefined
2130
2130
  ? dateTimestampSource
2131
2131
  : {
@@ -2151,7 +2151,7 @@ var Sentry = (function (exports) {
2151
2151
  * The number of milliseconds since the UNIX epoch. This value is only usable in a browser, and only when the
2152
2152
  * performance API is available.
2153
2153
  */
2154
- const browserPerformanceTimeOrigin = (() => {
2154
+ (() => {
2155
2155
  // Unfortunately browsers may report an inaccurate time origin data, through either performance.timeOrigin or
2156
2156
  // performance.timing.navigationStart, which results in poor results in performance data. We only treat time origin
2157
2157
  // data as reliable if they are within a reasonable threshold of the current time.
@@ -2842,7 +2842,7 @@ var Sentry = (function (exports) {
2842
2842
  */
2843
2843
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
2844
2844
  captureException(exception, hint) {
2845
- const eventId = (this._lastEventId = uuid4());
2845
+ const eventId = (this._lastEventId = hint && hint.event_id ? hint.event_id : uuid4());
2846
2846
  let finalHint = hint;
2847
2847
  // If there's no explicit hint provided, mimic the same thing that would happen
2848
2848
  // in the minimal itself to create a consistent behavior.
@@ -2868,7 +2868,7 @@ var Sentry = (function (exports) {
2868
2868
  * @inheritDoc
2869
2869
  */
2870
2870
  captureMessage(message, level, hint) {
2871
- const eventId = (this._lastEventId = uuid4());
2871
+ const eventId = (this._lastEventId = hint && hint.event_id ? hint.event_id : uuid4());
2872
2872
  let finalHint = hint;
2873
2873
  // If there's no explicit hint provided, mimic the same thing that would happen
2874
2874
  // in the minimal itself to create a consistent behavior.
@@ -2894,7 +2894,7 @@ var Sentry = (function (exports) {
2894
2894
  * @inheritDoc
2895
2895
  */
2896
2896
  captureEvent(event, hint) {
2897
- const eventId = uuid4();
2897
+ const eventId = hint && hint.event_id ? hint.event_id : uuid4();
2898
2898
  if (event.type !== 'transaction') {
2899
2899
  this._lastEventId = eventId;
2900
2900
  }
@@ -3162,38 +3162,9 @@ var Sentry = (function (exports) {
3162
3162
  if (!hasHubOnCarrier(registry) || getHubFromCarrier(registry).isOlderThan(API_VERSION)) {
3163
3163
  setHubOnCarrier(registry, new Hub());
3164
3164
  }
3165
- // Prefer domains over global if they are there (applicable only to Node environment)
3166
- if (isNodeEnv()) {
3167
- return getHubFromActiveDomain(registry);
3168
- }
3169
3165
  // Return hub that lives on a global object
3170
3166
  return getHubFromCarrier(registry);
3171
3167
  }
3172
- /**
3173
- * Try to read the hub from an active domain, and fallback to the registry if one doesn't exist
3174
- * @returns discovered hub
3175
- */
3176
- function getHubFromActiveDomain(registry) {
3177
- try {
3178
- const sentry = getMainCarrier().__SENTRY__;
3179
- const activeDomain = sentry && sentry.extensions && sentry.extensions.domain && sentry.extensions.domain.active;
3180
- // If there's no active domain, just return global hub
3181
- if (!activeDomain) {
3182
- return getHubFromCarrier(registry);
3183
- }
3184
- // If there's no hub on current domain, or it's an old API, assign a new one
3185
- if (!hasHubOnCarrier(activeDomain) || getHubFromCarrier(activeDomain).isOlderThan(API_VERSION)) {
3186
- const registryHubTopStack = getHubFromCarrier(registry).getStackTop();
3187
- setHubOnCarrier(activeDomain, new Hub(registryHubTopStack.client, Scope.clone(registryHubTopStack.scope)));
3188
- }
3189
- // Return hub that lives on a domain
3190
- return getHubFromCarrier(activeDomain);
3191
- }
3192
- catch (_Oo) {
3193
- // Return hub that lives on a global object
3194
- return getHubFromCarrier(registry);
3195
- }
3196
- }
3197
3168
  /**
3198
3169
  * This will tell whether a carrier has a hub on it or not
3199
3170
  * @param carrier object
@@ -3822,6 +3793,11 @@ var Sentry = (function (exports) {
3822
3793
  result = finalScope.applyToEvent(prepared, hint);
3823
3794
  }
3824
3795
  return result.then(evt => {
3796
+ if (evt) {
3797
+ // TODO this is more of the hack trying to solve https://github.com/getsentry/sentry-javascript/issues/2809
3798
+ // it is only attached as extra data to the event if the event somehow skips being normalized
3799
+ evt.sdkProcessingMetadata = Object.assign(Object.assign({}, evt.sdkProcessingMetadata), { normalizeDepth: normalize(normalizeDepth) });
3800
+ }
3825
3801
  if (typeof normalizeDepth === 'number' && normalizeDepth > 0) {
3826
3802
  return this._normalizeEvent(evt, normalizeDepth);
3827
3803
  }
@@ -4166,22 +4142,27 @@ var Sentry = (function (exports) {
4166
4142
  const { transactionSampling } = event.sdkProcessingMetadata || {};
4167
4143
  const { method: samplingMethod, rate: sampleRate } = transactionSampling || {};
4168
4144
  // TODO: Below is a temporary hack in order to debug a serialization error - see
4169
- // https://github.com/getsentry/sentry-javascript/issues/2809 and
4170
- // https://github.com/getsentry/sentry-javascript/pull/4425. TL;DR: even though we normalize all events (which should
4171
- // prevent this), something is causing `JSON.stringify` to throw a circular reference error.
4145
+ // https://github.com/getsentry/sentry-javascript/issues/2809,
4146
+ // https://github.com/getsentry/sentry-javascript/pull/4425, and
4147
+ // https://github.com/getsentry/sentry-javascript/pull/4574.
4148
+ //
4149
+ // TL; DR: even though we normalize all events (which should prevent this), something is causing `JSON.stringify` to
4150
+ // throw a circular reference error.
4172
4151
  //
4173
4152
  // When it's time to remove it:
4174
4153
  // 1. Delete everything between here and where the request object `req` is created, EXCEPT the line deleting
4175
4154
  // `sdkProcessingMetadata`
4176
4155
  // 2. Restore the original version of the request body, which is commented out
4177
- // 3. Search for `skippedNormalization` and pull out the companion hack in the browser playwright tests
4156
+ // 3. Search for either of the PR URLs above and pull out the companion hacks in the browser playwright tests and the
4157
+ // baseClient tests in this package
4178
4158
  enhanceEventWithSdkInfo(event, api.metadata.sdk);
4179
4159
  event.tags = event.tags || {};
4180
4160
  event.extra = event.extra || {};
4181
4161
  // In theory, all events should be marked as having gone through normalization and so
4182
- // we should never set this tag
4162
+ // we should never set this tag/extra data
4183
4163
  if (!(event.sdkProcessingMetadata && event.sdkProcessingMetadata.baseClientNormalized)) {
4184
4164
  event.tags.skippedNormalization = true;
4165
+ event.extra.normalizeDepth = event.sdkProcessingMetadata ? event.sdkProcessingMetadata.normalizeDepth : 'unset';
4185
4166
  }
4186
4167
  // prevent this data from being sent to sentry
4187
4168
  // TODO: This is NOT part of the hack - DO NOT DELETE
@@ -4263,7 +4244,7 @@ var Sentry = (function (exports) {
4263
4244
  hub.bindClient(client);
4264
4245
  }
4265
4246
 
4266
- const SDK_VERSION = '6.17.8-beta.0';
4247
+ const SDK_VERSION = '6.18.0';
4267
4248
 
4268
4249
  let originalFunctionToString;
4269
4250
  /** Patch toString calls to return proper name for wrapped functions */
@@ -4486,8 +4467,6 @@ var Sentry = (function (exports) {
4486
4467
  */
4487
4468
  InboundFilters.id = 'InboundFilters';
4488
4469
 
4489
-
4490
-
4491
4470
  var CoreIntegrations = /*#__PURE__*/Object.freeze({
4492
4471
  __proto__: null,
4493
4472
  FunctionToString: FunctionToString,
@@ -4496,127 +4475,87 @@ var Sentry = (function (exports) {
4496
4475
 
4497
4476
  // global reference to slice
4498
4477
  const UNKNOWN_FUNCTION = '?';
4499
- // Chromium based browsers: Chrome, Brave, new Opera, new Edge
4500
- const chrome = /^\s*at (?:(.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
4501
- // gecko regex: `(?:bundle|\d+\.js)`: `bundle` is for react native, `\d+\.js` also but specifically for ram bundles because it
4502
- // generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js
4503
- // We need this specific case for now because we want no other regex to match.
4504
- const gecko = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|capacitor).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
4505
- const winjs = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
4506
- const geckoEval = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
4507
- const chromeEval = /\((\S*)(?::(\d+))(?::(\d+))\)/;
4508
- // Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108
4509
- const reactMinifiedRegexp = /Minified React error #\d+;/i;
4510
- const opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
4511
- const opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i;
4512
- /** JSDoc */
4513
- function computeStackTrace(ex) {
4514
- let frames = [];
4515
- let popSize = 0;
4516
- if (ex) {
4517
- if (typeof ex.framesToPop === 'number') {
4518
- popSize = ex.framesToPop;
4519
- }
4520
- else if (reactMinifiedRegexp.test(ex.message)) {
4521
- popSize = 1;
4522
- }
4523
- }
4524
- try {
4525
- // Access and store the stacktrace property before doing ANYTHING
4526
- // else to it because Opera is not very good at providing it
4527
- // reliably in other circumstances.
4528
- const stacktrace = ex.stacktrace || ex.stack || '';
4529
- frames = parseFrames(stacktrace);
4530
- }
4531
- catch (e) {
4532
- // no-empty
4478
+ function createFrame(filename, func, lineno, colno) {
4479
+ const frame = {
4480
+ filename,
4481
+ function: func,
4482
+ // All browser frames are considered in_app
4483
+ in_app: true,
4484
+ };
4485
+ if (lineno !== undefined) {
4486
+ frame.lineno = lineno;
4533
4487
  }
4534
- if (frames.length && popSize > 0) {
4535
- frames = frames.slice(popSize);
4488
+ if (colno !== undefined) {
4489
+ frame.colno = colno;
4536
4490
  }
4537
- return {
4538
- message: extractMessage(ex),
4539
- name: ex && ex.name,
4540
- stack: frames,
4541
- };
4491
+ return frame;
4542
4492
  }
4543
- /** JSDoc */
4544
- // eslint-disable-next-line complexity
4545
- function parseFrames(stackString) {
4546
- const frames = [];
4547
- const lines = stackString.split('\n');
4548
- let isEval;
4549
- let submatch;
4550
- let parts;
4551
- let element;
4552
- for (const line of lines) {
4553
- if ((parts = opera10Regex.exec(line))) {
4554
- element = {
4555
- filename: parts[2],
4556
- function: parts[3] || UNKNOWN_FUNCTION,
4557
- lineno: +parts[1],
4558
- };
4559
- }
4560
- else if ((parts = opera11Regex.exec(line))) {
4561
- element = {
4562
- filename: parts[5],
4563
- function: parts[3] || parts[4] || UNKNOWN_FUNCTION,
4564
- lineno: +parts[1],
4565
- colno: +parts[2],
4566
- };
4567
- }
4568
- else if ((parts = chrome.exec(line))) {
4569
- isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line
4570
- if (isEval && (submatch = chromeEval.exec(parts[2]))) {
4493
+ // Chromium based browsers: Chrome, Brave, new Opera, new Edge
4494
+ const chromeRegex = /^\s*at (?:(.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
4495
+ const chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/;
4496
+ const chrome = line => {
4497
+ const parts = chromeRegex.exec(line);
4498
+ if (parts) {
4499
+ const isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line
4500
+ if (isEval) {
4501
+ const subMatch = chromeEvalRegex.exec(parts[2]);
4502
+ if (subMatch) {
4571
4503
  // throw out eval line/column and use top-most line/column number
4572
- parts[2] = submatch[1]; // url
4573
- parts[3] = submatch[2]; // line
4574
- parts[4] = submatch[3]; // column
4504
+ parts[2] = subMatch[1]; // url
4505
+ parts[3] = subMatch[2]; // line
4506
+ parts[4] = subMatch[3]; // column
4575
4507
  }
4576
- // Kamil: One more hack won't hurt us right? Understanding and adding more rules on top of these regexps right now
4577
- // would be way too time consuming. (TODO: Rewrite whole RegExp to be more readable)
4578
- const [func, filename] = extractSafariExtensionDetails(parts[1] || UNKNOWN_FUNCTION, parts[2]);
4579
- element = {
4580
- filename,
4581
- function: func,
4582
- lineno: parts[3] ? +parts[3] : undefined,
4583
- colno: parts[4] ? +parts[4] : undefined,
4584
- };
4585
4508
  }
4586
- else if ((parts = winjs.exec(line))) {
4587
- element = {
4588
- filename: parts[2],
4589
- function: parts[1] || UNKNOWN_FUNCTION,
4590
- lineno: +parts[3],
4591
- colno: parts[4] ? +parts[4] : undefined,
4592
- };
4593
- }
4594
- else if ((parts = gecko.exec(line))) {
4595
- isEval = parts[3] && parts[3].indexOf(' > eval') > -1;
4596
- if (isEval && (submatch = geckoEval.exec(parts[3]))) {
4509
+ // Kamil: One more hack won't hurt us right? Understanding and adding more rules on top of these regexps right now
4510
+ // would be way too time consuming. (TODO: Rewrite whole RegExp to be more readable)
4511
+ const [func, filename] = extractSafariExtensionDetails(parts[1] || UNKNOWN_FUNCTION, parts[2]);
4512
+ return createFrame(filename, func, parts[3] ? +parts[3] : undefined, parts[4] ? +parts[4] : undefined);
4513
+ }
4514
+ return;
4515
+ };
4516
+ // gecko regex: `(?:bundle|\d+\.js)`: `bundle` is for react native, `\d+\.js` also but specifically for ram bundles because it
4517
+ // generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js
4518
+ // We need this specific case for now because we want no other regex to match.
4519
+ const geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|capacitor).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
4520
+ const geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
4521
+ const gecko = line => {
4522
+ const parts = geckoREgex.exec(line);
4523
+ if (parts) {
4524
+ const isEval = parts[3] && parts[3].indexOf(' > eval') > -1;
4525
+ if (isEval) {
4526
+ const subMatch = geckoEvalRegex.exec(parts[3]);
4527
+ if (subMatch) {
4597
4528
  // throw out eval line/column and use top-most line number
4598
4529
  parts[1] = parts[1] || `eval`;
4599
- parts[3] = submatch[1];
4600
- parts[4] = submatch[2];
4530
+ parts[3] = subMatch[1];
4531
+ parts[4] = subMatch[2];
4601
4532
  parts[5] = ''; // no column when eval
4602
4533
  }
4603
- let filename = parts[3];
4604
- let func = parts[1] || UNKNOWN_FUNCTION;
4605
- [func, filename] = extractSafariExtensionDetails(func, filename);
4606
- element = {
4607
- filename,
4608
- function: func,
4609
- lineno: parts[4] ? +parts[4] : undefined,
4610
- colno: parts[5] ? +parts[5] : undefined,
4611
- };
4612
4534
  }
4613
- else {
4614
- continue;
4615
- }
4616
- frames.push(element);
4535
+ let filename = parts[3];
4536
+ let func = parts[1] || UNKNOWN_FUNCTION;
4537
+ [func, filename] = extractSafariExtensionDetails(func, filename);
4538
+ return createFrame(filename, func, parts[4] ? +parts[4] : undefined, parts[5] ? +parts[5] : undefined);
4617
4539
  }
4618
- return frames;
4619
- }
4540
+ return;
4541
+ };
4542
+ const winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
4543
+ const winjs = line => {
4544
+ const parts = winjsRegex.exec(line);
4545
+ return parts
4546
+ ? createFrame(parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined)
4547
+ : undefined;
4548
+ };
4549
+ const opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
4550
+ const opera10 = line => {
4551
+ const parts = opera10Regex.exec(line);
4552
+ return parts ? createFrame(parts[2], parts[3] || UNKNOWN_FUNCTION, +parts[1]) : undefined;
4553
+ };
4554
+ const opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i;
4555
+ const opera11 = line => {
4556
+ const parts = opera11Regex.exec(line);
4557
+ return parts ? createFrame(parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : undefined;
4558
+ };
4620
4559
  /**
4621
4560
  * Safari web extensions, starting version unknown, can produce "frames-only" stacktraces.
4622
4561
  * What it means, is that instead of format like:
@@ -4634,7 +4573,7 @@ var Sentry = (function (exports) {
4634
4573
  *
4635
4574
  * Because of that, it won't be captured by `chrome` RegExp and will fall into `Gecko` branch.
4636
4575
  * This function is extracted so that we can use it in both places without duplicating the logic.
4637
- * Unfortunatelly "just" changing RegExp is too complicated now and making it pass all tests
4576
+ * Unfortunately "just" changing RegExp is too complicated now and making it pass all tests
4638
4577
  * and fix this case seems like an impossible, or at least way too time-consuming task.
4639
4578
  */
4640
4579
  const extractSafariExtensionDetails = (func, filename) => {
@@ -4646,35 +4585,19 @@ var Sentry = (function (exports) {
4646
4585
  isSafariExtension ? `safari-extension:${filename}` : `safari-web-extension:${filename}`,
4647
4586
  ]
4648
4587
  : [func, filename];
4649
- };
4650
- /**
4651
- * There are cases where stacktrace.message is an Event object
4652
- * https://github.com/getsentry/sentry-javascript/issues/1949
4653
- * In this specific case we try to extract stacktrace.message.error.message
4654
- */
4655
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4656
- function extractMessage(ex) {
4657
- const message = ex && ex.message;
4658
- if (!message) {
4659
- return 'No error message';
4660
- }
4661
- if (message.error && typeof message.error.message === 'string') {
4662
- return message.error.message;
4663
- }
4664
- return message;
4665
- }
4588
+ };
4666
4589
 
4667
- const STACKTRACE_LIMIT = 50;
4668
4590
  /**
4669
4591
  * This function creates an exception from an TraceKitStackTrace
4670
4592
  * @param stacktrace TraceKitStackTrace that will be converted to an exception
4671
4593
  * @hidden
4672
4594
  */
4673
- function exceptionFromStacktrace(stacktrace) {
4674
- const frames = prepareFramesForEvent(stacktrace.stack);
4595
+ function exceptionFromError(ex) {
4596
+ // Get the frames first since Opera can lose the stack if we touch anything else first
4597
+ const frames = parseStackFrames(ex);
4675
4598
  const exception = {
4676
- type: stacktrace.name,
4677
- value: stacktrace.message,
4599
+ type: ex && ex.name,
4600
+ value: extractMessage(ex),
4678
4601
  };
4679
4602
  if (frames && frames.length) {
4680
4603
  exception.stacktrace = { frames };
@@ -4702,54 +4625,67 @@ var Sentry = (function (exports) {
4702
4625
  },
4703
4626
  };
4704
4627
  if (syntheticException) {
4705
- const stacktrace = computeStackTrace(syntheticException);
4706
- const frames = prepareFramesForEvent(stacktrace.stack);
4707
- event.stacktrace = {
4708
- frames,
4709
- };
4628
+ const frames = parseStackFrames(syntheticException);
4629
+ if (frames.length) {
4630
+ event.stacktrace = { frames };
4631
+ }
4710
4632
  }
4711
4633
  return event;
4712
4634
  }
4713
4635
  /**
4714
4636
  * @hidden
4715
4637
  */
4716
- function eventFromStacktrace(stacktrace) {
4717
- const exception = exceptionFromStacktrace(stacktrace);
4638
+ function eventFromError(ex) {
4718
4639
  return {
4719
4640
  exception: {
4720
- values: [exception],
4641
+ values: [exceptionFromError(ex)],
4721
4642
  },
4722
4643
  };
4723
4644
  }
4645
+ /** Parses stack frames from an error */
4646
+ function parseStackFrames(ex) {
4647
+ // Access and store the stacktrace property before doing ANYTHING
4648
+ // else to it because Opera is not very good at providing it
4649
+ // reliably in other circumstances.
4650
+ const stacktrace = ex.stacktrace || ex.stack || '';
4651
+ const popSize = getPopSize(ex);
4652
+ try {
4653
+ // The order of the parsers in important
4654
+ return createStackParser(opera10, opera11, chrome, winjs, gecko)(stacktrace, popSize);
4655
+ }
4656
+ catch (e) {
4657
+ // no-empty
4658
+ }
4659
+ return [];
4660
+ }
4661
+ // Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108
4662
+ const reactMinifiedRegexp = /Minified React error #\d+;/i;
4663
+ function getPopSize(ex) {
4664
+ if (ex) {
4665
+ if (typeof ex.framesToPop === 'number') {
4666
+ return ex.framesToPop;
4667
+ }
4668
+ if (reactMinifiedRegexp.test(ex.message)) {
4669
+ return 1;
4670
+ }
4671
+ }
4672
+ return 0;
4673
+ }
4724
4674
  /**
4725
- * @hidden
4675
+ * There are cases where stacktrace.message is an Event object
4676
+ * https://github.com/getsentry/sentry-javascript/issues/1949
4677
+ * In this specific case we try to extract stacktrace.message.error.message
4726
4678
  */
4727
- function prepareFramesForEvent(stack) {
4728
- if (!stack.length) {
4729
- return [];
4730
- }
4731
- let localStack = stack;
4732
- const firstFrameFunction = localStack[0].function || '';
4733
- const lastFrameFunction = localStack[localStack.length - 1].function || '';
4734
- // If stack starts with one of our API calls, remove it (starts, meaning it's the top of the stack - aka last call)
4735
- if (firstFrameFunction.indexOf('captureMessage') !== -1 || firstFrameFunction.indexOf('captureException') !== -1) {
4736
- localStack = localStack.slice(1);
4679
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4680
+ function extractMessage(ex) {
4681
+ const message = ex && ex.message;
4682
+ if (!message) {
4683
+ return 'No error message';
4737
4684
  }
4738
- // If stack ends with one of our internal API calls, remove it (ends, meaning it's the bottom of the stack - aka top-most call)
4739
- if (lastFrameFunction.indexOf('sentryWrapped') !== -1) {
4740
- localStack = localStack.slice(0, -1);
4685
+ if (message.error && typeof message.error.message === 'string') {
4686
+ return message.error.message;
4741
4687
  }
4742
- // The frame where the crash happened, should be the last entry in the array
4743
- return localStack
4744
- .slice(0, STACKTRACE_LIMIT)
4745
- .map(frame => ({
4746
- filename: frame.filename || localStack[0].filename,
4747
- function: frame.function || '?',
4748
- lineno: frame.lineno,
4749
- colno: frame.colno,
4750
- in_app: true,
4751
- }))
4752
- .reverse();
4688
+ return message;
4753
4689
  }
4754
4690
 
4755
4691
  /**
@@ -4791,10 +4727,7 @@ var Sentry = (function (exports) {
4791
4727
  if (isErrorEvent(exception) && exception.error) {
4792
4728
  // If it is an ErrorEvent with `error` property, extract it to get actual Error
4793
4729
  const errorEvent = exception;
4794
- // eslint-disable-next-line no-param-reassign
4795
- exception = errorEvent.error;
4796
- event = eventFromStacktrace(computeStackTrace(exception));
4797
- return event;
4730
+ return eventFromError(errorEvent.error);
4798
4731
  }
4799
4732
  // If it is a `DOMError` (which is a legacy API, but still supported in some browsers) then we just extract the name
4800
4733
  // and message, as it doesn't provide anything else. According to the spec, all `DOMExceptions` should also be
@@ -4806,7 +4739,7 @@ var Sentry = (function (exports) {
4806
4739
  if (isDOMError(exception) || isDOMException(exception)) {
4807
4740
  const domException = exception;
4808
4741
  if ('stack' in exception) {
4809
- event = eventFromStacktrace(computeStackTrace(exception));
4742
+ event = eventFromError(exception);
4810
4743
  }
4811
4744
  else {
4812
4745
  const name = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException');
@@ -4821,8 +4754,7 @@ var Sentry = (function (exports) {
4821
4754
  }
4822
4755
  if (isError(exception)) {
4823
4756
  // we have a real Error object, do nothing
4824
- event = eventFromStacktrace(computeStackTrace(exception));
4825
- return event;
4757
+ return eventFromError(exception);
4826
4758
  }
4827
4759
  if (isPlainObject(exception) || isEvent(exception)) {
4828
4760
  // If it's a plain object or an instance of `Event` (the built-in JS kind, not this SDK's `Event` type), serialize
@@ -4859,16 +4791,15 @@ var Sentry = (function (exports) {
4859
4791
  message: input,
4860
4792
  };
4861
4793
  if (options.attachStacktrace && syntheticException) {
4862
- const stacktrace = computeStackTrace(syntheticException);
4863
- const frames = prepareFramesForEvent(stacktrace.stack);
4864
- event.stacktrace = {
4865
- frames,
4866
- };
4794
+ const frames = parseStackFrames(syntheticException);
4795
+ if (frames.length) {
4796
+ event.stacktrace = { frames };
4797
+ }
4867
4798
  }
4868
4799
  return event;
4869
4800
  }
4870
4801
 
4871
- const global$3 = getGlobalObject();
4802
+ const global$4 = getGlobalObject();
4872
4803
  let cachedFetchImpl;
4873
4804
  /**
4874
4805
  * A special usecase for incorrectly wrapped Fetch APIs in conjunction with ad-blockers.
@@ -4914,11 +4845,11 @@ var Sentry = (function (exports) {
4914
4845
  }
4915
4846
  /* eslint-disable @typescript-eslint/unbound-method */
4916
4847
  // Fast path to avoid DOM I/O
4917
- if (isNativeFetch(global$3.fetch)) {
4918
- return (cachedFetchImpl = global$3.fetch.bind(global$3));
4848
+ if (isNativeFetch(global$4.fetch)) {
4849
+ return (cachedFetchImpl = global$4.fetch.bind(global$4));
4919
4850
  }
4920
- const document = global$3.document;
4921
- let fetchImpl = global$3.fetch;
4851
+ const document = global$4.document;
4852
+ let fetchImpl = global$4.fetch;
4922
4853
  // eslint-disable-next-line deprecation/deprecation
4923
4854
  if (document && typeof document.createElement === `function`) {
4924
4855
  try {
@@ -4937,7 +4868,7 @@ var Sentry = (function (exports) {
4937
4868
  }
4938
4869
  }
4939
4870
  }
4940
- return (cachedFetchImpl = fetchImpl.bind(global$3));
4871
+ return (cachedFetchImpl = fetchImpl.bind(global$4));
4941
4872
  /* eslint-enable @typescript-eslint/unbound-method */
4942
4873
  }
4943
4874
  /**
@@ -4947,11 +4878,11 @@ var Sentry = (function (exports) {
4947
4878
  * @param body report payload
4948
4879
  */
4949
4880
  function sendReport(url, body) {
4950
- const isRealNavigator = Object.prototype.toString.call(global$3 && global$3.navigator) === '[object Navigator]';
4951
- const hasSendBeacon = isRealNavigator && typeof global$3.navigator.sendBeacon === 'function';
4881
+ const isRealNavigator = Object.prototype.toString.call(global$4 && global$4.navigator) === '[object Navigator]';
4882
+ const hasSendBeacon = isRealNavigator && typeof global$4.navigator.sendBeacon === 'function';
4952
4883
  if (hasSendBeacon) {
4953
4884
  // Prevent illegal invocations - https://xgwang.me/posts/you-may-not-know-beacon/#it-may-throw-error%2C-be-sure-to-catch
4954
- const sendBeacon = global$3.navigator.sendBeacon.bind(global$3.navigator);
4885
+ const sendBeacon = global$4.navigator.sendBeacon.bind(global$4.navigator);
4955
4886
  return sendBeacon(url, body);
4956
4887
  }
4957
4888
  if (supportsFetch()) {
@@ -4969,7 +4900,7 @@ var Sentry = (function (exports) {
4969
4900
  const tyStr = ty;
4970
4901
  return tyStr === 'event' ? 'error' : tyStr;
4971
4902
  }
4972
- const global$4 = getGlobalObject();
4903
+ const global$3 = getGlobalObject();
4973
4904
  /** Base Transport class implementation */
4974
4905
  class BaseTransport {
4975
4906
  constructor(options) {
@@ -4982,9 +4913,9 @@ var Sentry = (function (exports) {
4982
4913
  this._api = initAPIDetails(options.dsn, options._metadata, options.tunnel);
4983
4914
  // eslint-disable-next-line deprecation/deprecation
4984
4915
  this.url = getStoreEndpointWithUrlEncodedAuth(this._api.dsn);
4985
- if (this.options.sendClientReports && global$4.document) {
4986
- global$4.document.addEventListener('visibilitychange', () => {
4987
- if (global$4.document.visibilityState === 'hidden') {
4916
+ if (this.options.sendClientReports && global$3.document) {
4917
+ global$3.document.addEventListener('visibilitychange', () => {
4918
+ if (global$3.document.visibilityState === 'hidden') {
4988
4919
  this._flushOutcomes();
4989
4920
  }
4990
4921
  });
@@ -5248,8 +5179,6 @@ var Sentry = (function (exports) {
5248
5179
  }
5249
5180
  }
5250
5181
 
5251
-
5252
-
5253
5182
  var index = /*#__PURE__*/Object.freeze({
5254
5183
  __proto__: null,
5255
5184
  BaseTransport: BaseTransport,
@@ -5293,7 +5222,7 @@ var Sentry = (function (exports) {
5293
5222
  }
5294
5223
  }
5295
5224
 
5296
- const global$5 = getGlobalObject();
5225
+ const global$2 = getGlobalObject();
5297
5226
  let ignoreOnError = 0;
5298
5227
  /**
5299
5228
  * @hidden
@@ -5319,7 +5248,7 @@ var Sentry = (function (exports) {
5319
5248
  * @returns The wrapped function.
5320
5249
  * @hidden
5321
5250
  */
5322
- function wrap(fn, options = {}, before) {
5251
+ function wrap$1(fn, options = {}, before) {
5323
5252
  // for future readers what this does is wrap a function and then create
5324
5253
  // a bi-directional wrapping between them.
5325
5254
  //
@@ -5356,7 +5285,7 @@ var Sentry = (function (exports) {
5356
5285
  before.apply(this, arguments);
5357
5286
  }
5358
5287
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
5359
- const wrappedArguments = args.map((arg) => wrap(arg, options));
5288
+ const wrappedArguments = args.map((arg) => wrap$1(arg, options));
5360
5289
  // Attempt to invoke user-land function
5361
5290
  // NOTE: If you are a Sentry user, and you are seeing this stack frame, it
5362
5291
  // means the sentry.javascript SDK caught an error invoking your application code. This
@@ -5414,7 +5343,7 @@ var Sentry = (function (exports) {
5414
5343
  * @hidden
5415
5344
  */
5416
5345
  function injectReportDialog(options = {}) {
5417
- if (!global$5.document) {
5346
+ if (!global$2.document) {
5418
5347
  return;
5419
5348
  }
5420
5349
  if (!options.eventId) {
@@ -5429,14 +5358,14 @@ var Sentry = (function (exports) {
5429
5358
  }
5430
5359
  return;
5431
5360
  }
5432
- const script = global$5.document.createElement('script');
5361
+ const script = global$2.document.createElement('script');
5433
5362
  script.async = true;
5434
5363
  script.src = getReportDialogEndpoint(options.dsn, options);
5435
5364
  if (options.onLoad) {
5436
5365
  // eslint-disable-next-line @typescript-eslint/unbound-method
5437
5366
  script.onload = options.onLoad;
5438
5367
  }
5439
- const injectionPoint = global$5.document.head || global$5.document.body;
5368
+ const injectionPoint = global$2.document.head || global$2.document.body;
5440
5369
  if (injectionPoint) {
5441
5370
  injectionPoint.appendChild(script);
5442
5371
  }
@@ -5721,7 +5650,7 @@ var Sentry = (function (exports) {
5721
5650
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5722
5651
  return function (...args) {
5723
5652
  const originalCallback = args[0];
5724
- args[0] = wrap(originalCallback, {
5653
+ args[0] = wrap$1(originalCallback, {
5725
5654
  mechanism: {
5726
5655
  data: { function: getFunctionName(original) },
5727
5656
  handled: true,
@@ -5737,7 +5666,7 @@ var Sentry = (function (exports) {
5737
5666
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5738
5667
  return function (callback) {
5739
5668
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
5740
- return original.call(this, wrap(callback, {
5669
+ return original.call(this, wrap$1(callback, {
5741
5670
  mechanism: {
5742
5671
  data: {
5743
5672
  function: 'requestAnimationFrame',
@@ -5776,7 +5705,7 @@ var Sentry = (function (exports) {
5776
5705
  wrapOptions.mechanism.data.handler = getFunctionName(originalFunction);
5777
5706
  }
5778
5707
  // Otherwise wrap directly
5779
- return wrap(original, wrapOptions);
5708
+ return wrap$1(original, wrapOptions);
5780
5709
  });
5781
5710
  }
5782
5711
  });
@@ -5797,7 +5726,7 @@ var Sentry = (function (exports) {
5797
5726
  return function (eventName, fn, options) {
5798
5727
  try {
5799
5728
  if (typeof fn.handleEvent === 'function') {
5800
- fn.handleEvent = wrap(fn.handleEvent.bind(fn), {
5729
+ fn.handleEvent = wrap$1(fn.handleEvent.bind(fn), {
5801
5730
  mechanism: {
5802
5731
  data: {
5803
5732
  function: 'handleEvent',
@@ -5815,7 +5744,7 @@ var Sentry = (function (exports) {
5815
5744
  }
5816
5745
  return original.call(this, eventName,
5817
5746
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5818
- wrap(fn, {
5747
+ wrap$1(fn, {
5819
5748
  mechanism: {
5820
5749
  data: {
5821
5750
  function: 'addEventListener',
@@ -6129,12 +6058,11 @@ var Sentry = (function (exports) {
6129
6058
  if (!isInstanceOf(error[key], Error) || stack.length + 1 >= limit) {
6130
6059
  return stack;
6131
6060
  }
6132
- const stacktrace = computeStackTrace(error[key]);
6133
- const exception = exceptionFromStacktrace(stacktrace);
6061
+ const exception = exceptionFromError(error[key]);
6134
6062
  return _walkErrorTree(limit, error[key], key, [exception, ...stack]);
6135
6063
  }
6136
6064
 
6137
- const global$6 = getGlobalObject();
6065
+ const global$1 = getGlobalObject();
6138
6066
  /** UserAgent */
6139
6067
  class UserAgent {
6140
6068
  constructor() {
@@ -6150,13 +6078,13 @@ var Sentry = (function (exports) {
6150
6078
  addGlobalEventProcessor((event) => {
6151
6079
  if (getCurrentHub().getIntegration(UserAgent)) {
6152
6080
  // if none of the information we want exists, don't bother
6153
- if (!global$6.navigator && !global$6.location && !global$6.document) {
6081
+ if (!global$1.navigator && !global$1.location && !global$1.document) {
6154
6082
  return event;
6155
6083
  }
6156
6084
  // grab as much info as exists and add it to the event
6157
- const url = (event.request && event.request.url) || (global$6.location && global$6.location.href);
6158
- const { referrer } = global$6.document || {};
6159
- const { userAgent } = global$6.navigator || {};
6085
+ const url = (event.request && event.request.url) || (global$1.location && global$1.location.href);
6086
+ const { referrer } = global$1.document || {};
6087
+ const { userAgent } = global$1.navigator || {};
6160
6088
  const headers = Object.assign(Object.assign(Object.assign({}, (event.request && event.request.headers)), (referrer && { Referer: referrer })), (userAgent && { 'User-Agent': userAgent }));
6161
6089
  const request = Object.assign(Object.assign({}, (url && { url })), { headers });
6162
6090
  return Object.assign(Object.assign({}, event), { request });
@@ -6334,8 +6262,6 @@ var Sentry = (function (exports) {
6334
6262
  return undefined;
6335
6263
  }
6336
6264
 
6337
-
6338
-
6339
6265
  var BrowserIntegrations = /*#__PURE__*/Object.freeze({
6340
6266
  __proto__: null,
6341
6267
  GlobalHandlers: GlobalHandlers,
@@ -6582,8 +6508,8 @@ var Sentry = (function (exports) {
6582
6508
  * @returns The result of wrapped function call.
6583
6509
  */
6584
6510
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6585
- function wrap$1(fn) {
6586
- return wrap(fn)();
6511
+ function wrap(fn) {
6512
+ return wrap$1(fn)();
6587
6513
  }
6588
6514
  function startSessionOnHub(hub) {
6589
6515
  hub.startSession({ ignoreDuration: true });
@@ -6672,9 +6598,9 @@ var Sentry = (function (exports) {
6672
6598
  exports.showReportDialog = showReportDialog;
6673
6599
  exports.startTransaction = startTransaction;
6674
6600
  exports.withScope = withScope;
6675
- exports.wrap = wrap$1;
6601
+ exports.wrap = wrap;
6676
6602
 
6677
6603
  return exports;
6678
6604
 
6679
- }({}));
6605
+ })({});
6680
6606
  //# sourceMappingURL=bundle.es6.js.map