@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.
package/build/bundle.js CHANGED
@@ -1,29 +1,31 @@
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
- Copyright (c) Microsoft Corporation. All rights reserved.
5
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
6
- this file except in compliance with the License. You may obtain a copy of the
7
- License at http://www.apache.org/licenses/LICENSE-2.0
4
+ Copyright (c) Microsoft Corporation.
8
5
 
9
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
10
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
11
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
12
- MERCHANTABLITY OR NON-INFRINGEMENT.
6
+ Permission to use, copy, modify, and/or distribute this software for any
7
+ purpose with or without fee is hereby granted.
13
8
 
14
- See the Apache Version 2.0 License for specific language governing permissions
15
- and limitations under the License.
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
16
16
  ***************************************************************************** */
17
17
  /* global Reflect, Promise */
18
18
 
19
19
  var extendStatics = function(d, b) {
20
20
  extendStatics = Object.setPrototypeOf ||
21
21
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
22
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
22
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
23
23
  return extendStatics(d, b);
24
24
  };
25
25
 
26
26
  function __extends(d, b) {
27
+ if (typeof b !== "function" && b !== null)
28
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
27
29
  extendStatics(d, b);
28
30
  function __() { this.constructor = d; }
29
31
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -41,14 +43,15 @@ var Sentry = (function (exports) {
41
43
  };
42
44
 
43
45
  function __values(o) {
44
- var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
46
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
45
47
  if (m) return m.call(o);
46
- return {
48
+ if (o && typeof o.length === "number") return {
47
49
  next: function () {
48
50
  if (o && i >= o.length) o = void 0;
49
51
  return { value: o && o[i++], done: !o };
50
52
  }
51
53
  };
54
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
52
55
  }
53
56
 
54
57
  function __read(o, n) {
@@ -68,6 +71,7 @@ var Sentry = (function (exports) {
68
71
  return ar;
69
72
  }
70
73
 
74
+ /** @deprecated */
71
75
  function __spread() {
72
76
  for (var ar = [], i = 0; i < arguments.length; i++)
73
77
  ar = ar.concat(__read(arguments[i]));
@@ -92,8 +96,7 @@ var Sentry = (function (exports) {
92
96
  Severity["Debug"] = "debug";
93
97
  /** JSDoc */
94
98
  Severity["Critical"] = "critical";
95
- })(exports.Severity || (exports.Severity = {}));
96
- var SeverityLevels = ['fatal', 'error', 'warning', 'log', 'info', 'debug', 'critical'];
99
+ })(exports.Severity || (exports.Severity = {}));
97
100
 
98
101
  /**
99
102
  * Consumes the promise and logs the error when it rejects.
@@ -557,6 +560,8 @@ var Sentry = (function (exports) {
557
560
  return components;
558
561
  }
559
562
 
563
+ var SeverityLevels = ['fatal', 'error', 'warning', 'log', 'info', 'debug', 'critical'];
564
+
560
565
  // TODO: Implement different loggers for different environments
561
566
  var global$1 = getGlobalObject();
562
567
  /** Prefix for logging strings */
@@ -799,16 +804,18 @@ var Sentry = (function (exports) {
799
804
  source[name] = wrapped;
800
805
  }
801
806
  /**
802
- * Defines a non enumerable property. This creates a non enumerable property on an object.
807
+ * Defines a non-enumerable property on the given object.
803
808
  *
804
- * @param func The function to set a property to
805
- * @param name the name of the special sentry property
806
- * @param value the property to define
809
+ * @param obj The object on which to set the property
810
+ * @param name The name of the property to be set
811
+ * @param value The value to which to set the property
807
812
  */
808
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
809
- function addNonEnumerableProperty(func, name, value) {
810
- Object.defineProperty(func, name, {
813
+ function addNonEnumerableProperty(obj, name, value) {
814
+ Object.defineProperty(obj, name, {
815
+ // enumerable: false, // the default, so we can save on bundle size by not explicitly setting it
811
816
  value: value,
817
+ writable: true,
818
+ configurable: true,
812
819
  });
813
820
  }
814
821
  /**
@@ -1331,7 +1338,7 @@ var Sentry = (function (exports) {
1331
1338
  if (!(level in global$2.console)) {
1332
1339
  return;
1333
1340
  }
1334
- fill(global$2.console, level, function (originalConsoleLevel) {
1341
+ fill(global$2.console, level, function (originalConsoleMethod) {
1335
1342
  return function () {
1336
1343
  var args = [];
1337
1344
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -1339,8 +1346,8 @@ var Sentry = (function (exports) {
1339
1346
  }
1340
1347
  triggerHandlers('console', { args: args, level: level });
1341
1348
  // this fails for some browsers. :(
1342
- if (originalConsoleLevel) {
1343
- Function.prototype.apply.call(originalConsoleLevel, global$2.console, args);
1349
+ if (originalConsoleMethod) {
1350
+ originalConsoleMethod.call(global$2.console, args);
1344
1351
  }
1345
1352
  };
1346
1353
  });
@@ -4464,7 +4471,7 @@ var Sentry = (function (exports) {
4464
4471
  hub.bindClient(client);
4465
4472
  }
4466
4473
 
4467
- var SDK_VERSION = '6.17.3';
4474
+ var SDK_VERSION = '6.17.7';
4468
4475
 
4469
4476
  var originalFunctionToString;
4470
4477
  /** Patch toString calls to return proper name for wrapped functions */
@@ -4694,7 +4701,7 @@ var Sentry = (function (exports) {
4694
4701
  // global reference to slice
4695
4702
  var UNKNOWN_FUNCTION = '?';
4696
4703
  // Chromium based browsers: Chrome, Brave, new Opera, new Edge
4697
- var chrome = /^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
4704
+ var chrome = /^\s*at (?:(.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
4698
4705
  // gecko regex: `(?:bundle|\d+\.js)`: `bundle` is for react native, `\d+\.js` also but specifically for ram bundles because it
4699
4706
  // generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js
4700
4707
  // We need this specific case for now because we want no other regex to match.
@@ -4748,7 +4755,7 @@ var Sentry = (function (exports) {
4748
4755
  /** JSDoc */
4749
4756
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, complexity
4750
4757
  function computeStackTraceFromStackProp(ex) {
4751
- var _a, _b;
4758
+ var e_1, _a, _b;
4752
4759
  if (!ex || !ex.stack) {
4753
4760
  return null;
4754
4761
  }
@@ -4758,74 +4765,66 @@ var Sentry = (function (exports) {
4758
4765
  var submatch;
4759
4766
  var parts;
4760
4767
  var element;
4761
- for (var i = 0; i < lines.length; ++i) {
4762
- if ((parts = chrome.exec(lines[i]))) {
4763
- var isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line
4764
- isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line
4765
- if (isEval && (submatch = chromeEval.exec(parts[2]))) {
4766
- // throw out eval line/column and use top-most line/column number
4767
- parts[2] = submatch[1]; // url
4768
- parts[3] = submatch[2]; // line
4769
- parts[4] = submatch[3]; // column
4768
+ try {
4769
+ for (var lines_1 = __values(lines), lines_1_1 = lines_1.next(); !lines_1_1.done; lines_1_1 = lines_1.next()) {
4770
+ var line = lines_1_1.value;
4771
+ if ((parts = chrome.exec(line))) {
4772
+ isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line
4773
+ if (isEval && (submatch = chromeEval.exec(parts[2]))) {
4774
+ // throw out eval line/column and use top-most line/column number
4775
+ parts[2] = submatch[1]; // url
4776
+ parts[3] = submatch[2]; // line
4777
+ parts[4] = submatch[3]; // column
4778
+ }
4779
+ // Kamil: One more hack won't hurt us right? Understanding and adding more rules on top of these regexps right now
4780
+ // would be way too time consuming. (TODO: Rewrite whole RegExp to be more readable)
4781
+ var _c = __read(extractSafariExtensionDetails(parts[1] || UNKNOWN_FUNCTION, parts[2]), 2), func = _c[0], url = _c[1];
4782
+ element = {
4783
+ url: url,
4784
+ func: func,
4785
+ line: parts[3] ? +parts[3] : null,
4786
+ column: parts[4] ? +parts[4] : null,
4787
+ };
4770
4788
  }
4771
- // Arpad: Working with the regexp above is super painful. it is quite a hack, but just stripping the `address at `
4772
- // prefix here seems like the quickest solution for now.
4773
- var url = parts[2] && parts[2].indexOf('address at ') === 0 ? parts[2].substr('address at '.length) : parts[2];
4774
- // Kamil: One more hack won't hurt us right? Understanding and adding more rules on top of these regexps right now
4775
- // would be way too time consuming. (TODO: Rewrite whole RegExp to be more readable)
4776
- var func = parts[1] || UNKNOWN_FUNCTION;
4777
- _a = __read(extractSafariExtensionDetails(func, url), 2), func = _a[0], url = _a[1];
4778
- element = {
4779
- url: url,
4780
- func: func,
4781
- args: isNative ? [parts[2]] : [],
4782
- line: parts[3] ? +parts[3] : null,
4783
- column: parts[4] ? +parts[4] : null,
4784
- };
4785
- }
4786
- else if ((parts = winjs.exec(lines[i]))) {
4787
- element = {
4788
- url: parts[2],
4789
- func: parts[1] || UNKNOWN_FUNCTION,
4790
- args: [],
4791
- line: +parts[3],
4792
- column: parts[4] ? +parts[4] : null,
4793
- };
4794
- }
4795
- else if ((parts = gecko.exec(lines[i]))) {
4796
- isEval = parts[3] && parts[3].indexOf(' > eval') > -1;
4797
- if (isEval && (submatch = geckoEval.exec(parts[3]))) {
4798
- // throw out eval line/column and use top-most line number
4799
- parts[1] = parts[1] || "eval";
4800
- parts[3] = submatch[1];
4801
- parts[4] = submatch[2];
4802
- parts[5] = ''; // no column when eval
4789
+ else if ((parts = winjs.exec(line))) {
4790
+ element = {
4791
+ url: parts[2],
4792
+ func: parts[1] || UNKNOWN_FUNCTION,
4793
+ line: +parts[3],
4794
+ column: parts[4] ? +parts[4] : null,
4795
+ };
4803
4796
  }
4804
- else if (i === 0 && !parts[5] && ex.columnNumber !== void 0) {
4805
- // FireFox uses this awesome columnNumber property for its top frame
4806
- // Also note, Firefox's column number is 0-based and everything else expects 1-based,
4807
- // so adding 1
4808
- // NOTE: this hack doesn't work if top-most frame is eval
4809
- stack[0].column = ex.columnNumber + 1;
4797
+ else if ((parts = gecko.exec(line))) {
4798
+ isEval = parts[3] && parts[3].indexOf(' > eval') > -1;
4799
+ if (isEval && (submatch = geckoEval.exec(parts[3]))) {
4800
+ // throw out eval line/column and use top-most line number
4801
+ parts[1] = parts[1] || "eval";
4802
+ parts[3] = submatch[1];
4803
+ parts[4] = submatch[2];
4804
+ parts[5] = ''; // no column when eval
4805
+ }
4806
+ var url = parts[3];
4807
+ var func = parts[1] || UNKNOWN_FUNCTION;
4808
+ _b = __read(extractSafariExtensionDetails(func, url), 2), func = _b[0], url = _b[1];
4809
+ element = {
4810
+ url: url,
4811
+ func: func,
4812
+ line: parts[4] ? +parts[4] : null,
4813
+ column: parts[5] ? +parts[5] : null,
4814
+ };
4810
4815
  }
4811
- var url = parts[3];
4812
- var func = parts[1] || UNKNOWN_FUNCTION;
4813
- _b = __read(extractSafariExtensionDetails(func, url), 2), func = _b[0], url = _b[1];
4814
- element = {
4815
- url: url,
4816
- func: func,
4817
- args: parts[2] ? parts[2].split(',') : [],
4818
- line: parts[4] ? +parts[4] : null,
4819
- column: parts[5] ? +parts[5] : null,
4820
- };
4821
- }
4822
- else {
4823
- continue;
4816
+ else {
4817
+ continue;
4818
+ }
4819
+ stack.push(element);
4824
4820
  }
4825
- if (!element.func && element.line) {
4826
- element.func = UNKNOWN_FUNCTION;
4821
+ }
4822
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
4823
+ finally {
4824
+ try {
4825
+ if (lines_1_1 && !lines_1_1.done && (_a = lines_1.return)) _a.call(lines_1);
4827
4826
  }
4828
- stack.push(element);
4827
+ finally { if (e_1) throw e_1.error; }
4829
4828
  }
4830
4829
  if (!stack.length) {
4831
4830
  return null;
@@ -4847,7 +4846,7 @@ var Sentry = (function (exports) {
4847
4846
  // reliably in other circumstances.
4848
4847
  var stacktrace = ex.stacktrace;
4849
4848
  var opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
4850
- var opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\((.*)\))? in (.*):\s*$/i;
4849
+ var opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i;
4851
4850
  var lines = stacktrace.split('\n');
4852
4851
  var stack = [];
4853
4852
  var parts;
@@ -4857,16 +4856,14 @@ var Sentry = (function (exports) {
4857
4856
  element = {
4858
4857
  url: parts[2],
4859
4858
  func: parts[3],
4860
- args: [],
4861
4859
  line: +parts[1],
4862
4860
  column: null,
4863
4861
  };
4864
4862
  }
4865
4863
  else if ((parts = opera11Regex.exec(lines[line]))) {
4866
4864
  element = {
4867
- url: parts[6],
4865
+ url: parts[5],
4868
4866
  func: parts[3] || parts[4],
4869
- args: parts[5] ? parts[5].split(',') : [],
4870
4867
  line: +parts[1],
4871
4868
  column: +parts[2],
4872
4869
  };
@@ -5832,6 +5829,7 @@ var Sentry = (function (exports) {
5832
5829
  attachStacktrace: attachStacktrace,
5833
5830
  isRejection: false,
5834
5831
  }), url, line, column);
5832
+ event.level = exports.Severity.Error;
5835
5833
  addMechanismAndCapture(hub, error, event, 'onerror');
5836
5834
  });
5837
5835
  }
@@ -6993,6 +6991,7 @@ var Sentry = (function (exports) {
6993
6991
  exports.SDK_NAME = SDK_NAME;
6994
6992
  exports.SDK_VERSION = SDK_VERSION;
6995
6993
  exports.Scope = Scope;
6994
+ exports.Session = Session;
6996
6995
  exports.Transports = index;
6997
6996
  exports.addBreadcrumb = addBreadcrumb;
6998
6997
  exports.addGlobalEventProcessor = addGlobalEventProcessor;