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.
- package/.git-blame-ignore-revs +3 -1
- package/AGENTS.md +21 -0
- package/CONTRIBUTING.md +68 -73
- package/babel.config.json +7 -0
- package/bower.json +1 -1
- package/dist/plugins/jquery.min.js +1 -1
- package/dist/rollbar.cjs +2216 -2022
- package/dist/rollbar.js +6098 -5886
- package/dist/rollbar.js.map +1 -1
- package/dist/rollbar.min.cjs +1 -1
- package/dist/rollbar.min.cjs.LICENSE.txt +1 -1
- package/dist/rollbar.min.js +1 -1
- package/dist/rollbar.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.min.js.map +1 -1
- package/dist/rollbar.named-amd.js +6097 -5886
- package/dist/rollbar.named-amd.js.map +1 -1
- package/dist/rollbar.named-amd.min.js +1 -1
- package/dist/rollbar.named-amd.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.named-amd.min.js.map +1 -1
- package/dist/rollbar.noconflict.umd.js +6097 -5886
- package/dist/rollbar.noconflict.umd.js.map +1 -1
- package/dist/rollbar.noconflict.umd.min.js +1 -1
- package/dist/rollbar.noconflict.umd.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.noconflict.umd.min.js.map +1 -1
- package/dist/rollbar.replay.js +8123 -7924
- package/dist/rollbar.replay.js.map +1 -1
- package/dist/rollbar.replay.min.js +1 -1
- package/dist/rollbar.replay.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.replay.min.js.map +1 -1
- package/dist/rollbar.replay.noconflict.umd.js +8122 -7924
- package/dist/rollbar.replay.noconflict.umd.js.map +1 -1
- package/dist/rollbar.replay.noconflict.umd.min.js +1 -1
- package/dist/rollbar.replay.noconflict.umd.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.replay.noconflict.umd.min.js.map +1 -1
- package/dist/rollbar.replay.umd.js +8122 -7924
- package/dist/rollbar.replay.umd.js.map +1 -1
- package/dist/rollbar.replay.umd.min.js +1 -1
- package/dist/rollbar.replay.umd.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.replay.umd.min.js.map +1 -1
- package/dist/rollbar.snippet.js +1 -1
- package/dist/rollbar.umd.js +6097 -5886
- package/dist/rollbar.umd.js.map +1 -1
- package/dist/rollbar.umd.min.js +1 -1
- package/dist/rollbar.umd.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.umd.min.js.map +1 -1
- package/eslint.config.js +151 -0
- package/index.d.ts +45 -13
- package/package.json +26 -6
- package/src/api.js +130 -136
- package/src/apiUtility.js +2 -2
- package/src/browser/bundles/rollbar.snippet.js +1 -0
- package/src/browser/core.js +31 -42
- package/src/browser/domUtility.js +11 -17
- package/src/browser/globalSetup.js +3 -3
- package/src/browser/replay/checkoutWatchdog.js +104 -0
- package/src/browser/replay/recorder.d.ts +5 -2
- package/src/browser/replay/recorder.js +22 -4
- package/src/browser/replay/replay.js +8 -4
- package/src/browser/replay/replayPredicates.js +1 -1
- package/src/browser/rollbar.js +5 -4
- package/src/browser/rollbarReplay.js +6 -5
- package/src/browser/rollbarWrapper.js +2 -2
- package/src/browser/shim.js +15 -15
- package/src/browser/telemetry.js +26 -22
- package/src/browser/transforms.js +4 -4
- package/src/browser/transport/xhr.js +4 -4
- package/src/browser/transport.js +9 -10
- package/src/browser/wrapGlobals.js +3 -4
- package/src/defaults.js +1 -1
- package/src/errorParser.js +1 -1
- package/src/logger.js +1 -0
- package/src/notifier.js +102 -100
- package/src/predicates.js +3 -4
- package/src/rateLimiter.js +107 -104
- package/src/react-native/rollbar.js +9 -10
- package/src/react-native/transforms.js +4 -5
- package/src/react-native/transport.js +7 -7
- package/src/rollbar.js +7 -4
- package/src/scrub.js +16 -20
- package/src/server/locals.js +7 -7
- package/src/server/parser.js +9 -6
- package/src/server/rollbar.js +54 -49
- package/src/server/sourceMap/stackTrace.js +7 -6
- package/src/server/telemetry/urlHelpers.js +2 -1
- package/src/server/telemetry.js +10 -10
- package/src/server/transforms.js +10 -6
- package/src/server/transport.js +8 -7
- package/src/telemetry.js +22 -25
- package/src/tracing/tracer.js +2 -2
- package/src/tracing/tracing.js +2 -2
- package/src/truncation.js +6 -6
- package/src/utility/headers.js +4 -2
- package/src/utility/traverse.js +1 -1
- package/src/utility.js +111 -33
- package/tsconfig.json +16 -0
- package/tsconfig.test.json +10 -0
- package/{web-test-runner.config.mjs → web-test-runner.config.js} +10 -0
- package/{webpack.config.cjs → webpack.config.js} +39 -27
- package/.eslintrc +0 -27
- package/eslint.config.mjs +0 -33
- package/src/merge.js +0 -61
package/.git-blame-ignore-revs
CHANGED
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
7
|
+
## Ways to contribute
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
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
|
-
|
|
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
|
-
|
|
15
|
-
|
|
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
|
|
27
|
+
git clone https://github.com/<your-username>/rollbar.js.git
|
|
18
28
|
cd rollbar.js
|
|
19
29
|
```
|
|
20
|
-
|
|
30
|
+
2. Install dependencies:
|
|
21
31
|
```bash
|
|
22
32
|
npm install
|
|
23
33
|
```
|
|
24
|
-
|
|
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
|
-
|
|
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
|
-
|
|
42
|
+
## Local development workflow
|
|
32
43
|
|
|
33
|
-
|
|
44
|
+
### Linting and autofixes
|
|
34
45
|
|
|
35
|
-
|
|
36
|
-
npm
|
|
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
|
-
|
|
49
|
+
### Formatting
|
|
40
50
|
|
|
41
|
-
|
|
42
|
-
npm run
|
|
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
|
-
|
|
54
|
+
### Tests
|
|
46
55
|
|
|
47
|
-
|
|
48
|
-
npm run test-
|
|
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
|
-
###
|
|
63
|
+
### Builds
|
|
52
64
|
|
|
53
|
-
-
|
|
54
|
-
-
|
|
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
|
-
|
|
68
|
+
## Code style philosophy
|
|
59
69
|
|
|
60
|
-
|
|
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
|
-
|
|
63
|
-
git checkout -b my-feature-name
|
|
64
|
-
```
|
|
74
|
+
## Pull request checklist
|
|
65
75
|
|
|
66
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
101
|
+
## Need help?
|
|
107
102
|
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
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
|
-
|
|
107
|
+
Thanks again for partnering with us to improve Rollbar.js!
|
package/babel.config.json
CHANGED
package/bower.json
CHANGED
|
@@ -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(
|
|
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)}();
|