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,2 +1,4 @@
1
- # Prettier mass-format
1
+ # 10/07/2025 | Format codebase with prettier, excluding examples (#1349)
2
2
  7a829f8ac3bbd146425a401b8434cf9cbaddaba1
3
+ # 03/07/2024 | Integrate prettier to the project and ci and prettify project (#1133)
4
+ 443290f2a2f3bb7640cd3383dd95dea872773508
package/AGENTS.md ADDED
@@ -0,0 +1,21 @@
1
+ # Repository Guidelines
2
+
3
+ ## Project Structure & Module Organization
4
+
5
+ Rollbar.js is the cross-platform SDK for Rollbar error monitoring. Browser runtime code sits in `src/browser/`, Node handlers in `src/server/`, React Native-specific modules in `src/react-native/`, and shared systems in `src/tracing/`, `src/telemetry.*`, and `src/utility/`. Public entry points flow through `src/rollbar.js` into bundled artifacts under `dist/` (do not edit generated files). Type definitions live in `index.d.ts`. Integration examples and docs are in `examples/` and `docs/`, while CLI helpers and release scripts live under `scripts/`. Tests mirror the source layout inside `test/`, with replay-focused coverage in `test/replay/`.
6
+
7
+ ## Build, Test, and Development Commands
8
+
9
+ Use `npm run build` for production bundles and `npm run build:dev` during debugging. `npm test` executes both browser (Web Test Runner) and server (Mocha) suites; target subsets via `npm run test:wtr`, `npm run test:wtr:watch`, or `npm run test:server`. Lint with `npm run lint`, and rely on `npm run format` / `npm run format:check` for Prettier parity. Before publishing, run `npm run validate` to enforce ES5 compatibility and verify example snippets, then package distributables with `npm run pack`.
10
+
11
+ ## Coding Style & Naming Conventions
12
+
13
+ This repo is an ES module project (`package.json` sets `"type": "module"`). ESLint rules in `eslint.config.js` enforce 2-space indentation, single quotes (via Prettier), `no-console` outside `scripts/`, maximum cyclomatic complexity of 35, and grouped alphabetized imports. The `unused-imports` plugin must leave files warning-free. Prefer PascalCase for exported classes or constructors, camelCase for functions and variables, and keep side-effect files named `<feature>.js` or `<feature>.cjs` to match existing patterns.
14
+
15
+ ## Testing Guidelines
16
+
17
+ Author browser-facing specs under `test/browser.*.test.js` and Node scenarios under `test/server.*.test.js`. Session replay code should carry dedicated unit and integration coverage in `test/replay/**`. Tests use Mocha with Chai assertions and Sinon stubs. Add fixtures in `test/fixtures/` when mocking rrweb payloads or HTTP exchanges. Ensure `npm test` and `npm run validate:es5` succeed before opening a PR, especially after touching bundling or transport logic.
18
+
19
+ ## Commit & Pull Request Guidelines
20
+
21
+ Follow the existing history by writing imperative, present-tense commit messages (e.g., `Add import linting guard (#1410)`). Each PR should summarize behavior changes, call out linked issues, and include test evidence or reproduction steps. Update relevant docs (`docs/`, `examples/`, `README.md`) for public-facing changes, avoid leaving TODOs, and surface any follow-up work in the PR description rather than the code. For security-sensitive fixes, coordinate disclosure via `SECURITY.md` instructions before merging.
package/CONTRIBUTING.md CHANGED
@@ -1,112 +1,107 @@
1
1
  # Contributing to Rollbar.js
2
2
 
3
- Thank you for your interest in contributing to Rollbar.js! We welcome contributions from the community.
3
+ Thanks for helping Rollbar.js! Whether you are polishing docs, reporting a bug, adding a framework example, or enhancing SDK features, your contribution matters. This SDK ships in mission-critical environments, so we lean on automation: tests, linting, formatting. That keeps changes low-risk while keeping the process open and welcoming. Jump in wherever you feel inspired and ask questions early and often.
4
4
 
5
- ## Getting Started
5
+ Rollbar.js is also AI-coding-agent ready: `AGENTS.md` documents Codex-specific guidelines and `CLAUDE.md` covers Claude’s conventions so automated assistants can operate safely alongside humans. Feel free to point AI tools at these docs when co-authoring patches.
6
6
 
7
- ### Prerequisites
7
+ ## Ways to contribute
8
8
 
9
- - Node.js version 18 or higher
10
- - npm
9
+ - Improve docs, READMEs, or examples to make Rollbar easier to adopt
10
+ - Reproduce and fix bugs across browsers, Node, or React Native
11
+ - Add tests, new features, or quality-of-life improvements
12
+ - Share integration snippets, tutorials, or demo apps
11
13
 
12
- ### Setup
14
+ If you are unsure where to start, browse the GitHub issues page (<https://github.com/rollbar/rollbar.js/issues>) or open an issue/discussion, and maintainers can help scope a task that fits your interests.
13
15
 
14
- 1. Fork the repository on GitHub
15
- 2. Clone your fork locally:
16
+ ## Quick start
17
+
18
+ **Prerequisites**
19
+
20
+ - Node.js 18+ and npm 9+
21
+ - A GitHub fork or branch you can push to
22
+
23
+ **Setup**
24
+
25
+ 1. Fork the repository and clone your fork:
16
26
  ```bash
17
- git clone https://github.com/your-username/rollbar.js.git
27
+ git clone https://github.com/<your-username>/rollbar.js.git
18
28
  cd rollbar.js
19
29
  ```
20
- 3. Install dependencies:
30
+ 2. Install dependencies:
21
31
  ```bash
22
32
  npm install
23
33
  ```
24
- 4. Build the project:
34
+ 3. (Optional) Verify the baseline:
25
35
  ```bash
26
- npm run build
36
+ npm run build:dev
37
+ npm test
27
38
  ```
28
39
 
29
- ## Development Workflow
40
+ Keep branches focused on a single improvement. CI reruns the full suite on every push, so you can rely on it while iterating.
30
41
 
31
- ### Running Tests
42
+ ## Local development workflow
32
43
 
33
- Run all tests:
44
+ ### Linting and autofixes
34
45
 
35
- ```bash
36
- npm test
37
- ```
46
+ - `npm run lint` checks the entire repo with ESLint’s flat config.
47
+ - `npm run lint:fix` runs ESLint with `--fix`. Run this before every commit so import ordering, unused variables, and other autofixable issues are taken care of automatically.
38
48
 
39
- Run only browser tests:
49
+ ### Formatting
40
50
 
41
- ```bash
42
- npm run test-browser
43
- ```
51
+ - `npm run format` applies Prettier to JavaScript, configs, Markdown, JSON, and YAML. Run it before committing; it is safe to run repeatedly.
52
+ - `npm run format:check` is the read-only version CI uses. Use it locally when you want to double-check a patch without mutating files.
44
53
 
45
- Run only server tests:
54
+ ### Tests
46
55
 
47
- ```bash
48
- npm run test-server
49
- ```
56
+ - `npm test` runs both browser (`npm run test:wtr`) and server (`npm run test:server`) suites.
57
+ - `npm run typecheck` runs the TypeScript pass (via `tsconfig.test.json`) so TS-based tests surface declaration mismatches early.
58
+ - Scope runs as needed:
59
+ - `npm run test:wtr -- --watch` for browser tests with live reload.
60
+ - `npm run test:server test/server.my-feature.test.{js,ts}` to focus on one file.
61
+ - `npm run validate` executes ES5 compatibility and example snippets. Use it when touching bundling, transports, or documentation code.
50
62
 
51
- ### Code Style
63
+ ### Builds
52
64
 
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
65
+ - `npm run build:dev` compiles bundles in development mode (faster debug cycle).
66
+ - `npm run build` + `npm run postbuild` mirrors the release pipeline; only run this when you need to inspect distributables.
57
67
 
58
- ### Making Changes
68
+ ## Code style philosophy
59
69
 
60
- 1. Create a feature branch from `master`:
70
+ - Prettier defines whitespace, quotes, and wrapping. Never hand-format files.
71
+ - ESLint (with `unused-imports`, `no-console`, etc.) enforces correctness. Let the tools win; rerun `npm run lint:fix && npm run format` if your editor disagrees.
72
+ - Prefer small, incremental commits that respect the SDK’s ES module architecture and multi-platform outputs. Automation keeps everyone aligned, so let the tools guide you instead of enforcing personal style.
61
73
 
62
- ```bash
63
- git checkout -b my-feature-name
64
- ```
74
+ ## Pull request checklist
65
75
 
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
76
+ Before opening or updating a PR:
72
77
 
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
- ```
78
+ - `npm run lint:fix` and `npm run format`
79
+ - `npm test` (plus any focused suites you touched)
80
+ - `npm run validate` when build outputs, transports, or examples change
81
+ - Update docs (`README.md`, `docs/`, `examples/`) for user-facing behavior
82
+ - Document risk, testing evidence, and follow-ups in the PR description
83
+ - Reference related issues and describe the user benefit in plain language
85
84
 
86
- 2. Open a pull request on GitHub against the `master` branch
85
+ CI re-runs lint (`--max-warnings 0`), `format:check`, tests, and ES5/example validation on every push, so if something slips through locally it will be caught automatically, and there is no need to stress.
87
86
 
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
87
+ ## Troubleshooting linting & formatting
92
88
 
93
- 4. Wait for review and address any feedback
89
+ - **ESLint cannot find a plugin**: run `npm install` to ensure devDependencies are installed; the flat config loads plugins via native `import`, so Node 18+ is required.
90
+ - **`unused-imports` keeps flagging helper params**: delete the import or prefix intentional unused params with `_` (e.g., `_req`) and rerun `npm run lint:fix`.
91
+ - **Prettier rewrites the entire file**: confirm you are using the repo’s pinned Prettier version (`npm run format` handles it) or format just the file you touched (`npm run format -- src/foo.js`).
92
+ - **CI fails `format:check` but local format looks fine**: make sure your editor isn’t stripping trailing newlines or converting line endings; set `git config core.autocrlf false` (Unix) or `true` (Windows) and format again.
93
+ - **`eslint` reports “Parsing error: Cannot find module”**: ensure every import has a `.js` extension because Rollbar.js is pure ESM, and missing extensions break the parser.
94
94
 
95
- ## Reporting Issues
95
+ Still stuck? Open a draft PR, start a GitHub Discussion, or tag maintainers in an issue; we’re happy to help.
96
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.)
97
+ ## Continuous integration expectations
103
98
 
104
- ## Questions?
99
+ GitHub Actions runs lint, `format:check`, browser/server tests, ES5 validation, and documentation snippet checks on every PR. Hooks are optional; CI is the enforcer so you can iterate locally without fear. Keep patches scoped, trust the automation, and explain what you validated in your PR body.
105
100
 
106
- If you have questions, please:
101
+ ## Need help?
107
102
 
108
- - Check existing issues and documentation
109
- - Open a GitHub issue for clarification
110
- - Email support@rollbar.com for urgent matters
103
+ - Start a GitHub Discussion or issue for questions and feature ideas.
104
+ - For security-sensitive findings, follow `SECURITY.md`.
105
+ - Unsure where to contribute? Browse open GitHub issues or start a discussion describing what excites you, and maintainers will help scope the work.
111
106
 
112
- Thank you for contributing to Rollbar.js!
107
+ Thanks again for partnering with us to improve Rollbar.js!
package/babel.config.json CHANGED
@@ -12,6 +12,13 @@
12
12
  "ie": "11"
13
13
  }
14
14
  }
15
+ ],
16
+ [
17
+ "@babel/preset-typescript",
18
+ {
19
+ "allowDeclareFields": true,
20
+ "onlyRemoveTypeImports": true
21
+ }
15
22
  ]
16
23
  ]
17
24
  }
package/bower.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "Makefile",
19
19
  "travis.yml",
20
20
  "package.json",
21
- "webpack.config.cjs",
21
+ "webpack.config.js",
22
22
  "browserstack*"
23
23
  ]
24
24
  }
@@ -1 +1 @@
1
- !function(){"use strict";!function(r,n,t){var e=n.Rollbar;if(e){e.configure({payload:{notifier:{plugins:{jquery:{version:"0.0.8"}}}}});var a=function(r){if(e.error(r),n.console){var t="[reported to Rollbar]";e.options&&!e.options.enabled&&(t="[Rollbar not enabled]"),n.console.log(r.message+" "+t)}};r(t).ajaxError((function(r,n,t,a){var o=n.status,i=t.url,u=t.type;if(o){var s={status:o,url:i,type:u,isAjax:!0,data:t.data,jqXHR_responseText:n.responseText,jqXHR_statusText:n.statusText},d=a||"jQuery ajax error for "+u;e.warning(d,s)}}));var o=r.fn.ready;r.fn.ready=function(r){return o.call(this,(function(n){try{r(n)}catch(r){a(r)}}))};var i=r.event.add;r.event.add=function(n,t,e,o,u){var s,d=function(r){return function(){try{return r.apply(this,arguments)}catch(r){a(r)}}};return e.handler?(s=e.handler,e.handler=d(e.handler)):(s=e,e=d(e)),s.guid?e.guid=s.guid:e.guid=s.guid=r.guid++,i.call(this,n,t,e,o,u)}}}(jQuery,window,document)}();
1
+ !function(){"use strict";!function(r,n,t){var e=n.Rollbar;if(e){e.configure({payload:{notifier:{plugins:{jquery:{version:"0.0.8"}}}}});var a=function(r){if(e.error(r),n.console){var t="[reported to Rollbar]";e.options&&!e.options.enabled&&(t="[Rollbar not enabled]"),n.console.log(r.message+" "+t)}};r(t).ajaxError(function(r,n,t,a){var o=n.status,i=t.url,u=t.type;if(o){var s={status:o,url:i,type:u,isAjax:!0,data:t.data,jqXHR_responseText:n.responseText,jqXHR_statusText:n.statusText},d=a||"jQuery ajax error for "+u;e.warning(d,s)}});var o=r.fn.ready;r.fn.ready=function(r){return o.call(this,function(n){try{r(n)}catch(r){a(r)}})};var i=r.event.add;r.event.add=function(n,t,e,o,u){var s,d=function(r){return function(){try{return r.apply(this,arguments)}catch(r){a(r)}}};return e.handler?(s=e.handler,e.handler=d(e.handler)):(s=e,e=d(e)),s.guid?e.guid=s.guid:e.guid=s.guid=r.guid++,i.call(this,n,t,e,o,u)}}}(jQuery,window,document)}();