@belvador/browser 0.3.0 → 0.4.1

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
@@ -6,14 +6,21 @@ Error tracking for browser apps, sending to your [Belvador](https://belvador.dev
6
6
  npm install @belvador/browser
7
7
  ```
8
8
 
9
+ `src/instrument.ts`, imported on the **first line** of your entry file (imports run before the
10
+ rest of a file, so a later `init` misses errors thrown while your other modules load):
11
+
9
12
  ```ts
10
- import { init, captureException } from "@belvador/browser";
13
+ import { init } from "@belvador/browser";
11
14
 
12
15
  init({
13
16
  dsn: "https://<key>@ingest.belvador.dev/<project>", // Project settings → DSN
14
17
  release: import.meta.env.VITE_APP_VERSION, // your build or commit id
15
18
  environment: import.meta.env.MODE,
16
19
  });
20
+ ```
21
+
22
+ ```ts
23
+ import { captureException } from "@belvador/browser";
17
24
 
18
25
  try {
19
26
  risky();
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, TRACE_OPTION, buildEngineOptions, installTracePropagation, isActive, reportDiagnostic, runVerification, warnOnce, } from "@belvador/core";
4
+ import { BELVADOR_MARKER, OTEL_OPTION, TRACE_OPTION, buildEngineOptions, otelBridgeIntegration, installTracePropagation, isActive, reportDiagnostic, runVerification, warnOnce, } from "@belvador/core";
5
5
  const EXTENSION_URLS = [
6
6
  /^chrome-extension:\/\//i,
7
7
  /^moz-extension:\/\//i,
@@ -33,6 +33,9 @@ export function browserEngineOptions(options, runtime) {
33
33
  integrations.push(breadcrumbsIntegration(crumbs));
34
34
  if (options.wrapBrowserApis === true)
35
35
  integrations.push(functionToStringIntegration(), browserApiErrorsIntegration());
36
+ const otel = base[OTEL_OPTION];
37
+ if (otel)
38
+ integrations.push(otelBridgeIntegration(otel));
36
39
  return {
37
40
  ...base,
38
41
  integrations,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@belvador/browser",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
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.3.0",
40
+ "@belvador/core": "0.4.1",
41
41
  "@sentry/browser": "10.76.2"
42
42
  },
43
43
  "publishConfig": {