@crashlensorg/browser 0.1.0 → 0.1.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/dist/index.js +5 -0
- package/dist/index.mjs +5 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -59,6 +59,9 @@ function getOrCreateDeviceId() {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
function collectBrowserInfo() {
|
|
62
|
+
if (typeof navigator === "undefined") {
|
|
63
|
+
return { deviceId: getOrCreateDeviceId(), deviceOs: "web", deviceType: "web" };
|
|
64
|
+
}
|
|
62
65
|
const nav = navigator;
|
|
63
66
|
const ua = nav?.userAgent ?? "";
|
|
64
67
|
const { browserName, browserVersion } = parseUserAgent(ua);
|
|
@@ -86,6 +89,7 @@ function collectBrowserInfo() {
|
|
|
86
89
|
|
|
87
90
|
// src/integrations.ts
|
|
88
91
|
function installGlobalErrorHandlers(hooks) {
|
|
92
|
+
if (typeof window === "undefined") return () => void 0;
|
|
89
93
|
const onError = (event) => {
|
|
90
94
|
let error = event.error;
|
|
91
95
|
if (!(error instanceof Error) && event.message) {
|
|
@@ -131,6 +135,7 @@ function initGlobalHandlers(client) {
|
|
|
131
135
|
// src/http-breadcrumbs.ts
|
|
132
136
|
var xhrMeta = /* @__PURE__ */ new WeakMap();
|
|
133
137
|
function instrumentHttpBreadcrumbs(client) {
|
|
138
|
+
if (typeof window === "undefined" || typeof XMLHttpRequest === "undefined") return () => void 0;
|
|
134
139
|
const addRequest = (method, url, status) => {
|
|
135
140
|
client.addBreadcrumb({
|
|
136
141
|
message: `${method} ${url}`,
|
package/dist/index.mjs
CHANGED
|
@@ -34,6 +34,9 @@ function getOrCreateDeviceId() {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
function collectBrowserInfo() {
|
|
37
|
+
if (typeof navigator === "undefined") {
|
|
38
|
+
return { deviceId: getOrCreateDeviceId(), deviceOs: "web", deviceType: "web" };
|
|
39
|
+
}
|
|
37
40
|
const nav = navigator;
|
|
38
41
|
const ua = nav?.userAgent ?? "";
|
|
39
42
|
const { browserName, browserVersion } = parseUserAgent(ua);
|
|
@@ -61,6 +64,7 @@ function collectBrowserInfo() {
|
|
|
61
64
|
|
|
62
65
|
// src/integrations.ts
|
|
63
66
|
function installGlobalErrorHandlers(hooks) {
|
|
67
|
+
if (typeof window === "undefined") return () => void 0;
|
|
64
68
|
const onError = (event) => {
|
|
65
69
|
let error = event.error;
|
|
66
70
|
if (!(error instanceof Error) && event.message) {
|
|
@@ -106,6 +110,7 @@ function initGlobalHandlers(client) {
|
|
|
106
110
|
// src/http-breadcrumbs.ts
|
|
107
111
|
var xhrMeta = /* @__PURE__ */ new WeakMap();
|
|
108
112
|
function instrumentHttpBreadcrumbs(client) {
|
|
113
|
+
if (typeof window === "undefined" || typeof XMLHttpRequest === "undefined") return () => void 0;
|
|
109
114
|
const addRequest = (method, url, status) => {
|
|
110
115
|
client.addBreadcrumb({
|
|
111
116
|
message: `${method} ${url}`,
|
package/package.json
CHANGED