rollbar 3.0.0-alpha.3 → 3.0.0-alpha.5

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 (142) hide show
  1. package/.eslintrc +4 -6
  2. package/CONTRIBUTING.md +112 -0
  3. package/Gruntfile.cjs +7 -78
  4. package/README.md +48 -20
  5. package/bower.json +0 -1
  6. package/dist/rollbar.js +191 -879
  7. package/dist/rollbar.js.map +1 -1
  8. package/dist/rollbar.min.js +1 -1
  9. package/dist/rollbar.min.js.map +1 -1
  10. package/dist/rollbar.named-amd.js +191 -879
  11. package/dist/rollbar.named-amd.js.map +1 -1
  12. package/dist/rollbar.named-amd.min.js +1 -1
  13. package/dist/rollbar.named-amd.min.js.map +1 -1
  14. package/dist/rollbar.noconflict.umd.js +191 -879
  15. package/dist/rollbar.noconflict.umd.js.map +1 -1
  16. package/dist/rollbar.noconflict.umd.min.js +1 -1
  17. package/dist/rollbar.noconflict.umd.min.js.map +1 -1
  18. package/dist/rollbar.snippet.js +1 -1
  19. package/dist/rollbar.umd.js +191 -879
  20. package/dist/rollbar.umd.js.map +1 -1
  21. package/dist/rollbar.umd.min.js +1 -1
  22. package/dist/rollbar.umd.min.js.map +1 -1
  23. package/index.d.ts +1 -3
  24. package/karma.conf.cjs +5 -21
  25. package/package.json +28 -72
  26. package/src/browser/bundles/defaults.js +5 -0
  27. package/src/browser/bundles/rollbar.snippet.js +2 -2
  28. package/src/browser/core.d.ts +2 -2
  29. package/src/browser/core.js +8 -10
  30. package/src/browser/defaults.js +51 -0
  31. package/src/browser/plugins/jquery.js +1 -2
  32. package/src/browser/replay/defaults.js +2 -1
  33. package/src/browser/replay/recorder.d.ts +3 -3
  34. package/src/browser/replay/replayPredicates.js +96 -0
  35. package/src/browser/rollbar.js +0 -2
  36. package/src/browser/telemetry.d.ts +3 -3
  37. package/src/browser/wrapGlobals.d.ts +3 -3
  38. package/src/defaults.js +66 -7
  39. package/src/react-native/defaults.js +26 -0
  40. package/src/react-native/rollbar.js +8 -10
  41. package/src/rollbar.js +9 -13
  42. package/src/scrub.d.ts +3 -3
  43. package/src/server/defaults.js +19 -0
  44. package/src/server/rollbar.cjs +5 -0
  45. package/src/server/rollbar.js +7 -10
  46. package/src/telemetry.d.ts +3 -3
  47. package/src/tracing/tracing.d.ts +3 -3
  48. package/src/truncation.d.ts +3 -3
  49. package/src/utility.js +2 -48
  50. package/webpack.config.cjs +4 -17
  51. package/.cursor/rules/guidelines.mdc +0 -154
  52. package/.github/pull_request_template.md +0 -34
  53. package/.github/workflows/ci.yml +0 -57
  54. package/.github/workflows/workflow.yml +0 -21
  55. package/.vscode/settings.json +0 -39
  56. package/CLAUDE.md +0 -201
  57. package/codex.md +0 -148
  58. package/defaults.cjs +0 -29
  59. package/docs/extension-exceptions.md +0 -82
  60. package/docs/migration_v0_to_v1.md +0 -195
  61. package/src/browser/defaults/scrubFields.js +0 -59
  62. package/src/utility/polyfillJSON.d.ts +0 -5
  63. package/src/utility/polyfillJSON.js +0 -3
  64. package/test/api.test.js +0 -175
  65. package/test/apiUtility.test.js +0 -219
  66. package/test/browser.core.test.js +0 -646
  67. package/test/browser.domUtility.test.js +0 -209
  68. package/test/browser.predicates.test.js +0 -53
  69. package/test/browser.replay.recorder.test.js +0 -441
  70. package/test/browser.rollbar.test.js +0 -2146
  71. package/test/browser.telemetry.test.js +0 -76
  72. package/test/browser.transforms.test.js +0 -569
  73. package/test/browser.transport.test.js +0 -200
  74. package/test/browser.url.test.js +0 -121
  75. package/test/fixtures/locals.fixtures.js +0 -541
  76. package/test/fixtures/replay/index.js +0 -20
  77. package/test/fixtures/replay/payloads.fixtures.js +0 -229
  78. package/test/fixtures/replay/rrwebEvents.fixtures.js +0 -251
  79. package/test/fixtures/replay/rrwebSyntheticEvents.fixtures.js +0 -328
  80. package/test/fixtures/sourcemaps/node-dist/index.cjs +0 -13
  81. package/test/fixtures/sourcemaps/node-dist/index.cjs.map +0 -1
  82. package/test/fixtures/sourcemaps/node-typescript/dist/index.cjs +0 -13
  83. package/test/fixtures/sourcemaps/node-typescript/dist/index.cjs.map +0 -1
  84. package/test/fixtures/sourcemaps/node-typescript/package-lock.json +0 -19
  85. package/test/fixtures/sourcemaps/node-typescript/package.json +0 -20
  86. package/test/fixtures/sourcemaps/node-typescript/src/index.ts +0 -12
  87. package/test/fixtures/sourcemaps/node-typescript/tsconfig.json +0 -10
  88. package/test/notifier.test.js +0 -247
  89. package/test/predicates.test.js +0 -541
  90. package/test/queue.test.js +0 -633
  91. package/test/rateLimiter.test.js +0 -167
  92. package/test/react-native.rollbar.test.js +0 -650
  93. package/test/react-native.transforms.test.js +0 -71
  94. package/test/react-native.transport.test.js +0 -76
  95. package/test/replay/index.js +0 -2
  96. package/test/replay/integration/api.spans.test.js +0 -136
  97. package/test/replay/integration/e2e.test.js +0 -228
  98. package/test/replay/integration/index.js +0 -9
  99. package/test/replay/integration/queue.replayMap.test.js +0 -350
  100. package/test/replay/integration/replayMap.test.js +0 -163
  101. package/test/replay/integration/sessionRecording.test.js +0 -390
  102. package/test/replay/unit/api.postSpans.test.js +0 -149
  103. package/test/replay/unit/index.js +0 -7
  104. package/test/replay/unit/queue.replayMap.test.js +0 -223
  105. package/test/replay/unit/replayMap.test.js +0 -348
  106. package/test/replay/util/mockRecordFn.js +0 -80
  107. package/test/server.lambda.test.js +0 -172
  108. package/test/server.locals.constructor.test.js +0 -80
  109. package/test/server.locals.error-handling.test.js +0 -387
  110. package/test/server.locals.merge.test.js +0 -267
  111. package/test/server.locals.test-utils.mjs +0 -114
  112. package/test/server.parser.test.js +0 -87
  113. package/test/server.predicates.test.js +0 -63
  114. package/test/server.rollbar.constructor.test.js +0 -199
  115. package/test/server.rollbar.handlers.test.js +0 -253
  116. package/test/server.rollbar.logging.test.js +0 -326
  117. package/test/server.rollbar.misc.test.js +0 -44
  118. package/test/server.rollbar.test-utils.mjs +0 -57
  119. package/test/server.telemetry.test.js +0 -377
  120. package/test/server.transforms.data.test.js +0 -163
  121. package/test/server.transforms.error.test.js +0 -199
  122. package/test/server.transforms.request.test.js +0 -208
  123. package/test/server.transforms.scrub.test.js +0 -140
  124. package/test/server.transforms.sourcemaps.test.js +0 -122
  125. package/test/server.transforms.test-utils.mjs +0 -62
  126. package/test/server.transport.test.js +0 -269
  127. package/test/telemetry.test.js +0 -301
  128. package/test/tracing/contextManager.test.js +0 -28
  129. package/test/tracing/exporter.toPayload.test.js +0 -400
  130. package/test/tracing/id.test.js +0 -24
  131. package/test/tracing/span.test.js +0 -183
  132. package/test/tracing/spanProcessor.test.js +0 -73
  133. package/test/tracing/tracing.test.js +0 -112
  134. package/test/transforms.test.js +0 -265
  135. package/test/truncation.test.js +0 -235
  136. package/test/utility.test.js +0 -964
  137. package/vendor/JSON-js/README +0 -40
  138. package/vendor/JSON-js/cycle.js +0 -181
  139. package/vendor/JSON-js/json2.js +0 -499
  140. package/vendor/JSON-js/json3.js +0 -763
  141. package/vendor/JSON-js/json_parse.js +0 -356
  142. package/vendor/JSON-js/json_parse_state.js +0 -405
package/.eslintrc CHANGED
@@ -3,21 +3,19 @@
3
3
  "extends": "eslint:recommended",
4
4
  "parserOptions": {
5
5
  "ecmafeatures": {
6
- "modules": true
7
- }
6
+ "modules": true,
7
+ },
8
8
  },
9
9
  "env": {
10
10
  // I write for browser
11
11
  "browser": true,
12
12
  // in CommonJS
13
- "node": true
13
+ "node": true,
14
14
  },
15
- "plugins": [
16
- ],
17
15
  "globals": { "Promise": true },
18
16
  "rules": {
19
17
  "strict": 0,
20
- "camelcase": [2, {"properties": "never"}],
18
+ "camelcase": [2, { "properties": "never" }],
21
19
  "quotes": [2, "single", "avoid-escape"],
22
20
  "no-underscore-dangle": 0,
23
21
  "no-useless-escape": 0,
@@ -0,0 +1,112 @@
1
+ # Contributing to Rollbar.js
2
+
3
+ Thank you for your interest in contributing to Rollbar.js! We welcome contributions from the community.
4
+
5
+ ## Getting Started
6
+
7
+ ### Prerequisites
8
+
9
+ - Node.js version 18 or higher
10
+ - npm
11
+
12
+ ### Setup
13
+
14
+ 1. Fork the repository on GitHub
15
+ 2. Clone your fork locally:
16
+ ```bash
17
+ git clone https://github.com/your-username/rollbar.js.git
18
+ cd rollbar.js
19
+ ```
20
+ 3. Install dependencies:
21
+ ```bash
22
+ npm install
23
+ ```
24
+ 4. Build the project:
25
+ ```bash
26
+ npm run build
27
+ ```
28
+
29
+ ## Development Workflow
30
+
31
+ ### Running Tests
32
+
33
+ Run all tests:
34
+
35
+ ```bash
36
+ npm test
37
+ ```
38
+
39
+ Run only browser tests:
40
+
41
+ ```bash
42
+ npm run test-browser
43
+ ```
44
+
45
+ Run only server tests:
46
+
47
+ ```bash
48
+ npm run test-server
49
+ ```
50
+
51
+ ### Code Style
52
+
53
+ - We use ESLint for code quality. Run `npm run lint` before submitting
54
+ - Code should follow the existing style patterns in the codebase
55
+ - Use 2 spaces for indentation
56
+ - Use single quotes for strings
57
+
58
+ ### Making Changes
59
+
60
+ 1. Create a feature branch from `master`:
61
+
62
+ ```bash
63
+ git checkout -b my-feature-name
64
+ ```
65
+
66
+ 2. Make your changes and ensure:
67
+ - All tests pass
68
+ - Code follows our style guidelines
69
+ - New features include appropriate tests
70
+ - Documentation is updated if needed
71
+ - Examples are updated if needed
72
+
73
+ 3. Commit your changes with a clear message:
74
+ ```bash
75
+ git commit -m "Add feature: description of what you added"
76
+ ```
77
+
78
+ ## Submitting a Pull Request
79
+
80
+ 1. Push your changes to your fork:
81
+
82
+ ```bash
83
+ git push origin my-feature-name
84
+ ```
85
+
86
+ 2. Open a pull request on GitHub against the `master` branch
87
+
88
+ 3. In your pull request description:
89
+ - Clearly describe what changes you've made
90
+ - Reference any related issues
91
+ - Include testing steps if applicable
92
+
93
+ 4. Wait for review and address any feedback
94
+
95
+ ## Reporting Issues
96
+
97
+ - Use GitHub Issues to report bugs
98
+ - Include as much detail as possible:
99
+ - Steps to reproduce
100
+ - Expected behavior
101
+ - Actual behavior
102
+ - Environment details (browser, Node.js version, etc.)
103
+
104
+ ## Questions?
105
+
106
+ If you have questions, please:
107
+
108
+ - Check existing issues and documentation
109
+ - Open a GitHub issue for clarification
110
+ - Email support@rollbar.com for urgent matters
111
+
112
+ Thank you for contributing to Rollbar.js!
package/Gruntfile.cjs CHANGED
@@ -7,9 +7,6 @@
7
7
  var glob = require('glob');
8
8
  var path = require('path');
9
9
  var pkg = require('./package.json');
10
- var fs = require('fs');
11
-
12
- var webpackConfig = require('./webpack.config.cjs');
13
10
 
14
11
  function findTests(context) {
15
12
  if (context !== 'browser') {
@@ -60,6 +57,13 @@ function buildGruntKarmaConfig(singleRun, tests, reporters) {
60
57
  served: true,
61
58
  watched: false,
62
59
  },
60
+ // Test fixture HTML files
61
+ {
62
+ pattern: 'test/fixtures/**/*.html',
63
+ included: true,
64
+ served: true,
65
+ watched: false,
66
+ },
63
67
  ],
64
68
  },
65
69
  };
@@ -110,70 +114,12 @@ module.exports = function (grunt) {
110
114
  }
111
115
 
112
116
  grunt.loadNpmTasks('grunt-karma');
113
- grunt.loadNpmTasks('grunt-webpack');
114
- grunt.loadNpmTasks('grunt-text-replace');
115
-
116
- var rollbarJsSnippet = fs.readFileSync('dist/rollbar.snippet.js');
117
- var rollbarjQuerySnippet = fs.readFileSync('dist/plugins/jquery.min.js');
118
117
 
119
118
  grunt.initConfig({
120
119
  pkg: pkg,
121
- webpack: webpackConfig,
122
-
123
120
  karma: buildGruntKarmaConfig(singleRun, browserTests, reporters),
124
-
125
- replace: {
126
- snippets: {
127
- src: [
128
- '*.md',
129
- 'src/**/*.js',
130
- 'examples/*.+(html|js)',
131
- 'examples/*/*.+(html|js)',
132
- 'docs/**/*.md',
133
- ],
134
- overwrite: true,
135
- replacements: [
136
- // Main rollbar snippet
137
- {
138
- from: new RegExp(
139
- '^(.*// Rollbar Snippet)[\n\r]+(.*[\n\r])*(.*// End Rollbar Snippet)',
140
- 'm',
141
- ),
142
- to: function (match, index, fullText, captures) {
143
- captures[1] = rollbarJsSnippet;
144
- return captures.join('\n');
145
- },
146
- },
147
- // jQuery rollbar plugin snippet
148
- {
149
- from: new RegExp(
150
- '^(.*// Rollbar jQuery Snippet)[\n\r]+(.*[\n\r])*(.*// End Rollbar jQuery Snippet)',
151
- 'm',
152
- ),
153
- to: function (match, index, fullText, captures) {
154
- captures[1] = rollbarjQuerySnippet;
155
- return captures.join('\n');
156
- },
157
- },
158
- // README CI link
159
- {
160
- from: new RegExp(
161
- '(https://github\\.com/rollbar/rollbar\\.js/workflows/Rollbar\\.js%20CI/badge\\.svg\\?branch=v)([0-9a-zA-Z.-]+)',
162
- ),
163
- to: function (match, index, fullText, captures) {
164
- captures[1] = pkg.version;
165
- return captures.join('');
166
- },
167
- },
168
- ],
169
- },
170
- },
171
121
  });
172
-
173
- grunt.registerTask('build', ['webpack', 'replace:snippets']);
174
- grunt.registerTask('default', ['build']);
175
122
  grunt.registerTask('test', ['test-browser']);
176
- grunt.registerTask('release', ['build', 'copyrelease']);
177
123
 
178
124
  grunt.registerTask('test-browser', function (target) {
179
125
  var karmaTask = 'karma' + (target ? ':' + target : '');
@@ -236,21 +182,4 @@ module.exports = function (grunt) {
236
182
  grunt.task.run('karma:' + testName);
237
183
  });
238
184
  });
239
-
240
- grunt.registerTask('copyrelease', function createRelease() {
241
- var version = pkg.version;
242
- var builds = ['', '.umd'];
243
-
244
- builds.forEach(function (buildName) {
245
- var js = 'dist/rollbar' + buildName + '.js';
246
- var minJs = 'dist/rollbar' + buildName + '.min.js';
247
-
248
- var releaseJs = 'release/rollbar' + buildName + '-' + version + '.js';
249
- var releaseMinJs =
250
- 'release/rollbar' + buildName + '-' + version + '.min.js';
251
-
252
- grunt.file.copy(js, releaseJs);
253
- grunt.file.copy(minJs, releaseMinJs);
254
- });
255
- });
256
185
  };
package/README.md CHANGED
@@ -9,8 +9,8 @@
9
9
  </p>
10
10
 
11
11
  ![Build Status](https://github.com/rollbar/rollbar.js/workflows/Rollbar.js%20CI/badge.svg?tag=latest)
12
- [![Code Quality: Javascript](https://img.shields.io/lgtm/grade/javascript/g/rollbar/rollbar.js.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/rollbar/rollbar.js/context:javascript)
13
- [![Total Alerts](https://img.shields.io/lgtm/alerts/g/rollbar/rollbar.js.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/rollbar/rollbar.js/alerts)
12
+ [![npm version](https://img.shields.io/npm/v/rollbar.svg)](https://www.npmjs.com/package/rollbar)
13
+ [![npm downloads](https://img.shields.io/npm/dm/rollbar.svg)](https://www.npmjs.com/package/rollbar)
14
14
 
15
15
  ---
16
16
 
@@ -22,15 +22,56 @@
22
22
  - **Advanced search:** Filter items by many different properties. <a href="https://docs.rollbar.com/docs/search-items">Learn more about search</a>.
23
23
  - **Customizable notifications:** Rollbar supports several messaging and incident management tools where your team can get notified about errors and important events by real-time alerts. <a href="https://docs.rollbar.com/docs/notifications">Learn more about Rollbar notifications</a>.
24
24
 
25
- ## Setup Instructions
25
+ ## Installation
26
26
 
27
- 1. [Sign up for a Rollbar account](https://rollbar.com/signup).
28
- 2. For client-side Javascript, follow the [Browser Quick Start](https://docs.rollbar.com/docs/javascript#section-quick-start-browser) instructions. For Node.js, follow the [Server Quick Start](https://docs.rollbar.com/docs/javascript#section-quick-start-server).
27
+ Using npm:
28
+
29
+ ```bash
30
+ npm install --save rollbar
31
+ ```
32
+
33
+ Using yarn:
34
+
35
+ ```bash
36
+ yarn add rollbar
37
+ ```
38
+
39
+ For CDN/script tag installation, see [Quick Start → Browser](#browser)
40
+
41
+ ## Quick Start
42
+
43
+ First, [**sign up for a Rollbar account**](https://rollbar.com/signup) if you haven't already.
44
+
45
+ ### Browser
46
+
47
+ For the recommended snippet-based installation with automatic error capture and telemetry, see our [Browser JS – Quick Start documentation](https://docs.rollbar.com/docs/browser-js#quick-start).
48
+
49
+ ### Node.js
50
+
51
+ ```javascript
52
+ const Rollbar = require('rollbar');
53
+
54
+ const rollbar = new Rollbar({
55
+ accessToken: 'POST_SERVER_ITEM_ACCESS_TOKEN',
56
+ captureUncaught: true,
57
+ captureUnhandledRejections: true,
58
+ payload: { code_version: '1.0.0' },
59
+ });
60
+
61
+ // log a generic message and send to rollbar
62
+ rollbar.log('Hello world!');
63
+ ```
64
+
65
+ For **framework** integrations (**Express**, **Koa**, **Hapi**, and more), custom error handlers, and advanced configuration, see our [Node.js server configuration documentation](https://docs.rollbar.com/docs/nodejs#server-configuration).
29
66
 
30
67
  ## Usage and Reference
31
68
 
32
69
  For complete usage instructions and configuration reference, see our [Javascript SDK docs](https://docs.rollbar.com/docs/javascript).
33
70
 
71
+ ### Examples
72
+
73
+ See the [examples directory](./examples/) for detailed integration examples with various frameworks and build tools including **React**, **Angular**, **Vue.js**, **Next.js**, and more.
74
+
34
75
  ## Release History & Changelog
35
76
 
36
77
  See our [Releases](https://github.com/rollbar/rollbar.js/releases) page for a list of all releases, including changes.
@@ -41,19 +82,6 @@ If you run into any issues, please email us at [support@rollbar.com](mailto:supp
41
82
 
42
83
  For bug reports, please [open an issue on GitHub](https://github.com/rollbar/rollbar.js/issues/new).
43
84
 
44
- ## Developing
45
-
46
- To set up a development environment, you'll need Node.js and npm.
47
-
48
- 2. `npm install -D`
49
- 3. `make`
50
-
51
- To run the tests, run `make test`.
52
-
53
- ## Contributing
85
+ ## Developing and Contributing
54
86
 
55
- 1. [Fork it](https://github.com/rollbar/rollbar.js).
56
- 2. Create your feature branch (`git checkout -b my-new-feature`).
57
- 3. Commit your changes (`git commit -am 'Added some feature'`).
58
- 4. Push to the branch (`git push origin my-new-feature`).
59
- 5. Create a new Pull Request.
87
+ For development setup, guidelines, and instructions on submitting pull requests, please see our [Contributing Guide](CONTRIBUTING.md).
package/bower.json CHANGED
@@ -3,7 +3,6 @@
3
3
  "dependencies": {},
4
4
  "main": ["dist/rollbar.umd.js"],
5
5
  "ignore": [
6
- "dist/*.nojson*",
7
6
  "dist/*.named-amd*",
8
7
  "docs",
9
8
  "src",