rollbar 3.0.0-beta.5 → 3.0.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 (101) hide show
  1. package/.git-blame-ignore-revs +3 -1
  2. package/AGENTS.md +21 -0
  3. package/CONTRIBUTING.md +68 -73
  4. package/babel.config.json +7 -0
  5. package/bower.json +1 -1
  6. package/dist/plugins/jquery.min.js +1 -1
  7. package/dist/rollbar.cjs +2216 -2022
  8. package/dist/rollbar.js +6098 -5886
  9. package/dist/rollbar.js.map +1 -1
  10. package/dist/rollbar.min.cjs +1 -1
  11. package/dist/rollbar.min.cjs.LICENSE.txt +1 -1
  12. package/dist/rollbar.min.js +1 -1
  13. package/dist/rollbar.min.js.LICENSE.txt +1 -1
  14. package/dist/rollbar.min.js.map +1 -1
  15. package/dist/rollbar.named-amd.js +6097 -5886
  16. package/dist/rollbar.named-amd.js.map +1 -1
  17. package/dist/rollbar.named-amd.min.js +1 -1
  18. package/dist/rollbar.named-amd.min.js.LICENSE.txt +1 -1
  19. package/dist/rollbar.named-amd.min.js.map +1 -1
  20. package/dist/rollbar.noconflict.umd.js +6097 -5886
  21. package/dist/rollbar.noconflict.umd.js.map +1 -1
  22. package/dist/rollbar.noconflict.umd.min.js +1 -1
  23. package/dist/rollbar.noconflict.umd.min.js.LICENSE.txt +1 -1
  24. package/dist/rollbar.noconflict.umd.min.js.map +1 -1
  25. package/dist/rollbar.replay.js +8123 -7924
  26. package/dist/rollbar.replay.js.map +1 -1
  27. package/dist/rollbar.replay.min.js +1 -1
  28. package/dist/rollbar.replay.min.js.LICENSE.txt +1 -1
  29. package/dist/rollbar.replay.min.js.map +1 -1
  30. package/dist/rollbar.replay.noconflict.umd.js +8122 -7924
  31. package/dist/rollbar.replay.noconflict.umd.js.map +1 -1
  32. package/dist/rollbar.replay.noconflict.umd.min.js +1 -1
  33. package/dist/rollbar.replay.noconflict.umd.min.js.LICENSE.txt +1 -1
  34. package/dist/rollbar.replay.noconflict.umd.min.js.map +1 -1
  35. package/dist/rollbar.replay.umd.js +8122 -7924
  36. package/dist/rollbar.replay.umd.js.map +1 -1
  37. package/dist/rollbar.replay.umd.min.js +1 -1
  38. package/dist/rollbar.replay.umd.min.js.LICENSE.txt +1 -1
  39. package/dist/rollbar.replay.umd.min.js.map +1 -1
  40. package/dist/rollbar.snippet.js +1 -1
  41. package/dist/rollbar.umd.js +6097 -5886
  42. package/dist/rollbar.umd.js.map +1 -1
  43. package/dist/rollbar.umd.min.js +1 -1
  44. package/dist/rollbar.umd.min.js.LICENSE.txt +1 -1
  45. package/dist/rollbar.umd.min.js.map +1 -1
  46. package/eslint.config.js +151 -0
  47. package/index.d.ts +45 -13
  48. package/package.json +26 -6
  49. package/src/api.js +130 -136
  50. package/src/apiUtility.js +2 -2
  51. package/src/browser/bundles/rollbar.snippet.js +1 -0
  52. package/src/browser/core.js +31 -42
  53. package/src/browser/domUtility.js +11 -17
  54. package/src/browser/globalSetup.js +3 -3
  55. package/src/browser/replay/checkoutWatchdog.js +104 -0
  56. package/src/browser/replay/recorder.d.ts +5 -2
  57. package/src/browser/replay/recorder.js +22 -4
  58. package/src/browser/replay/replay.js +8 -4
  59. package/src/browser/replay/replayPredicates.js +1 -1
  60. package/src/browser/rollbar.js +5 -4
  61. package/src/browser/rollbarReplay.js +6 -5
  62. package/src/browser/rollbarWrapper.js +2 -2
  63. package/src/browser/shim.js +15 -15
  64. package/src/browser/telemetry.js +26 -22
  65. package/src/browser/transforms.js +4 -4
  66. package/src/browser/transport/xhr.js +4 -4
  67. package/src/browser/transport.js +9 -10
  68. package/src/browser/wrapGlobals.js +3 -4
  69. package/src/defaults.js +1 -1
  70. package/src/errorParser.js +1 -1
  71. package/src/logger.js +1 -0
  72. package/src/notifier.js +102 -100
  73. package/src/predicates.js +3 -4
  74. package/src/rateLimiter.js +107 -104
  75. package/src/react-native/rollbar.js +9 -10
  76. package/src/react-native/transforms.js +4 -5
  77. package/src/react-native/transport.js +7 -7
  78. package/src/rollbar.js +7 -4
  79. package/src/scrub.js +16 -20
  80. package/src/server/locals.js +7 -7
  81. package/src/server/parser.js +9 -6
  82. package/src/server/rollbar.js +54 -49
  83. package/src/server/sourceMap/stackTrace.js +7 -6
  84. package/src/server/telemetry/urlHelpers.js +2 -1
  85. package/src/server/telemetry.js +10 -10
  86. package/src/server/transforms.js +10 -6
  87. package/src/server/transport.js +8 -7
  88. package/src/telemetry.js +22 -25
  89. package/src/tracing/tracer.js +2 -2
  90. package/src/tracing/tracing.js +2 -2
  91. package/src/truncation.js +6 -6
  92. package/src/utility/headers.js +4 -2
  93. package/src/utility/traverse.js +1 -1
  94. package/src/utility.js +111 -33
  95. package/tsconfig.json +16 -0
  96. package/tsconfig.test.json +10 -0
  97. package/{web-test-runner.config.mjs → web-test-runner.config.js} +10 -0
  98. package/{webpack.config.cjs → webpack.config.js} +39 -27
  99. package/.eslintrc +0 -27
  100. package/eslint.config.mjs +0 -33
  101. package/src/merge.js +0 -61
@@ -1,108 +1,114 @@
1
- import * as _ from './utility.js';
2
-
3
1
  /*
4
- * RateLimiter - an object that encapsulates the logic for counting items sent to Rollbar
2
+ * RateLimiter - encapsulates the logic for counting items sent to Rollbar.
5
3
  *
6
4
  * @param options - the same options that are accepted by configureGlobal offered as a convenience
7
5
  */
8
- function RateLimiter(options) {
9
- this.startTime = _.now();
10
- this.counter = 0;
11
- this.perMinCounter = 0;
12
- this.platform = null;
13
- this.platformOptions = {};
14
- this.configureGlobal(options);
15
- }
16
-
17
- RateLimiter.globalSettings = {
18
- startTime: _.now(),
19
- maxItems: undefined,
20
- itemsPerMinute: undefined,
21
- };
6
+ class RateLimiter {
7
+ static globalSettings = {
8
+ startTime: Date.now(),
9
+ maxItems: undefined,
10
+ itemsPerMinute: undefined,
11
+ };
22
12
 
23
- /*
24
- * configureGlobal - set the global rate limiter options
25
- *
26
- * @param options - Only the following values are recognized:
27
- * startTime: a timestamp of the form returned by (new Date()).getTime()
28
- * maxItems: the maximum items
29
- * itemsPerMinute: the max number of items to send in a given minute
30
- */
31
- RateLimiter.prototype.configureGlobal = function (options) {
32
- if (options.startTime !== undefined) {
33
- RateLimiter.globalSettings.startTime = options.startTime;
34
- }
35
- if (options.maxItems !== undefined) {
36
- RateLimiter.globalSettings.maxItems = options.maxItems;
37
- }
38
- if (options.itemsPerMinute !== undefined) {
39
- RateLimiter.globalSettings.itemsPerMinute = options.itemsPerMinute;
13
+ constructor(options = {}) {
14
+ this.startTime = Date.now();
15
+ this.counter = 0;
16
+ this.perMinCounter = 0;
17
+ this.platform = null;
18
+ this.platformOptions = {};
19
+ this.configureGlobal(options);
40
20
  }
41
- };
42
21
 
43
- /*
44
- * shouldSend - determine if we should send a given item based on rate limit settings
45
- *
46
- * @param item - the item we are about to send
47
- * @returns An object with the following structure:
48
- * error: (Error|null)
49
- * shouldSend: bool
50
- * payload: (Object|null)
51
- * If shouldSend is false, the item passed as a parameter should not be sent to Rollbar, and
52
- * exactly one of error or payload will be non-null. If error is non-null, the returned Error will
53
- * describe the situation, but it means that we were already over a rate limit (either globally or
54
- * per minute) when this item was checked. If error is null, and therefore payload is non-null, it
55
- * means this item put us over the global rate limit and the payload should be sent to Rollbar in
56
- * place of the passed in item.
57
- */
58
- RateLimiter.prototype.shouldSend = function (item, now) {
59
- now = now || _.now();
60
- var elapsedTime = now - this.startTime;
61
- if (elapsedTime < 0 || elapsedTime >= 60000) {
62
- this.startTime = now;
63
- this.perMinCounter = 0;
22
+ /*
23
+ * configureGlobal - set the global rate limiter options
24
+ *
25
+ * @param options - Only the following values are recognized:
26
+ * startTime: a timestamp of the form returned by (new Date()).getTime()
27
+ * maxItems: the maximum items
28
+ * itemsPerMinute: the max number of items to send in a given minute
29
+ */
30
+ configureGlobal(options = {}) {
31
+ const { startTime, maxItems, itemsPerMinute } = options;
32
+
33
+ if (startTime !== undefined) {
34
+ RateLimiter.globalSettings.startTime = startTime;
35
+ }
36
+ if (maxItems !== undefined) {
37
+ RateLimiter.globalSettings.maxItems = maxItems;
38
+ }
39
+ if (itemsPerMinute !== undefined) {
40
+ RateLimiter.globalSettings.itemsPerMinute = itemsPerMinute;
41
+ }
64
42
  }
65
43
 
66
- var globalRateLimit = RateLimiter.globalSettings.maxItems;
67
- var globalRateLimitPerMin = RateLimiter.globalSettings.itemsPerMinute;
44
+ /*
45
+ * shouldSend - determine if we should send a given item based on rate limit settings
46
+ *
47
+ * @param item - the item we are about to send
48
+ * @returns An object with the following structure:
49
+ * error: (Error|null)
50
+ * shouldSend: bool
51
+ * payload: (Object|null)
52
+ * If shouldSend is false, the item passed as a parameter should not be sent to Rollbar, and
53
+ * exactly one of error or payload will be non-null. If error is non-null, the returned Error will
54
+ * describe the situation, but it means that we were already over a rate limit (either globally or
55
+ * per minute) when this item was checked. If error is null, and therefore payload is non-null, it
56
+ * means this item put us over the global rate limit and the payload should be sent to Rollbar in
57
+ * place of the passed in item.
58
+ */
59
+ shouldSend(item, now = Date.now()) {
60
+ const elapsedTime = now - this.startTime;
61
+ if (elapsedTime < 0 || elapsedTime >= 60000) {
62
+ this.startTime = now;
63
+ this.perMinCounter = 0;
64
+ }
65
+
66
+ const globalRateLimit = RateLimiter.globalSettings.maxItems;
67
+ const globalRateLimitPerMin = RateLimiter.globalSettings.itemsPerMinute;
68
+
69
+ if (checkRate(item, globalRateLimit, this.counter)) {
70
+ return shouldSendValue(
71
+ this.platform,
72
+ this.platformOptions,
73
+ `${globalRateLimit} max items reached`,
74
+ false,
75
+ );
76
+ }
77
+
78
+ if (checkRate(item, globalRateLimitPerMin, this.perMinCounter)) {
79
+ return shouldSendValue(
80
+ this.platform,
81
+ this.platformOptions,
82
+ `${globalRateLimitPerMin} items per minute reached`,
83
+ false,
84
+ );
85
+ }
86
+
87
+ this.counter += 1;
88
+ this.perMinCounter += 1;
89
+
90
+ const underGlobalLimit = !checkRate(item, globalRateLimit, this.counter);
91
+ const perMinute = underGlobalLimit;
92
+ const shouldSend =
93
+ underGlobalLimit &&
94
+ !checkRate(item, globalRateLimitPerMin, this.perMinCounter);
68
95
 
69
- if (checkRate(item, globalRateLimit, this.counter)) {
70
- return shouldSendValue(
71
- this.platform,
72
- this.platformOptions,
73
- globalRateLimit + ' max items reached',
74
- false,
75
- );
76
- } else if (checkRate(item, globalRateLimitPerMin, this.perMinCounter)) {
77
96
  return shouldSendValue(
78
97
  this.platform,
79
98
  this.platformOptions,
80
- globalRateLimitPerMin + ' items per minute reached',
81
- false,
99
+ null,
100
+ shouldSend,
101
+ globalRateLimit,
102
+ globalRateLimitPerMin,
103
+ perMinute,
82
104
  );
83
105
  }
84
- this.counter++;
85
- this.perMinCounter++;
86
-
87
- var shouldSend = !checkRate(item, globalRateLimit, this.counter);
88
- var perMinute = shouldSend;
89
- shouldSend =
90
- shouldSend && !checkRate(item, globalRateLimitPerMin, this.perMinCounter);
91
- return shouldSendValue(
92
- this.platform,
93
- this.platformOptions,
94
- null,
95
- shouldSend,
96
- globalRateLimit,
97
- globalRateLimitPerMin,
98
- perMinute,
99
- );
100
- };
101
-
102
- RateLimiter.prototype.setPlatformOptions = function (platform, options) {
103
- this.platform = platform;
104
- this.platformOptions = options;
105
- };
106
+
107
+ setPlatformOptions(platform, options) {
108
+ this.platform = platform;
109
+ this.platformOptions = options;
110
+ }
111
+ }
106
112
 
107
113
  /* Helpers */
108
114
 
@@ -119,11 +125,10 @@ function shouldSendValue(
119
125
  limitPerMin,
120
126
  perMinute,
121
127
  ) {
122
- var payload = null;
123
- if (error) {
124
- error = new Error(error);
125
- }
126
- if (!error && !shouldSend) {
128
+ let payload = null;
129
+ const errorResult = error ? new Error(error) : null;
130
+
131
+ if (!errorResult && !shouldSend) {
127
132
  payload = rateLimitPayload(
128
133
  platform,
129
134
  options,
@@ -132,7 +137,8 @@ function shouldSendValue(
132
137
  perMinute,
133
138
  );
134
139
  }
135
- return { error: error, shouldSend: shouldSend, payload: payload };
140
+
141
+ return { error: errorResult, shouldSend, payload };
136
142
  }
137
143
 
138
144
  function rateLimitPayload(
@@ -142,15 +148,12 @@ function rateLimitPayload(
142
148
  limitPerMin,
143
149
  perMinute,
144
150
  ) {
145
- var environment =
151
+ const environment =
146
152
  options.environment || (options.payload && options.payload.environment);
147
- var msg;
148
- if (perMinute) {
149
- msg = 'item per minute limit reached, ignoring errors until timeout';
150
- } else {
151
- msg = 'maxItems has been hit, ignoring errors until reset.';
152
- }
153
- var item = {
153
+ const msg = perMinute
154
+ ? 'item per minute limit reached, ignoring errors until timeout'
155
+ : 'maxItems has been hit, ignoring errors until reset.';
156
+ const item = {
154
157
  body: {
155
158
  message: {
156
159
  body: msg,
@@ -1,18 +1,17 @@
1
- import Client from '../rollbar.js';
2
- import * as _ from '../utility.js';
3
1
  import API from '../api.js';
4
- import logger from '../logger.js';
5
- import * as rnDefaults from './defaults.js';
6
- import { version, reportLevel } from '../defaults.js';
7
-
8
- import Transport from './transport.js';
9
2
  import * as urllib from '../browser/url.js';
10
-
3
+ import { version, reportLevel } from '../defaults.js';
4
+ import logger from '../logger.js';
5
+ import * as sharedPredicates from '../predicates.js';
6
+ import Client from '../rollbar.js';
11
7
  import Telemeter from '../telemetry.js';
12
- import * as transforms from './transforms.js';
13
8
  import * as sharedTransforms from '../transforms.js';
14
- import * as sharedPredicates from '../predicates.js';
15
9
  import truncation from '../truncation.js';
10
+ import * as _ from '../utility.js';
11
+
12
+ import * as rnDefaults from './defaults.js';
13
+ import * as transforms from './transforms.js';
14
+ import Transport from './transport.js';
16
15
 
17
16
  function Rollbar(options, client) {
18
17
  if (_.isType(options, 'string')) {
@@ -1,6 +1,6 @@
1
- import * as _ from '../utility.js';
2
- import scrub from '../scrub.js';
3
1
  import errorParser from '../errorParser.js';
2
+ import scrub from '../scrub.js';
3
+ import * as _ from '../utility.js';
4
4
 
5
5
  function baseData(item, options, callback) {
6
6
  var environment =
@@ -25,7 +25,7 @@ function baseData(item, options, callback) {
25
25
 
26
26
  var props = Object.getOwnPropertyNames(item.custom || {});
27
27
  props.forEach(function (name) {
28
- if (!data.hasOwnProperty(name)) {
28
+ if (!_.hasOwn(data, name)) {
29
29
  data[name] = item.custom[name];
30
30
  }
31
31
  });
@@ -115,8 +115,7 @@ function _buildFrames(stack, options) {
115
115
  }
116
116
 
117
117
  var frames = [];
118
- for (var i = 0; i < stack.length; ++i) {
119
- var stackFrame = stack[i];
118
+ for (const stackFrame of stack) {
120
119
  var filename = stackFrame.url ? _.sanitizeUrl(stackFrame.url) : '<unknown>';
121
120
  var frame = {
122
121
  filename: _rewriteFilename(filename, options),
@@ -1,8 +1,8 @@
1
- import * as _ from '../utility.js';
2
- import logger from '../logger.js';
3
-
4
1
  import { Buffer } from 'buffer/';
5
2
 
3
+ import logger from '../logger.js';
4
+ import * as _ from '../utility.js';
5
+
6
6
  function Transport(truncation) {
7
7
  this.rateLimitExpires = 0;
8
8
  this.truncation = truncation;
@@ -10,7 +10,7 @@ function Transport(truncation) {
10
10
 
11
11
  Transport.prototype.get = function (accessToken, options, params, callback) {
12
12
  if (!callback || !_.isFunction(callback)) {
13
- callback = function () {};
13
+ callback = () => {};
14
14
  }
15
15
  options = options || {};
16
16
  _.addParamsAndAccessTokenToPath(accessToken, options, params);
@@ -29,7 +29,7 @@ Transport.prototype.get = function (accessToken, options, params, callback) {
29
29
 
30
30
  Transport.prototype.post = function (accessToken, options, payload, callback) {
31
31
  if (!callback || !_.isFunction(callback)) {
32
- callback = function () {};
32
+ callback = () => {};
33
33
  }
34
34
  options = options || {};
35
35
  if (!payload) {
@@ -59,7 +59,7 @@ Transport.prototype.postJsonPayload = function (
59
59
  callback,
60
60
  ) {
61
61
  if (!callback || !_.isFunction(callback)) {
62
- callback = function () {};
62
+ callback = () => {};
63
63
  }
64
64
  options = options || {};
65
65
  if (!jsonPayload) {
@@ -95,7 +95,7 @@ function _headers(accessToken, options, data) {
95
95
  if (data) {
96
96
  try {
97
97
  headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
98
- } catch (e) {
98
+ } catch (_e) {
99
99
  logger.error('Could not get the content length of the data');
100
100
  }
101
101
  }
package/src/rollbar.js CHANGED
@@ -1,6 +1,6 @@
1
- import RateLimiter from './rateLimiter.js';
2
- import Queue from './queue.js';
3
1
  import Notifier from './notifier.js';
2
+ import Queue from './queue.js';
3
+ import RateLimiter from './rateLimiter.js';
4
4
  import * as _ from './utility.js';
5
5
 
6
6
  /*
@@ -162,7 +162,7 @@ Rollbar.prototype._log = function (defaultLevel, item) {
162
162
  try {
163
163
  item.level = item.level || defaultLevel;
164
164
 
165
- this._addTracingAttributes(item);
165
+ this._addItemAttributes(item);
166
166
 
167
167
  // Legacy OpenTracing support
168
168
  this._addTracingInfo(item);
@@ -182,7 +182,7 @@ Rollbar.prototype._log = function (defaultLevel, item) {
182
182
  }
183
183
  };
184
184
 
185
- Rollbar.prototype._addTracingAttributes = function (item) {
185
+ Rollbar.prototype._addItemAttributes = function (item) {
186
186
  const span = this.tracing?.getSpan();
187
187
 
188
188
  const attributes = [
@@ -190,6 +190,9 @@ Rollbar.prototype._addTracingAttributes = function (item) {
190
190
  { key: 'span_id', value: span?.spanId },
191
191
  { key: 'trace_id', value: span?.traceId },
192
192
  ];
193
+ if (item._isUncaught) {
194
+ attributes.push({ key: 'is_uncaught', value: 'true' });
195
+ }
193
196
  _.addItemAttributes(item.data, attributes);
194
197
 
195
198
  span?.addEvent('rollbar.occurrence', [
package/src/scrub.js CHANGED
@@ -1,12 +1,12 @@
1
- import * as _ from './utility.js';
2
1
  import traverse from './utility/traverse.js';
2
+ import * as _ from './utility.js';
3
3
 
4
4
  function scrub(data, scrubFields, scrubPaths) {
5
5
  scrubFields = scrubFields || [];
6
6
 
7
7
  if (scrubPaths) {
8
- for (var i = 0; i < scrubPaths.length; ++i) {
9
- scrubPath(data, scrubPaths[i]);
8
+ for (const path of scrubPaths) {
9
+ scrubPath(data, path);
10
10
  }
11
11
  }
12
12
 
@@ -18,19 +18,17 @@ function scrub(data, scrubFields, scrubPaths) {
18
18
  }
19
19
 
20
20
  function paramScrubber(v) {
21
- var i;
22
21
  if (_.isType(v, 'string')) {
23
- for (i = 0; i < queryRes.length; ++i) {
24
- v = v.replace(queryRes[i], redactQueryParam);
22
+ for (const regex of queryRes) {
23
+ v = v.replace(regex, redactQueryParam);
25
24
  }
26
25
  }
27
26
  return v;
28
27
  }
29
28
 
30
29
  function valScrubber(k, v) {
31
- var i;
32
- for (i = 0; i < paramRes.length; ++i) {
33
- if (paramRes[i].test(k)) {
30
+ for (const regex of paramRes) {
31
+ if (regex.test(k)) {
34
32
  v = _.redact();
35
33
  break;
36
34
  }
@@ -57,23 +55,22 @@ function scrubPath(obj, path) {
57
55
  var keys = path.split('.');
58
56
  var last = keys.length - 1;
59
57
  try {
60
- for (var i = 0; i <= last; ++i) {
61
- if (i < last) {
62
- obj = obj[keys[i]];
58
+ for (const [index, key] of keys.entries()) {
59
+ if (index < last) {
60
+ obj = obj[key];
63
61
  } else {
64
- obj[keys[i]] = _.redact();
62
+ obj[key] = _.redact();
65
63
  }
66
64
  }
67
- } catch (e) {
65
+ } catch (_e) {
68
66
  // Missing key is OK;
69
67
  }
70
68
  }
71
69
 
72
70
  function _getScrubFieldRegexs(scrubFields) {
73
71
  var ret = [];
74
- var pat;
75
- for (var i = 0; i < scrubFields.length; ++i) {
76
- pat = '^\\[?(%5[bB])?' + scrubFields[i] + '\\[?(%5[bB])?\\]?(%5[dD])?$';
72
+ for (const field of scrubFields) {
73
+ var pat = '^\\[?(%5[bB])?' + field + '\\[?(%5[bB])?\\]?(%5[dD])?$';
77
74
  ret.push(new RegExp(pat, 'i'));
78
75
  }
79
76
  return ret;
@@ -81,9 +78,8 @@ function _getScrubFieldRegexs(scrubFields) {
81
78
 
82
79
  function _getScrubQueryParamRegexs(scrubFields) {
83
80
  var ret = [];
84
- var pat;
85
- for (var i = 0; i < scrubFields.length; ++i) {
86
- pat = '\\[?(%5[bB])?' + scrubFields[i] + '\\[?(%5[bB])?\\]?(%5[dD])?';
81
+ for (const field of scrubFields) {
82
+ var pat = '\\[?(%5[bB])?' + field + '\\[?(%5[bB])?\\]?(%5[dD])?';
87
83
  ret.push(new RegExp('(' + pat + '=)([^&\\n]+)', 'igm'));
88
84
  }
89
85
  return ret;
@@ -1,6 +1,7 @@
1
- /* globals Map */
2
1
  import inspector from 'inspector';
2
+
3
3
  import async from 'async';
4
+
4
5
  import * as _ from '../utility.js';
5
6
 
6
7
  // It's helpful to have default limits, as the data expands quickly in real environments.
@@ -41,7 +42,7 @@ Locals.prototype.initSession = function () {
41
42
  Locals.currentErrors = new Map();
42
43
 
43
44
  Locals.session.on('Debugger.paused', ({ params }) => {
44
- if (params.reason == 'promiseRejection' || params.reason == 'exception') {
45
+ if (params.reason === 'promiseRejection' || params.reason === 'exception') {
45
46
  var key = params.data.description;
46
47
  Locals.currentErrors.set(key, params);
47
48
 
@@ -57,10 +58,9 @@ Locals.prototype.initSession = function () {
57
58
  }
58
59
  });
59
60
 
60
- var self = this;
61
61
  Locals.session.post('Debugger.enable', (_err, _result) => {
62
- self.initialized = true;
63
- updatePauseState(self.options, self.logger);
62
+ this.initialized = true;
63
+ updatePauseState(this.options, this.logger);
64
64
  });
65
65
  };
66
66
 
@@ -74,8 +74,8 @@ Locals.prototype.disconnectSession = function () {
74
74
 
75
75
  Locals.prototype.updateOptions = function (options) {
76
76
  var pauseStateChanged =
77
- this.options.enabled != options.enabled ||
78
- this.options.uncaughtOnly != options.uncaughtOnly;
77
+ this.options.enabled !== options.enabled ||
78
+ this.options.uncaughtOnly !== options.uncaughtOnly;
79
79
 
80
80
  this.options = _.merge(this.options, options);
81
81
 
@@ -1,8 +1,11 @@
1
- import logger from '../logger.js';
2
- import async from 'async';
3
1
  import fs from 'fs';
4
- import lru from 'lru-cache';
5
2
  import util from 'util';
3
+
4
+ import async from 'async';
5
+ import lru from 'lru-cache';
6
+
7
+ import logger from '../logger.js';
8
+
6
9
  import * as stackTrace from './sourceMap/stackTrace.js';
7
10
 
8
11
  var linesOfContext = 3;
@@ -186,8 +189,8 @@ function shouldReadFrameFile(frameFilename, callback) {
186
189
  var isValidFilename, isCached, isPending;
187
190
 
188
191
  isValidFilename = frameFilename[0] === '/' || frameFilename[0] === '.';
189
- isCached = !!cache.get(frameFilename);
190
- isPending = !!pendingReads[frameFilename];
192
+ isCached = Boolean(cache.get(frameFilename));
193
+ isPending = Boolean(pendingReads[frameFilename]);
191
194
 
192
195
  callback(null, isValidFilename && !isCached && !isPending);
193
196
  }
@@ -382,7 +385,7 @@ export function parseStack(stack, options, item, callback) {
382
385
  async.filter(
383
386
  frames,
384
387
  function (frame, callback) {
385
- callback(null, !!frame);
388
+ callback(null, Boolean(frame));
386
389
  },
387
390
  function (err, results) {
388
391
  if (err) return callback(err);