@sentry/browser 9.39.0 → 9.41.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/build/npm/cjs/client.js +6 -5
  2. package/build/npm/cjs/client.js.map +1 -1
  3. package/build/npm/cjs/eventbuilder.js +2 -2
  4. package/build/npm/cjs/eventbuilder.js.map +1 -1
  5. package/build/npm/cjs/helpers.js +1 -1
  6. package/build/npm/cjs/helpers.js.map +1 -1
  7. package/build/npm/cjs/index.js +3 -0
  8. package/build/npm/cjs/index.js.map +1 -1
  9. package/build/npm/cjs/integrations/breadcrumbs.js +2 -2
  10. package/build/npm/cjs/integrations/breadcrumbs.js.map +1 -1
  11. package/build/npm/cjs/integrations/browserapierrors.js +1 -1
  12. package/build/npm/cjs/integrations/browserapierrors.js.map +1 -1
  13. package/build/npm/cjs/integrations/browsersession.js +1 -1
  14. package/build/npm/cjs/integrations/browsersession.js.map +1 -1
  15. package/build/npm/cjs/integrations/featureFlags/unleash/integration.js +1 -1
  16. package/build/npm/cjs/integrations/featureFlags/unleash/integration.js.map +1 -1
  17. package/build/npm/cjs/integrations/globalhandlers.js +1 -1
  18. package/build/npm/cjs/integrations/globalhandlers.js.map +1 -1
  19. package/build/npm/cjs/integrations/httpclient.js +1 -1
  20. package/build/npm/cjs/integrations/httpclient.js.map +1 -1
  21. package/build/npm/cjs/integrations/spotlight.js +4 -5
  22. package/build/npm/cjs/integrations/spotlight.js.map +1 -1
  23. package/build/npm/cjs/integrations/webWorker.js +139 -0
  24. package/build/npm/cjs/integrations/webWorker.js.map +1 -0
  25. package/build/npm/cjs/log.js +6 -6
  26. package/build/npm/cjs/log.js.map +1 -1
  27. package/build/npm/cjs/profiling/integration.js +3 -3
  28. package/build/npm/cjs/profiling/integration.js.map +1 -1
  29. package/build/npm/cjs/profiling/startProfileForSpan.js +5 -5
  30. package/build/npm/cjs/profiling/startProfileForSpan.js.map +1 -1
  31. package/build/npm/cjs/profiling/utils.js +16 -18
  32. package/build/npm/cjs/profiling/utils.js.map +1 -1
  33. package/build/npm/cjs/report-dialog.js +2 -2
  34. package/build/npm/cjs/report-dialog.js.map +1 -1
  35. package/build/npm/cjs/tracing/backgroundtab.js +2 -2
  36. package/build/npm/cjs/tracing/backgroundtab.js.map +1 -1
  37. package/build/npm/cjs/tracing/browserTracingIntegration.js +4 -4
  38. package/build/npm/cjs/tracing/browserTracingIntegration.js.map +1 -1
  39. package/build/npm/cjs/tracing/linkedTraces.js +3 -3
  40. package/build/npm/cjs/tracing/linkedTraces.js.map +1 -1
  41. package/build/npm/cjs/tracing/request.js +2 -2
  42. package/build/npm/cjs/tracing/request.js.map +1 -1
  43. package/build/npm/cjs/transports/offline.js +3 -3
  44. package/build/npm/cjs/transports/offline.js.map +1 -1
  45. package/build/npm/esm/client.js +6 -5
  46. package/build/npm/esm/client.js.map +1 -1
  47. package/build/npm/esm/eventbuilder.js +2 -2
  48. package/build/npm/esm/eventbuilder.js.map +1 -1
  49. package/build/npm/esm/helpers.js +1 -1
  50. package/build/npm/esm/helpers.js.map +1 -1
  51. package/build/npm/esm/index.js +1 -0
  52. package/build/npm/esm/index.js.map +1 -1
  53. package/build/npm/esm/integrations/breadcrumbs.js +3 -3
  54. package/build/npm/esm/integrations/breadcrumbs.js.map +1 -1
  55. package/build/npm/esm/integrations/browserapierrors.js +1 -1
  56. package/build/npm/esm/integrations/browserapierrors.js.map +1 -1
  57. package/build/npm/esm/integrations/browsersession.js +2 -2
  58. package/build/npm/esm/integrations/browsersession.js.map +1 -1
  59. package/build/npm/esm/integrations/featureFlags/unleash/integration.js +2 -2
  60. package/build/npm/esm/integrations/featureFlags/unleash/integration.js.map +1 -1
  61. package/build/npm/esm/integrations/globalhandlers.js +2 -2
  62. package/build/npm/esm/integrations/globalhandlers.js.map +1 -1
  63. package/build/npm/esm/integrations/httpclient.js +2 -2
  64. package/build/npm/esm/integrations/httpclient.js.map +1 -1
  65. package/build/npm/esm/integrations/spotlight.js +5 -6
  66. package/build/npm/esm/integrations/spotlight.js.map +1 -1
  67. package/build/npm/esm/integrations/webWorker.js +135 -0
  68. package/build/npm/esm/integrations/webWorker.js.map +1 -0
  69. package/build/npm/esm/log.js +6 -6
  70. package/build/npm/esm/log.js.map +1 -1
  71. package/build/npm/esm/package.json +1 -1
  72. package/build/npm/esm/profiling/integration.js +4 -4
  73. package/build/npm/esm/profiling/integration.js.map +1 -1
  74. package/build/npm/esm/profiling/startProfileForSpan.js +6 -6
  75. package/build/npm/esm/profiling/startProfileForSpan.js.map +1 -1
  76. package/build/npm/esm/profiling/utils.js +17 -19
  77. package/build/npm/esm/profiling/utils.js.map +1 -1
  78. package/build/npm/esm/report-dialog.js +3 -3
  79. package/build/npm/esm/report-dialog.js.map +1 -1
  80. package/build/npm/esm/tracing/backgroundtab.js +3 -3
  81. package/build/npm/esm/tracing/backgroundtab.js.map +1 -1
  82. package/build/npm/esm/tracing/browserTracingIntegration.js +5 -5
  83. package/build/npm/esm/tracing/browserTracingIntegration.js.map +1 -1
  84. package/build/npm/esm/tracing/linkedTraces.js +4 -4
  85. package/build/npm/esm/tracing/linkedTraces.js.map +1 -1
  86. package/build/npm/esm/tracing/request.js +2 -2
  87. package/build/npm/esm/tracing/request.js.map +1 -1
  88. package/build/npm/esm/transports/offline.js +3 -3
  89. package/build/npm/esm/transports/offline.js.map +1 -1
  90. package/build/npm/types/client.d.ts.map +1 -1
  91. package/build/npm/types/index.d.ts +1 -0
  92. package/build/npm/types/index.d.ts.map +1 -1
  93. package/build/npm/types/integrations/spotlight.d.ts.map +1 -1
  94. package/build/npm/types/integrations/webWorker.d.ts +103 -0
  95. package/build/npm/types/integrations/webWorker.d.ts.map +1 -0
  96. package/build/npm/types/log.d.ts +6 -6
  97. package/build/npm/types/profiling/utils.d.ts.map +1 -1
  98. package/build/npm/types-ts3.8/index.d.ts +1 -0
  99. package/build/npm/types-ts3.8/integrations/webWorker.d.ts +103 -0
  100. package/build/npm/types-ts3.8/log.d.ts +6 -6
  101. package/package.json +7 -7
@@ -0,0 +1,103 @@
1
+ import { Integration, IntegrationFn } from '@sentry/core';
2
+ export declare const INTEGRATION_NAME = "WebWorker";
3
+ interface WebWorkerIntegration extends Integration {
4
+ addWorker: (worker: Worker) => void;
5
+ }
6
+ /**
7
+ * Use this integration to set up Sentry with web workers.
8
+ *
9
+ * IMPORTANT: This integration must be added **before** you start listening to
10
+ * any messages from the worker. Otherwise, your message handlers will receive
11
+ * messages from the Sentry SDK which you need to ignore.
12
+ *
13
+ * This integration only has an effect, if you call `Sentry.registerWorker(self)`
14
+ * from within the worker(s) you're adding to the integration.
15
+ *
16
+ * Given that you want to initialize the SDK as early as possible, you most likely
17
+ * want to add this integration **after** initializing the SDK:
18
+ *
19
+ * @example:
20
+ * ```ts filename={main.js}
21
+ * import * as Sentry from '@sentry/<your-sdk>';
22
+ *
23
+ * // some time earlier:
24
+ * Sentry.init(...)
25
+ *
26
+ * // 1. Initialize the worker
27
+ * const worker = new Worker(new URL('./worker.ts', import.meta.url));
28
+ *
29
+ * // 2. Add the integration
30
+ * const webWorkerIntegration = Sentry.webWorkerIntegration({ worker });
31
+ * Sentry.addIntegration(webWorkerIntegration);
32
+ *
33
+ * // 3. Register message listeners on the worker
34
+ * worker.addEventListener('message', event => {
35
+ * // ...
36
+ * });
37
+ * ```
38
+ *
39
+ * If you initialize multiple workers at the same time, you can also pass an array of workers
40
+ * to the integration:
41
+ *
42
+ * ```ts filename={main.js}
43
+ * const webWorkerIntegration = Sentry.webWorkerIntegration({ worker: [worker1, worker2] });
44
+ * Sentry.addIntegration(webWorkerIntegration);
45
+ * ```
46
+ *
47
+ * If you have any additional workers that you initialize at a later point,
48
+ * you can add them to the integration as follows:
49
+ *
50
+ * ```ts filename={main.js}
51
+ * const webWorkerIntegration = Sentry.webWorkerIntegration({ worker: worker1 });
52
+ * Sentry.addIntegration(webWorkerIntegration);
53
+ *
54
+ * // sometime later:
55
+ * webWorkerIntegration.addWorker(worker2);
56
+ * ```
57
+ *
58
+ * Of course, you can also directly add the integration in Sentry.init:
59
+ * ```ts filename={main.js}
60
+ * import * as Sentry from '@sentry/<your-sdk>';
61
+ *
62
+ * // 1. Initialize the worker
63
+ * const worker = new Worker(new URL('./worker.ts', import.meta.url));
64
+ *
65
+ * // 2. Initialize the SDK
66
+ * Sentry.init({
67
+ * integrations: [Sentry.webWorkerIntegration({ worker })]
68
+ * });
69
+ *
70
+ * // 3. Register message listeners on the worker
71
+ * worker.addEventListener('message', event => {
72
+ * // ...
73
+ * });
74
+ * ```
75
+ *
76
+ * @param options {WebWorkerIntegrationOptions} Integration options:
77
+ * - `worker`: The worker instance.
78
+ */
79
+ export declare const webWorkerIntegration: IntegrationFn<WebWorkerIntegration>;
80
+ interface RegisterWebWorkerOptions {
81
+ self: Worker & {
82
+ _sentryDebugIds?: Record<string, string>;
83
+ };
84
+ }
85
+ /**
86
+ * Use this function to register the worker with the Sentry SDK.
87
+ *
88
+ * @example
89
+ * ```ts filename={worker.js}
90
+ * import * as Sentry from '@sentry/<your-sdk>';
91
+ *
92
+ * // Do this as early as possible in your worker.
93
+ * Sentry.registerWorker({ self });
94
+ *
95
+ * // continue setting up your worker
96
+ * self.postMessage(...)
97
+ * ```
98
+ * @param options {RegisterWebWorkerOptions} Integration options:
99
+ * - `self`: The worker instance you're calling this function from (self).
100
+ */
101
+ export declare function registerWebWorker({ self }: RegisterWebWorkerOptions): void;
102
+ export {};
103
+ //# sourceMappingURL=webWorker.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { Log, ParameterizedString } from '@sentry/core';
2
2
  /**
3
- * @summary Capture a log with the `trace` level. Requires `_experiments.enableLogs` to be enabled.
3
+ * @summary Capture a log with the `trace` level. Requires the `enableLogs` option to be enabled.
4
4
  *
5
5
  * @param message - The message to log.
6
6
  * @param attributes - Arbitrary structured data that stores information about the log - e.g., { userId: 100, route: '/dashboard' }.
@@ -26,7 +26,7 @@ import { Log, ParameterizedString } from '@sentry/core';
26
26
  */
27
27
  export declare function trace(message: ParameterizedString, attributes?: Log['attributes']): void;
28
28
  /**
29
- * @summary Capture a log with the `debug` level. Requires `_experiments.enableLogs` to be enabled.
29
+ * @summary Capture a log with the `debug` level. Requires the `enableLogs` option to be enabled.
30
30
  *
31
31
  * @param message - The message to log.
32
32
  * @param attributes - Arbitrary structured data that stores information about the log - e.g., { component: 'Header', state: 'loading' }.
@@ -53,7 +53,7 @@ export declare function trace(message: ParameterizedString, attributes?: Log['at
53
53
  */
54
54
  export declare function debug(message: ParameterizedString, attributes?: Log['attributes']): void;
55
55
  /**
56
- * @summary Capture a log with the `info` level. Requires `_experiments.enableLogs` to be enabled.
56
+ * @summary Capture a log with the `info` level. Requires the `enableLogs` option to be enabled.
57
57
  *
58
58
  * @param message - The message to log.
59
59
  * @param attributes - Arbitrary structured data that stores information about the log - e.g., { feature: 'checkout', status: 'completed' }.
@@ -80,7 +80,7 @@ export declare function debug(message: ParameterizedString, attributes?: Log['at
80
80
  */
81
81
  export declare function info(message: ParameterizedString, attributes?: Log['attributes']): void;
82
82
  /**
83
- * @summary Capture a log with the `warn` level. Requires `_experiments.enableLogs` to be enabled.
83
+ * @summary Capture a log with the `warn` level. Requires the `enableLogs` option to be enabled.
84
84
  *
85
85
  * @param message - The message to log.
86
86
  * @param attributes - Arbitrary structured data that stores information about the log - e.g., { browser: 'Chrome', version: '91.0' }.
@@ -108,7 +108,7 @@ export declare function info(message: ParameterizedString, attributes?: Log['att
108
108
  */
109
109
  export declare function warn(message: ParameterizedString, attributes?: Log['attributes']): void;
110
110
  /**
111
- * @summary Capture a log with the `error` level. Requires `_experiments.enableLogs` to be enabled.
111
+ * @summary Capture a log with the `error` level. Requires the `enableLogs` option to be enabled.
112
112
  *
113
113
  * @param message - The message to log.
114
114
  * @param attributes - Arbitrary structured data that stores information about the log - e.g., { error: 'NetworkError', url: '/api/data' }.
@@ -137,7 +137,7 @@ export declare function warn(message: ParameterizedString, attributes?: Log['att
137
137
  */
138
138
  export declare function error(message: ParameterizedString, attributes?: Log['attributes']): void;
139
139
  /**
140
- * @summary Capture a log with the `fatal` level. Requires `_experiments.enableLogs` to be enabled.
140
+ * @summary Capture a log with the `fatal` level. Requires the `enableLogs` option to be enabled.
141
141
  *
142
142
  * @param message - The message to log.
143
143
  * @param attributes - Arbitrary structured data that stores information about the log - e.g., { appState: 'corrupted', sessionId: 'abc-123' }.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/browser",
3
- "version": "9.39.0",
3
+ "version": "9.41.0",
4
4
  "description": "Official Sentry SDK for browsers",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/browser",
@@ -39,14 +39,14 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@sentry-internal/browser-utils": "9.39.0",
43
- "@sentry-internal/feedback": "9.39.0",
44
- "@sentry-internal/replay": "9.39.0",
45
- "@sentry-internal/replay-canvas": "9.39.0",
46
- "@sentry/core": "9.39.0"
42
+ "@sentry-internal/browser-utils": "9.41.0",
43
+ "@sentry-internal/feedback": "9.41.0",
44
+ "@sentry-internal/replay": "9.41.0",
45
+ "@sentry-internal/replay-canvas": "9.41.0",
46
+ "@sentry/core": "9.41.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@sentry-internal/integration-shims": "9.39.0",
49
+ "@sentry-internal/integration-shims": "9.41.0",
50
50
  "fake-indexeddb": "^4.0.1"
51
51
  },
52
52
  "scripts": {