@sentry/browser 6.17.3 → 6.17.7

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.
@@ -1,4 +1,4 @@
1
- /*! @sentry/browser 6.17.3 (42e245a) | https://github.com/getsentry/sentry-javascript */
1
+ /*! @sentry/browser 6.17.7 (635dfc2) | https://github.com/getsentry/sentry-javascript */
2
2
  var Sentry = (function (exports) {
3
3
  /**
4
4
  * TODO(v7): Remove this enum and replace with SeverityLevel
@@ -18,8 +18,7 @@ var Sentry = (function (exports) {
18
18
  Severity["Debug"] = "debug";
19
19
  /** JSDoc */
20
20
  Severity["Critical"] = "critical";
21
- })(exports.Severity || (exports.Severity = {}));
22
- const SeverityLevels = ['fatal', 'error', 'warning', 'log', 'info', 'debug', 'critical'];
21
+ })(exports.Severity || (exports.Severity = {}));
23
22
 
24
23
  /**
25
24
  * Consumes the promise and logs the error when it rejects.
@@ -478,6 +477,8 @@ var Sentry = (function (exports) {
478
477
  return components;
479
478
  }
480
479
 
480
+ const SeverityLevels = ['fatal', 'error', 'warning', 'log', 'info', 'debug', 'critical'];
481
+
481
482
  // TODO: Implement different loggers for different environments
482
483
  const global$1 = getGlobalObject();
483
484
  /** Prefix for logging strings */
@@ -706,16 +707,18 @@ var Sentry = (function (exports) {
706
707
  source[name] = wrapped;
707
708
  }
708
709
  /**
709
- * Defines a non enumerable property. This creates a non enumerable property on an object.
710
+ * Defines a non-enumerable property on the given object.
710
711
  *
711
- * @param func The function to set a property to
712
- * @param name the name of the special sentry property
713
- * @param value the property to define
712
+ * @param obj The object on which to set the property
713
+ * @param name The name of the property to be set
714
+ * @param value The value to which to set the property
714
715
  */
715
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
716
- function addNonEnumerableProperty(func, name, value) {
717
- Object.defineProperty(func, name, {
716
+ function addNonEnumerableProperty(obj, name, value) {
717
+ Object.defineProperty(obj, name, {
718
+ // enumerable: false, // the default, so we can save on bundle size by not explicitly setting it
718
719
  value: value,
720
+ writable: true,
721
+ configurable: true,
719
722
  });
720
723
  }
721
724
  /**
@@ -1211,12 +1214,12 @@ var Sentry = (function (exports) {
1211
1214
  if (!(level in global$2.console)) {
1212
1215
  return;
1213
1216
  }
1214
- fill(global$2.console, level, function (originalConsoleLevel) {
1217
+ fill(global$2.console, level, function (originalConsoleMethod) {
1215
1218
  return function (...args) {
1216
1219
  triggerHandlers('console', { args, level });
1217
1220
  // this fails for some browsers. :(
1218
- if (originalConsoleLevel) {
1219
- Function.prototype.apply.call(originalConsoleLevel, global$2.console, args);
1221
+ if (originalConsoleMethod) {
1222
+ originalConsoleMethod.call(global$2.console, args);
1220
1223
  }
1221
1224
  };
1222
1225
  });
@@ -4260,7 +4263,7 @@ var Sentry = (function (exports) {
4260
4263
  hub.bindClient(client);
4261
4264
  }
4262
4265
 
4263
- const SDK_VERSION = '6.17.3';
4266
+ const SDK_VERSION = '6.17.7';
4264
4267
 
4265
4268
  let originalFunctionToString;
4266
4269
  /** Patch toString calls to return proper name for wrapped functions */
@@ -4498,7 +4501,7 @@ var Sentry = (function (exports) {
4498
4501
  // global reference to slice
4499
4502
  const UNKNOWN_FUNCTION = '?';
4500
4503
  // Chromium based browsers: Chrome, Brave, new Opera, new Edge
4501
- const chrome = /^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
4504
+ const chrome = /^\s*at (?:(.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
4502
4505
  // gecko regex: `(?:bundle|\d+\.js)`: `bundle` is for react native, `\d+\.js` also but specifically for ram bundles because it
4503
4506
  // generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js
4504
4507
  // We need this specific case for now because we want no other regex to match.
@@ -4561,9 +4564,8 @@ var Sentry = (function (exports) {
4561
4564
  let submatch;
4562
4565
  let parts;
4563
4566
  let element;
4564
- for (let i = 0; i < lines.length; ++i) {
4565
- if ((parts = chrome.exec(lines[i]))) {
4566
- const isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line
4567
+ for (const line of lines) {
4568
+ if ((parts = chrome.exec(line))) {
4567
4569
  isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line
4568
4570
  if (isEval && (submatch = chromeEval.exec(parts[2]))) {
4569
4571
  // throw out eval line/column and use top-most line/column number
@@ -4571,31 +4573,25 @@ var Sentry = (function (exports) {
4571
4573
  parts[3] = submatch[2]; // line
4572
4574
  parts[4] = submatch[3]; // column
4573
4575
  }
4574
- // Arpad: Working with the regexp above is super painful. it is quite a hack, but just stripping the `address at `
4575
- // prefix here seems like the quickest solution for now.
4576
- let url = parts[2] && parts[2].indexOf('address at ') === 0 ? parts[2].substr('address at '.length) : parts[2];
4577
4576
  // Kamil: One more hack won't hurt us right? Understanding and adding more rules on top of these regexps right now
4578
4577
  // would be way too time consuming. (TODO: Rewrite whole RegExp to be more readable)
4579
- let func = parts[1] || UNKNOWN_FUNCTION;
4580
- [func, url] = extractSafariExtensionDetails(func, url);
4578
+ const [func, url] = extractSafariExtensionDetails(parts[1] || UNKNOWN_FUNCTION, parts[2]);
4581
4579
  element = {
4582
4580
  url,
4583
4581
  func,
4584
- args: isNative ? [parts[2]] : [],
4585
4582
  line: parts[3] ? +parts[3] : null,
4586
4583
  column: parts[4] ? +parts[4] : null,
4587
4584
  };
4588
4585
  }
4589
- else if ((parts = winjs.exec(lines[i]))) {
4586
+ else if ((parts = winjs.exec(line))) {
4590
4587
  element = {
4591
4588
  url: parts[2],
4592
4589
  func: parts[1] || UNKNOWN_FUNCTION,
4593
- args: [],
4594
4590
  line: +parts[3],
4595
4591
  column: parts[4] ? +parts[4] : null,
4596
4592
  };
4597
4593
  }
4598
- else if ((parts = gecko.exec(lines[i]))) {
4594
+ else if ((parts = gecko.exec(line))) {
4599
4595
  isEval = parts[3] && parts[3].indexOf(' > eval') > -1;
4600
4596
  if (isEval && (submatch = geckoEval.exec(parts[3]))) {
4601
4597
  // throw out eval line/column and use top-most line number
@@ -4604,20 +4600,12 @@ var Sentry = (function (exports) {
4604
4600
  parts[4] = submatch[2];
4605
4601
  parts[5] = ''; // no column when eval
4606
4602
  }
4607
- else if (i === 0 && !parts[5] && ex.columnNumber !== void 0) {
4608
- // FireFox uses this awesome columnNumber property for its top frame
4609
- // Also note, Firefox's column number is 0-based and everything else expects 1-based,
4610
- // so adding 1
4611
- // NOTE: this hack doesn't work if top-most frame is eval
4612
- stack[0].column = ex.columnNumber + 1;
4613
- }
4614
4603
  let url = parts[3];
4615
4604
  let func = parts[1] || UNKNOWN_FUNCTION;
4616
4605
  [func, url] = extractSafariExtensionDetails(func, url);
4617
4606
  element = {
4618
4607
  url,
4619
4608
  func,
4620
- args: parts[2] ? parts[2].split(',') : [],
4621
4609
  line: parts[4] ? +parts[4] : null,
4622
4610
  column: parts[5] ? +parts[5] : null,
4623
4611
  };
@@ -4625,9 +4613,6 @@ var Sentry = (function (exports) {
4625
4613
  else {
4626
4614
  continue;
4627
4615
  }
4628
- if (!element.func && element.line) {
4629
- element.func = UNKNOWN_FUNCTION;
4630
- }
4631
4616
  stack.push(element);
4632
4617
  }
4633
4618
  if (!stack.length) {
@@ -4650,7 +4635,7 @@ var Sentry = (function (exports) {
4650
4635
  // reliably in other circumstances.
4651
4636
  const stacktrace = ex.stacktrace;
4652
4637
  const opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
4653
- const opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\((.*)\))? in (.*):\s*$/i;
4638
+ const opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i;
4654
4639
  const lines = stacktrace.split('\n');
4655
4640
  const stack = [];
4656
4641
  let parts;
@@ -4660,16 +4645,14 @@ var Sentry = (function (exports) {
4660
4645
  element = {
4661
4646
  url: parts[2],
4662
4647
  func: parts[3],
4663
- args: [],
4664
4648
  line: +parts[1],
4665
4649
  column: null,
4666
4650
  };
4667
4651
  }
4668
4652
  else if ((parts = opera11Regex.exec(lines[line]))) {
4669
4653
  element = {
4670
- url: parts[6],
4654
+ url: parts[5],
4671
4655
  func: parts[3] || parts[4],
4672
- args: parts[5] ? parts[5].split(',') : [],
4673
4656
  line: +parts[1],
4674
4657
  column: +parts[2],
4675
4658
  };
@@ -5585,6 +5568,7 @@ var Sentry = (function (exports) {
5585
5568
  attachStacktrace,
5586
5569
  isRejection: false,
5587
5570
  }), url, line, column);
5571
+ event.level = exports.Severity.Error;
5588
5572
  addMechanismAndCapture(hub, error, event, 'onerror');
5589
5573
  });
5590
5574
  }
@@ -6723,6 +6707,7 @@ var Sentry = (function (exports) {
6723
6707
  exports.SDK_NAME = SDK_NAME;
6724
6708
  exports.SDK_VERSION = SDK_VERSION;
6725
6709
  exports.Scope = Scope;
6710
+ exports.Session = Session;
6726
6711
  exports.Transports = index;
6727
6712
  exports.addBreadcrumb = addBreadcrumb;
6728
6713
  exports.addGlobalEventProcessor = addGlobalEventProcessor;