@sentry/browser 6.19.3 → 6.19.6

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 (162) hide show
  1. package/build/bundle.debug.min.js +3 -0
  2. package/build/bundle.debug.min.js.map +1 -0
  3. package/build/bundle.es6.debug.min.js +3 -0
  4. package/build/bundle.es6.debug.min.js.map +1 -0
  5. package/{bundles → build}/bundle.es6.js +167 -109
  6. package/build/bundle.es6.js.map +1 -0
  7. package/build/bundle.es6.min.js +3 -0
  8. package/build/bundle.es6.min.js.map +1 -0
  9. package/{bundles → build}/bundle.js +172 -128
  10. package/build/bundle.js.map +1 -0
  11. package/build/bundle.min.js +3 -0
  12. package/build/bundle.min.js.map +1 -0
  13. package/dist/backend.d.ts.map +1 -1
  14. package/dist/backend.js.map +1 -1
  15. package/dist/client.d.ts.map +1 -1
  16. package/dist/client.js +2 -1
  17. package/dist/client.js.map +1 -1
  18. package/dist/eventbuilder.d.ts.map +1 -1
  19. package/dist/eventbuilder.js.map +1 -1
  20. package/dist/exports.d.ts.map +1 -1
  21. package/dist/exports.js.map +1 -1
  22. package/dist/flags.d.ts +3 -0
  23. package/dist/flags.d.ts.map +1 -0
  24. package/dist/flags.js +17 -0
  25. package/dist/flags.js.map +1 -0
  26. package/dist/helpers.d.ts.map +1 -1
  27. package/dist/helpers.js +3 -2
  28. package/dist/helpers.js.map +1 -1
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/integrations/breadcrumbs.d.ts.map +1 -1
  32. package/dist/integrations/breadcrumbs.js.map +1 -1
  33. package/dist/integrations/dedupe.d.ts.map +1 -1
  34. package/dist/integrations/dedupe.js +2 -1
  35. package/dist/integrations/dedupe.js.map +1 -1
  36. package/dist/integrations/globalhandlers.d.ts.map +1 -1
  37. package/dist/integrations/globalhandlers.js +2 -1
  38. package/dist/integrations/globalhandlers.js.map +1 -1
  39. package/dist/integrations/index.d.ts.map +1 -1
  40. package/dist/integrations/index.js.map +1 -1
  41. package/dist/integrations/linkederrors.d.ts.map +1 -1
  42. package/dist/integrations/linkederrors.js.map +1 -1
  43. package/dist/integrations/trycatch.d.ts.map +1 -1
  44. package/dist/integrations/trycatch.js.map +1 -1
  45. package/dist/integrations/useragent.d.ts.map +1 -1
  46. package/dist/integrations/useragent.js.map +1 -1
  47. package/dist/sdk.d.ts.map +1 -1
  48. package/dist/sdk.js +4 -3
  49. package/dist/sdk.js.map +1 -1
  50. package/dist/stack-parsers.d.ts.map +1 -1
  51. package/dist/stack-parsers.js.map +1 -1
  52. package/dist/transports/base.d.ts.map +1 -1
  53. package/dist/transports/base.js +7 -6
  54. package/dist/transports/base.js.map +1 -1
  55. package/dist/transports/fetch.d.ts.map +1 -1
  56. package/dist/transports/fetch.js.map +1 -1
  57. package/dist/transports/index.d.ts.map +1 -1
  58. package/dist/transports/index.js.map +1 -1
  59. package/dist/transports/new-fetch.d.ts.map +1 -1
  60. package/dist/transports/new-fetch.js.map +1 -1
  61. package/dist/transports/new-xhr.d.ts.map +1 -1
  62. package/dist/transports/new-xhr.js.map +1 -1
  63. package/dist/transports/utils.d.ts.map +1 -1
  64. package/dist/transports/utils.js +2 -1
  65. package/dist/transports/utils.js.map +1 -1
  66. package/dist/transports/xhr.d.ts.map +1 -1
  67. package/dist/transports/xhr.js.map +1 -1
  68. package/dist/version.d.ts.map +1 -1
  69. package/dist/version.js.map +1 -1
  70. package/esm/backend.d.ts.map +1 -1
  71. package/esm/backend.js.map +1 -1
  72. package/esm/client.d.ts.map +1 -1
  73. package/esm/client.js +3 -2
  74. package/esm/client.js.map +1 -1
  75. package/esm/eventbuilder.d.ts.map +1 -1
  76. package/esm/eventbuilder.js.map +1 -1
  77. package/esm/exports.d.ts.map +1 -1
  78. package/esm/exports.js.map +1 -1
  79. package/esm/flags.d.ts +3 -0
  80. package/esm/flags.d.ts.map +1 -0
  81. package/esm/flags.js +16 -0
  82. package/esm/flags.js.map +1 -0
  83. package/esm/helpers.d.ts.map +1 -1
  84. package/esm/helpers.js +4 -3
  85. package/esm/helpers.js.map +1 -1
  86. package/esm/index.d.ts.map +1 -1
  87. package/esm/index.js.map +1 -1
  88. package/esm/integrations/breadcrumbs.d.ts.map +1 -1
  89. package/esm/integrations/breadcrumbs.js.map +1 -1
  90. package/esm/integrations/dedupe.d.ts.map +1 -1
  91. package/esm/integrations/dedupe.js +3 -2
  92. package/esm/integrations/dedupe.js.map +1 -1
  93. package/esm/integrations/globalhandlers.d.ts.map +1 -1
  94. package/esm/integrations/globalhandlers.js +3 -2
  95. package/esm/integrations/globalhandlers.js.map +1 -1
  96. package/esm/integrations/index.d.ts.map +1 -1
  97. package/esm/integrations/index.js.map +1 -1
  98. package/esm/integrations/linkederrors.d.ts.map +1 -1
  99. package/esm/integrations/linkederrors.js.map +1 -1
  100. package/esm/integrations/trycatch.d.ts.map +1 -1
  101. package/esm/integrations/trycatch.js.map +1 -1
  102. package/esm/integrations/useragent.d.ts.map +1 -1
  103. package/esm/integrations/useragent.js.map +1 -1
  104. package/esm/sdk.d.ts.map +1 -1
  105. package/esm/sdk.js +5 -4
  106. package/esm/sdk.js.map +1 -1
  107. package/esm/stack-parsers.d.ts.map +1 -1
  108. package/esm/stack-parsers.js.map +1 -1
  109. package/esm/transports/base.d.ts.map +1 -1
  110. package/esm/transports/base.js +8 -7
  111. package/esm/transports/base.js.map +1 -1
  112. package/esm/transports/fetch.d.ts.map +1 -1
  113. package/esm/transports/fetch.js.map +1 -1
  114. package/esm/transports/index.d.ts.map +1 -1
  115. package/esm/transports/index.js.map +1 -1
  116. package/esm/transports/new-fetch.d.ts.map +1 -1
  117. package/esm/transports/new-fetch.js.map +1 -1
  118. package/esm/transports/new-xhr.d.ts.map +1 -1
  119. package/esm/transports/new-xhr.js.map +1 -1
  120. package/esm/transports/utils.d.ts.map +1 -1
  121. package/esm/transports/utils.js +3 -2
  122. package/esm/transports/utils.js.map +1 -1
  123. package/esm/transports/xhr.d.ts.map +1 -1
  124. package/esm/transports/xhr.js.map +1 -1
  125. package/esm/version.d.ts.map +1 -1
  126. package/esm/version.js.map +1 -1
  127. package/package.json +6 -45
  128. package/types/backend.d.ts.map +1 -1
  129. package/types/client.d.ts.map +1 -1
  130. package/types/eventbuilder.d.ts.map +1 -1
  131. package/types/exports.d.ts.map +1 -1
  132. package/types/flags.d.ts +3 -0
  133. package/types/flags.d.ts.map +1 -0
  134. package/types/helpers.d.ts.map +1 -1
  135. package/types/index.d.ts.map +1 -1
  136. package/types/integrations/breadcrumbs.d.ts.map +1 -1
  137. package/types/integrations/dedupe.d.ts.map +1 -1
  138. package/types/integrations/globalhandlers.d.ts.map +1 -1
  139. package/types/integrations/index.d.ts.map +1 -1
  140. package/types/integrations/linkederrors.d.ts.map +1 -1
  141. package/types/integrations/trycatch.d.ts.map +1 -1
  142. package/types/integrations/useragent.d.ts.map +1 -1
  143. package/types/sdk.d.ts.map +1 -1
  144. package/types/stack-parsers.d.ts.map +1 -1
  145. package/types/transports/base.d.ts.map +1 -1
  146. package/types/transports/fetch.d.ts.map +1 -1
  147. package/types/transports/index.d.ts.map +1 -1
  148. package/types/transports/new-fetch.d.ts.map +1 -1
  149. package/types/transports/new-xhr.d.ts.map +1 -1
  150. package/types/transports/utils.d.ts.map +1 -1
  151. package/types/transports/xhr.d.ts.map +1 -1
  152. package/types/version.d.ts.map +1 -1
  153. package/bundles/bundle.debug.min.js +0 -3
  154. package/bundles/bundle.debug.min.js.map +0 -1
  155. package/bundles/bundle.es6.debug.min.js +0 -3
  156. package/bundles/bundle.es6.debug.min.js.map +0 -1
  157. package/bundles/bundle.es6.js.map +0 -1
  158. package/bundles/bundle.es6.min.js +0 -3
  159. package/bundles/bundle.es6.min.js.map +0 -1
  160. package/bundles/bundle.js.map +0 -1
  161. package/bundles/bundle.min.js +0 -3
  162. package/bundles/bundle.min.js.map +0 -1
@@ -1,4 +1,4 @@
1
- /*! @sentry/browser 6.19.3 (fe6f7b3) | https://github.com/getsentry/sentry-javascript */
1
+ /*! @sentry/browser 6.19.6 (20eb6d0) | https://github.com/getsentry/sentry-javascript */
2
2
  var Sentry = (function (exports) {
3
3
 
4
4
  /**
@@ -35,22 +35,6 @@ var Sentry = (function (exports) {
35
35
  });
36
36
  }
37
37
 
38
- /**
39
- * This module exists for optimizations in the build process through rollup and terser. We define some global
40
- * constants, which can be overridden during build. By guarding certain pieces of code with functions that return these
41
- * constants, we can control whether or not they appear in the final bundle. (Any code guarded by a false condition will
42
- * never run, and will hence be dropped during treeshaking.) The two primary uses for this are stripping out calls to
43
- * `logger` and preventing node-related code from appearing in browser bundles.
44
- */
45
- /**
46
- * Figures out if we're building with debug functionality.
47
- *
48
- * @returns true if this is a debug build
49
- */
50
- function isDebugBuild() {
51
- return true;
52
- }
53
-
54
38
  /**
55
39
  * NOTE: In order to avoid circular dependencies, if you add a function to this module and it needs to print something,
56
40
  * you must either a) use `console.log` rather than the logger, or b) put your function elsewhere.
@@ -67,6 +51,23 @@ var Sentry = (function (exports) {
67
51
  : typeof self !== 'undefined'
68
52
  ? self
69
53
  : fallbackGlobalObject);
54
+ }
55
+ /**
56
+ * Returns a global singleton contained in the global `__SENTRY__` object.
57
+ *
58
+ * If the singleton doesn't already exist in `__SENTRY__`, it will be created using the given factory
59
+ * function and added to the `__SENTRY__` object.
60
+ *
61
+ * @param name name of the global singleton on __SENTRY__
62
+ * @param creator creator Factory function to create the singleton if it doesn't already exist on `__SENTRY__`
63
+ * @param obj (Optional) The global object on which to look for `__SENTRY__`, if not `getGlobalObject`'s return value
64
+ * @returns the singleton
65
+ */
66
+ function getGlobalSingleton(name, creator, obj) {
67
+ const global = (obj || getGlobalObject());
68
+ const __SENTRY__ = (global.__SENTRY__ = global.__SENTRY__ || {});
69
+ const singleton = __SENTRY__[name] || (__SENTRY__[name] = creator());
70
+ return singleton;
70
71
  }
71
72
 
72
73
  /* eslint-disable @typescript-eslint/no-explicit-any */
@@ -365,6 +366,22 @@ var Sentry = (function (exports) {
365
366
  }
366
367
  }
367
368
 
369
+ /*
370
+ * This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking
371
+ * for users.
372
+ *
373
+ * Debug flags need to be declared in each package individually and must not be imported across package boundaries,
374
+ * because some build tools have trouble tree-shaking imported guards.
375
+ *
376
+ * As a convention, we define debug flags in a `flags.ts` file in the root of a package's `src` folder.
377
+ *
378
+ * Debug flag files will contain "magic strings" like `true` that may get replaced with actual values during
379
+ * our, or the user's build process. Take care when introducing new flags - they must not throw if they are not
380
+ * replaced.
381
+ */
382
+ /** Flag that is true for debug builds, false otherwise. */
383
+ const IS_DEBUG_BUILD$3 = true;
384
+
368
385
  /** Regular expression used to parse a Dsn. */
369
386
  const DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w.-]+)(?::(\d+))?\/(.+)/;
370
387
  function isValidProtocol(protocol) {
@@ -422,6 +439,9 @@ var Sentry = (function (exports) {
422
439
  };
423
440
  }
424
441
  function validateDsn(dsn) {
442
+ if (!IS_DEBUG_BUILD$3) {
443
+ return;
444
+ }
425
445
  const { port, projectId, protocol } = dsn;
426
446
  const requiredComponents = ['protocol', 'publicKey', 'host', 'projectId'];
427
447
  requiredComponents.forEach(component => {
@@ -455,8 +475,7 @@ var Sentry = (function (exports) {
455
475
  const PREFIX = 'Sentry Logger ';
456
476
  const CONSOLE_LEVELS = ['debug', 'info', 'warn', 'error', 'log', 'assert'];
457
477
  /**
458
- * Temporarily unwrap `console.log` and friends in order to perform the given callback using the original methods.
459
- * Restores wrapping after the callback completes.
478
+ * Temporarily disable sentry console instrumentations.
460
479
  *
461
480
  * @param callback The function to run against the original `console` messages
462
481
  * @returns The results of the callback
@@ -466,73 +485,63 @@ var Sentry = (function (exports) {
466
485
  if (!('console' in global)) {
467
486
  return callback();
468
487
  }
469
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
470
488
  const originalConsole = global.console;
471
489
  const wrappedLevels = {};
472
490
  // Restore all wrapped console methods
473
491
  CONSOLE_LEVELS.forEach(level => {
474
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
475
- if (level in global.console && originalConsole[level].__sentry_original__) {
492
+ // TODO(v7): Remove this check as it's only needed for Node 6
493
+ const originalWrappedFunc = originalConsole[level] && originalConsole[level].__sentry_original__;
494
+ if (level in global.console && originalWrappedFunc) {
476
495
  wrappedLevels[level] = originalConsole[level];
477
- originalConsole[level] = originalConsole[level].__sentry_original__;
496
+ originalConsole[level] = originalWrappedFunc;
478
497
  }
479
498
  });
480
- // Perform callback manipulations
481
- const result = callback();
482
- // Revert restoration to wrapped state
483
- Object.keys(wrappedLevels).forEach(level => {
484
- originalConsole[level] = wrappedLevels[level];
485
- });
486
- return result;
487
- }
488
- /** JSDoc */
489
- class Logger {
490
- /** JSDoc */
491
- constructor() {
492
- this._enabled = false;
493
- }
494
- /** JSDoc */
495
- disable() {
496
- this._enabled = false;
497
- }
498
- /** JSDoc */
499
- enable() {
500
- this._enabled = true;
499
+ try {
500
+ return callback();
501
501
  }
502
- /** JSDoc */
503
- log(...args) {
504
- if (!this._enabled) {
505
- return;
506
- }
507
- consoleSandbox(() => {
508
- global$6.console.log(`${PREFIX}[Log]:`, ...args);
502
+ finally {
503
+ // Revert restoration to wrapped state
504
+ Object.keys(wrappedLevels).forEach(level => {
505
+ originalConsole[level] = wrappedLevels[level];
509
506
  });
510
507
  }
511
- /** JSDoc */
512
- warn(...args) {
513
- if (!this._enabled) {
514
- return;
515
- }
516
- consoleSandbox(() => {
517
- global$6.console.warn(`${PREFIX}[Warn]:`, ...args);
508
+ }
509
+ function makeLogger() {
510
+ let enabled = false;
511
+ const logger = {
512
+ enable: () => {
513
+ enabled = true;
514
+ },
515
+ disable: () => {
516
+ enabled = false;
517
+ },
518
+ };
519
+ if (IS_DEBUG_BUILD$3) {
520
+ CONSOLE_LEVELS.forEach(name => {
521
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
522
+ logger[name] = (...args) => {
523
+ if (enabled) {
524
+ consoleSandbox(() => {
525
+ global$6.console[name](`${PREFIX}[${name}]:`, ...args);
526
+ });
527
+ }
528
+ };
518
529
  });
519
530
  }
520
- /** JSDoc */
521
- error(...args) {
522
- if (!this._enabled) {
523
- return;
524
- }
525
- consoleSandbox(() => {
526
- global$6.console.error(`${PREFIX}[Error]:`, ...args);
531
+ else {
532
+ CONSOLE_LEVELS.forEach(name => {
533
+ logger[name] = () => undefined;
527
534
  });
528
535
  }
536
+ return logger;
529
537
  }
530
- const sentryGlobal = global$6.__SENTRY__ || {};
531
- const logger = sentryGlobal.logger || new Logger();
532
- {
533
- // Ensure we only have a single logger instance, even if multiple versions of @sentry/utils are being used
534
- sentryGlobal.logger = logger;
535
- global$6.__SENTRY__ = sentryGlobal;
538
+ // Ensure we only have a single logger instance, even if multiple versions of @sentry/utils are being used
539
+ let logger;
540
+ if (IS_DEBUG_BUILD$3) {
541
+ logger = getGlobalSingleton('logger', makeLogger);
542
+ }
543
+ else {
544
+ logger = makeLogger();
536
545
  }
537
546
 
538
547
  /**
@@ -2718,12 +2727,7 @@ var Sentry = (function (exports) {
2718
2727
  * Returns the global event processors.
2719
2728
  */
2720
2729
  function getGlobalEventProcessors() {
2721
- /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */
2722
- const global = getGlobalObject();
2723
- global.__SENTRY__ = global.__SENTRY__ || {};
2724
- global.__SENTRY__.globalEventProcessors = global.__SENTRY__.globalEventProcessors || [];
2725
- return global.__SENTRY__.globalEventProcessors;
2726
- /* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */
2730
+ return getGlobalSingleton('globalEventProcessors', () => []);
2727
2731
  }
2728
2732
  /**
2729
2733
  * Add a EventProcessor to be kept globally.
@@ -2843,6 +2847,22 @@ var Sentry = (function (exports) {
2843
2847
  }
2844
2848
  }
2845
2849
 
2850
+ /*
2851
+ * This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking
2852
+ * for users.
2853
+ *
2854
+ * Debug flags need to be declared in each package individually and must not be imported across package boundaries,
2855
+ * because some build tools have trouble tree-shaking imported guards.
2856
+ *
2857
+ * As a convention, we define debug flags in a `flags.ts` file in the root of a package's `src` folder.
2858
+ *
2859
+ * Debug flag files will contain "magic strings" like `true` that may get replaced with actual values during
2860
+ * our, or the user's build process. Take care when introducing new flags - they must not throw if they are not
2861
+ * replaced.
2862
+ */
2863
+ /** Flag that is true for debug builds, false otherwise. */
2864
+ const IS_DEBUG_BUILD$2 = true;
2865
+
2846
2866
  /**
2847
2867
  * API compatibility version of this hub.
2848
2868
  *
@@ -3115,7 +3135,7 @@ var Sentry = (function (exports) {
3115
3135
  return client.getIntegration(integration);
3116
3136
  }
3117
3137
  catch (_oO) {
3118
- logger.warn(`Cannot retrieve integration ${integration.id} from the current Hub`);
3138
+ IS_DEBUG_BUILD$2 && logger.warn(`Cannot retrieve integration ${integration.id} from the current Hub`);
3119
3139
  return null;
3120
3140
  }
3121
3141
  }
@@ -3226,7 +3246,7 @@ var Sentry = (function (exports) {
3226
3246
  if (sentry && sentry.extensions && typeof sentry.extensions[method] === 'function') {
3227
3247
  return sentry.extensions[method].apply(this, args);
3228
3248
  }
3229
- logger.warn(`Extension method ${method} couldn't be found, doing nothing.`);
3249
+ IS_DEBUG_BUILD$2 && logger.warn(`Extension method ${method} couldn't be found, doing nothing.`);
3230
3250
  }
3231
3251
  }
3232
3252
  /**
@@ -3286,11 +3306,7 @@ var Sentry = (function (exports) {
3286
3306
  * @hidden
3287
3307
  */
3288
3308
  function getHubFromCarrier(carrier) {
3289
- if (carrier && carrier.__SENTRY__ && carrier.__SENTRY__.hub)
3290
- return carrier.__SENTRY__.hub;
3291
- carrier.__SENTRY__ = carrier.__SENTRY__ || {};
3292
- carrier.__SENTRY__.hub = new Hub();
3293
- return carrier.__SENTRY__.hub;
3309
+ return getGlobalSingleton('hub', () => new Hub(), carrier);
3294
3310
  }
3295
3311
  /**
3296
3312
  * This will set passed {@link Hub} on the passed object's __SENTRY__.hub attribute
@@ -3301,8 +3317,8 @@ var Sentry = (function (exports) {
3301
3317
  function setHubOnCarrier(carrier, hub) {
3302
3318
  if (!carrier)
3303
3319
  return false;
3304
- carrier.__SENTRY__ = carrier.__SENTRY__ || {};
3305
- carrier.__SENTRY__.hub = hub;
3320
+ const __SENTRY__ = (carrier.__SENTRY__ = carrier.__SENTRY__ || {});
3321
+ __SENTRY__.hub = hub;
3306
3322
  return true;
3307
3323
  }
3308
3324
 
@@ -3544,6 +3560,22 @@ var Sentry = (function (exports) {
3544
3560
  return `${endpoint}?${encodedOptions}`;
3545
3561
  }
3546
3562
 
3563
+ /*
3564
+ * This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking
3565
+ * for users.
3566
+ *
3567
+ * Debug flags need to be declared in each package individually and must not be imported across package boundaries,
3568
+ * because some build tools have trouble tree-shaking imported guards.
3569
+ *
3570
+ * As a convention, we define debug flags in a `flags.ts` file in the root of a package's `src` folder.
3571
+ *
3572
+ * Debug flag files will contain "magic strings" like `true` that may get replaced with actual values during
3573
+ * our, or the user's build process. Take care when introducing new flags - they must not throw if they are not
3574
+ * replaced.
3575
+ */
3576
+ /** Flag that is true for debug builds, false otherwise. */
3577
+ const IS_DEBUG_BUILD$1 = true;
3578
+
3547
3579
  const installedIntegrations = [];
3548
3580
  /**
3549
3581
  * @private
@@ -3887,7 +3919,7 @@ var Sentry = (function (exports) {
3887
3919
  if (evt) {
3888
3920
  // TODO this is more of the hack trying to solve https://github.com/getsentry/sentry-javascript/issues/2809
3889
3921
  // it is only attached as extra data to the event if the event somehow skips being normalized
3890
- evt.sdkProcessingMetadata = Object.assign(Object.assign({}, evt.sdkProcessingMetadata), { normalizeDepth: normalize(normalizeDepth) });
3922
+ evt.sdkProcessingMetadata = Object.assign(Object.assign({}, evt.sdkProcessingMetadata), { normalizeDepth: `${normalize(normalizeDepth)} (${typeof normalizeDepth})` });
3891
3923
  }
3892
3924
  if (typeof normalizeDepth === 'number' && normalizeDepth > 0) {
3893
3925
  return this._normalizeEvent(evt, normalizeDepth, normalizeMaxBreadth);
@@ -4391,9 +4423,14 @@ var Sentry = (function (exports) {
4391
4423
  */
4392
4424
  function initAndBind(clientClass, options) {
4393
4425
  if (options.debug === true) {
4394
- {
4426
+ if (IS_DEBUG_BUILD$1) {
4395
4427
  logger.enable();
4396
4428
  }
4429
+ else {
4430
+ // use `console.warn` rather than `logger.warn` since by non-debug bundles have all `logger.x` statements stripped
4431
+ // eslint-disable-next-line no-console
4432
+ console.warn('[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.');
4433
+ }
4397
4434
  }
4398
4435
  const hub = getCurrentHub();
4399
4436
  const scope = hub.getScope();
@@ -4454,7 +4491,7 @@ var Sentry = (function (exports) {
4454
4491
  return `Too many ${category} requests, backing off until: ${new Date(disabledUntil(rateLimits, category)).toISOString()}`;
4455
4492
  }
4456
4493
 
4457
- const SDK_VERSION = '6.19.3';
4494
+ const SDK_VERSION = '6.19.6';
4458
4495
 
4459
4496
  let originalFunctionToString;
4460
4497
  /** Patch toString calls to return proper name for wrapped functions */
@@ -4548,19 +4585,23 @@ var Sentry = (function (exports) {
4548
4585
  /** JSDoc */
4549
4586
  function _shouldDropEvent$1(event, options) {
4550
4587
  if (options.ignoreInternal && _isSentryError(event)) {
4551
- logger.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${getEventDescription(event)}`);
4588
+ IS_DEBUG_BUILD$1 &&
4589
+ logger.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${getEventDescription(event)}`);
4552
4590
  return true;
4553
4591
  }
4554
4592
  if (_isIgnoredError(event, options.ignoreErrors)) {
4555
- logger.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${getEventDescription(event)}`);
4593
+ IS_DEBUG_BUILD$1 &&
4594
+ logger.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${getEventDescription(event)}`);
4556
4595
  return true;
4557
4596
  }
4558
4597
  if (_isDeniedUrl(event, options.denyUrls)) {
4559
- logger.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${getEventDescription(event)}.\nUrl: ${_getEventFilterUrl(event)}`);
4598
+ IS_DEBUG_BUILD$1 &&
4599
+ logger.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${getEventDescription(event)}.\nUrl: ${_getEventFilterUrl(event)}`);
4560
4600
  return true;
4561
4601
  }
4562
4602
  if (!_isAllowedUrl(event, options.allowUrls)) {
4563
- logger.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${getEventDescription(event)}.\nUrl: ${_getEventFilterUrl(event)}`);
4603
+ IS_DEBUG_BUILD$1 &&
4604
+ logger.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${getEventDescription(event)}.\nUrl: ${_getEventFilterUrl(event)}`);
4564
4605
  return true;
4565
4606
  }
4566
4607
  return false;
@@ -4597,7 +4638,7 @@ var Sentry = (function (exports) {
4597
4638
  return [`${value}`, `${type}: ${value}`];
4598
4639
  }
4599
4640
  catch (oO) {
4600
- logger.error(`Cannot extract message for event ${getEventDescription(event)}`);
4641
+ IS_DEBUG_BUILD$1 && logger.error(`Cannot extract message for event ${getEventDescription(event)}`);
4601
4642
  return [];
4602
4643
  }
4603
4644
  }
@@ -4639,7 +4680,7 @@ var Sentry = (function (exports) {
4639
4680
  return frames ? _getLastValidUrl(frames) : null;
4640
4681
  }
4641
4682
  catch (oO) {
4642
- logger.error(`Cannot extract url for event ${getEventDescription(event)}`);
4683
+ IS_DEBUG_BUILD$1 && logger.error(`Cannot extract url for event ${getEventDescription(event)}`);
4643
4684
  return null;
4644
4685
  }
4645
4686
  }
@@ -4979,6 +5020,22 @@ var Sentry = (function (exports) {
4979
5020
  return event;
4980
5021
  }
4981
5022
 
5023
+ /*
5024
+ * This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking
5025
+ * for users.
5026
+ *
5027
+ * Debug flags need to be declared in each package individually and must not be imported across package boundaries,
5028
+ * because some build tools have trouble tree-shaking imported guards.
5029
+ *
5030
+ * As a convention, we define debug flags in a `flags.ts` file in the root of a package's `src` folder.
5031
+ *
5032
+ * Debug flag files will contain "magic strings" like `true` that may get replaced with actual values during
5033
+ * our, or the user's build process. Take care when introducing new flags - they must not throw if they are not
5034
+ * replaced.
5035
+ */
5036
+ /** Flag that is true for debug builds, false otherwise. */
5037
+ const IS_DEBUG_BUILD = true;
5038
+
4982
5039
  const global$4 = getGlobalObject();
4983
5040
  let cachedFetchImpl;
4984
5041
  /**
@@ -5131,7 +5188,7 @@ var Sentry = (function (exports) {
5131
5188
  // A correct type for map-based implementation if we want to go that route
5132
5189
  // would be `Partial<Record<SentryRequestType, Partial<Record<Outcome, number>>>>`
5133
5190
  const key = `${requestTypeToCategory(category)}:${reason}`;
5134
- logger.log(`Adding outcome: ${key}`);
5191
+ IS_DEBUG_BUILD && logger.log(`Adding outcome: ${key}`);
5135
5192
  this._outcomes[key] = (_a = this._outcomes[key], (_a !== null && _a !== void 0 ? _a : 0)) + 1;
5136
5193
  }
5137
5194
  /**
@@ -5145,10 +5202,10 @@ var Sentry = (function (exports) {
5145
5202
  this._outcomes = {};
5146
5203
  // Nothing to send
5147
5204
  if (!Object.keys(outcomes).length) {
5148
- logger.log('No outcomes to flush');
5205
+ IS_DEBUG_BUILD && logger.log('No outcomes to flush');
5149
5206
  return;
5150
5207
  }
5151
- logger.log(`Flushing outcomes:\n${JSON.stringify(outcomes, null, 2)}`);
5208
+ IS_DEBUG_BUILD && logger.log(`Flushing outcomes:\n${JSON.stringify(outcomes, null, 2)}`);
5152
5209
  const url = getEnvelopeEndpointWithUrlEncodedAuth(this._api.dsn, this._api.tunnel);
5153
5210
  const discardedEvents = Object.keys(outcomes).map(key => {
5154
5211
  const [category, reason] = key.split(':');
@@ -5164,7 +5221,7 @@ var Sentry = (function (exports) {
5164
5221
  sendReport(url, serializeEnvelope(envelope));
5165
5222
  }
5166
5223
  catch (e) {
5167
- logger.error(e);
5224
+ IS_DEBUG_BUILD && logger.error(e);
5168
5225
  }
5169
5226
  }
5170
5227
  /**
@@ -5174,8 +5231,9 @@ var Sentry = (function (exports) {
5174
5231
  const status = eventStatusFromHttpCode(response.status);
5175
5232
  this._rateLimits = updateRateLimits(this._rateLimits, headers);
5176
5233
  // eslint-disable-next-line deprecation/deprecation
5177
- if (this._isRateLimited(requestType) && isDebugBuild()) {
5178
- // eslint-disable-next-line deprecation/deprecation
5234
+ if (this._isRateLimited(requestType)) {
5235
+ IS_DEBUG_BUILD &&
5236
+ // eslint-disable-next-line deprecation/deprecation
5179
5237
  logger.warn(`Too many ${requestType} requests, backing off until: ${this._disabledUntil(requestType)}`);
5180
5238
  }
5181
5239
  if (status === 'success') {
@@ -5564,11 +5622,11 @@ var Sentry = (function (exports) {
5564
5622
  return;
5565
5623
  }
5566
5624
  if (!options.eventId) {
5567
- logger.error('Missing eventId option in showReportDialog call');
5625
+ IS_DEBUG_BUILD && logger.error('Missing eventId option in showReportDialog call');
5568
5626
  return;
5569
5627
  }
5570
5628
  if (!options.dsn) {
5571
- logger.error('Missing dsn option in showReportDialog call');
5629
+ IS_DEBUG_BUILD && logger.error('Missing dsn option in showReportDialog call');
5572
5630
  return;
5573
5631
  }
5574
5632
  const script = global$2.document.createElement('script');
@@ -5760,7 +5818,7 @@ var Sentry = (function (exports) {
5760
5818
  return event;
5761
5819
  }
5762
5820
  function globalHandlerLog(type) {
5763
- logger.log(`Global Handler attached: ${type}`);
5821
+ IS_DEBUG_BUILD && logger.log(`Global Handler attached: ${type}`);
5764
5822
  }
5765
5823
  function addMechanismAndCapture(hub, error, event, type) {
5766
5824
  addExceptionMechanism(event, {
@@ -6326,7 +6384,7 @@ var Sentry = (function (exports) {
6326
6384
  // Juuust in case something goes wrong
6327
6385
  try {
6328
6386
  if (_shouldDropEvent(currentEvent, self._previousEvent)) {
6329
- logger.warn('Event dropped due to being a duplicate of previously captured event.');
6387
+ IS_DEBUG_BUILD && logger.warn('Event dropped due to being a duplicate of previously captured event.');
6330
6388
  return null;
6331
6389
  }
6332
6390
  }
@@ -6520,7 +6578,7 @@ var Sentry = (function (exports) {
6520
6578
  return;
6521
6579
  }
6522
6580
  if (!this._isEnabled()) {
6523
- logger.error('Trying to call showReportDialog with Sentry Client disabled');
6581
+ IS_DEBUG_BUILD && logger.error('Trying to call showReportDialog with Sentry Client disabled');
6524
6582
  return;
6525
6583
  }
6526
6584
  injectReportDialog(Object.assign(Object.assign({}, options), { dsn: options.dsn || this.getDsn() }));
@@ -6687,7 +6745,7 @@ var Sentry = (function (exports) {
6687
6745
  if (client) {
6688
6746
  return client.flush(timeout);
6689
6747
  }
6690
- logger.warn('Cannot flush events. No client defined.');
6748
+ IS_DEBUG_BUILD && logger.warn('Cannot flush events. No client defined.');
6691
6749
  return resolvedSyncPromise(false);
6692
6750
  }
6693
6751
  /**
@@ -6703,7 +6761,7 @@ var Sentry = (function (exports) {
6703
6761
  if (client) {
6704
6762
  return client.close(timeout);
6705
6763
  }
6706
- logger.warn('Cannot flush events and disable SDK. No client defined.');
6764
+ IS_DEBUG_BUILD && logger.warn('Cannot flush events and disable SDK. No client defined.');
6707
6765
  return resolvedSyncPromise(false);
6708
6766
  }
6709
6767
  /**
@@ -6728,7 +6786,7 @@ var Sentry = (function (exports) {
6728
6786
  const window = getGlobalObject();
6729
6787
  const document = window.document;
6730
6788
  if (typeof document === 'undefined') {
6731
- logger.warn('Session tracking in non-browser environment with @sentry/browser is not supported.');
6789
+ IS_DEBUG_BUILD && logger.warn('Session tracking in non-browser environment with @sentry/browser is not supported.');
6732
6790
  return;
6733
6791
  }
6734
6792
  const hub = getCurrentHub();