@belvador/browser 0.2.0 → 0.3.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/README.md CHANGED
@@ -32,7 +32,7 @@ Allow the ingest origin in your Content-Security-Policy: `connect-src https://in
32
32
  ## What it sends
33
33
 
34
34
  Errors only (exceptions, messages, breadcrumbs you turn on, attachments if you enable them).
35
- No tracing, session replay, logs or profiling — those items are dropped inside your app.
35
+ No spans, session replay, logs, profiling or check-ins — those items are dropped inside your app.
36
36
 
37
37
  Before anything leaves your app the SDK removes `Authorization`, `Cookie` and `Set-Cookie`
38
38
  headers, request bodies and cookies, client IP headers, and masks credentials in URLs, query
@@ -45,6 +45,16 @@ each attempt times out after 10 s, failed sends retry at most 5 times, `429` rat
45
45
  respected, and a revoked key (`401`/`403`) stops sending for the life of the page or isolate.
46
46
  Every public function catches its own errors.
47
47
 
48
+ ## Link requests with one trace
49
+
50
+ Off by default. `tracePropagation: { targets: [/^\/api\//, "https://api.example.com"] }` adds
51
+ `traceparent` and `sentry-trace` headers to `fetch` calls to those URLs (relative patterns
52
+ match same-origin paths), so a browser error and the server error behind the same request
53
+ share one trace id. The receiving API must allow these headers in CORS. No spans or
54
+ transactions are sent; `baggage` only with `baggage: true`. A View Transition the browser
55
+ skipped on purpose is not reported unless you set `captureViewTransitionSkips: true`.
56
+ See https://belvador.dev/docs/sdk/tracing
57
+
48
58
  ## Check the connection
49
59
 
50
60
  "No errors" is not proof that errors arrive. Call `verifyIntegration()` from `@belvador/browser` once after `init`:
package/dist/internal.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // Shared by @belvador/browser, /react and /tanstack-start: browser engine
2
2
  // options and the idempotent init. Not a public API.
3
3
  import { breadcrumbsIntegration, browserApiErrorsIntegration, dedupeIntegration, eventFiltersIntegration, functionToStringIntegration, getClient, globalHandlersIntegration, httpContextIntegration, linkedErrorsIntegration, } from "@sentry/browser";
4
- import { BELVADOR_MARKER, buildEngineOptions, isActive, reportDiagnostic, runVerification, warnOnce, } from "@belvador/core";
4
+ import { BELVADOR_MARKER, TRACE_OPTION, buildEngineOptions, installTracePropagation, isActive, reportDiagnostic, runVerification, warnOnce, } from "@belvador/core";
5
5
  const EXTENSION_URLS = [
6
6
  /^chrome-extension:\/\//i,
7
7
  /^moz-extension:\/\//i,
@@ -60,6 +60,9 @@ export function initWith(engineInit, options, runtime) {
60
60
  if (!engineOptions)
61
61
  return false;
62
62
  engineInit(engineOptions);
63
+ // Only when the app asked for it (spec 06 §5): fetch to its targets carries the trace.
64
+ if (engineOptions[TRACE_OPTION])
65
+ installTracePropagation();
63
66
  return isActive();
64
67
  }
65
68
  catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@belvador/browser",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Belvador error tracking for the browser: one init, errors only, private by default.",
5
5
  "license": "MIT",
6
6
  "author": "Belvador (https://belvador.dev)",
@@ -37,7 +37,7 @@
37
37
  "node": ">=18"
38
38
  },
39
39
  "dependencies": {
40
- "@belvador/core": "0.2.0",
40
+ "@belvador/core": "0.3.0",
41
41
  "@sentry/browser": "10.76.2"
42
42
  },
43
43
  "publishConfig": {