miaoda-react-devkit 0.1.1-beta.1 → 0.1.1-beta.11
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/cloud/vite.config.js +117 -0
- package/dist/index.cjs +253 -69
- package/dist/index.d.cts +111 -2
- package/dist/index.d.ts +111 -2
- package/dist/index.js +250 -69
- package/dist/stubs/sentry-react-noop-stub.js +78 -0
- package/dist/stubs/sentry-react-stub.js +187 -69
- package/dist/vite/index.cjs +844 -1
- package/dist/vite/index.d.cts +38 -1
- package/dist/vite/index.d.ts +38 -1
- package/dist/vite/index.js +842 -1
- package/package.json +8 -1
- package/README.md +0 -181
- package/cloud/vite.config.ts +0 -156
|
@@ -7,12 +7,7 @@ import * as RealSentry from "@sentry/react";
|
|
|
7
7
|
|
|
8
8
|
// src/capture/console.ts
|
|
9
9
|
import { addConsoleInstrumentationHandler } from "@sentry/core";
|
|
10
|
-
|
|
11
|
-
"Sentry initialized successfully",
|
|
12
|
-
"[vite] ",
|
|
13
|
-
"Download the React DevTools for a better development experience"
|
|
14
|
-
];
|
|
15
|
-
function serializeArg(arg) {
|
|
10
|
+
function formatConsoleArg(arg) {
|
|
16
11
|
if (typeof arg === "string") return arg;
|
|
17
12
|
if (arg instanceof Error) return arg.message;
|
|
18
13
|
try {
|
|
@@ -21,9 +16,17 @@ function serializeArg(arg) {
|
|
|
21
16
|
return String(arg);
|
|
22
17
|
}
|
|
23
18
|
}
|
|
19
|
+
function formatConsoleArgs(args) {
|
|
20
|
+
return args.map(formatConsoleArg).join(" ");
|
|
21
|
+
}
|
|
22
|
+
var DEFAULT_CONSOLE_FILTER_KEYWORDS = [
|
|
23
|
+
"Sentry initialized successfully",
|
|
24
|
+
"[vite] ",
|
|
25
|
+
"Download the React DevTools for a better development experience"
|
|
26
|
+
];
|
|
24
27
|
function shouldFilterConsole(args, keywords) {
|
|
25
28
|
if (keywords.length === 0) return false;
|
|
26
|
-
const text = args
|
|
29
|
+
const text = formatConsoleArgs(args);
|
|
27
30
|
return keywords.some((kw) => text.includes(kw));
|
|
28
31
|
}
|
|
29
32
|
function shouldFilterConsoleMessage(message, keywords) {
|
|
@@ -39,9 +42,20 @@ function createConsoleObserver(keywords, subscribers) {
|
|
|
39
42
|
for (const sub of subscribers) sub.onConsole(info);
|
|
40
43
|
});
|
|
41
44
|
},
|
|
42
|
-
beforeBreadcrumb(breadcrumb,
|
|
45
|
+
beforeBreadcrumb(breadcrumb, hint) {
|
|
43
46
|
if (breadcrumb.category === "console" && breadcrumb.message != null) {
|
|
44
47
|
if (shouldFilterConsoleMessage(breadcrumb.message, keywords)) return null;
|
|
48
|
+
const h = hint;
|
|
49
|
+
const consoleType = h?.level ?? "log";
|
|
50
|
+
const stacks = (h?.input ?? []).filter((arg) => arg instanceof Error && arg.stack != null).map((err) => err.stack);
|
|
51
|
+
const originalMessage = breadcrumb.message;
|
|
52
|
+
breadcrumb.message = `[${consoleType}]${originalMessage}`;
|
|
53
|
+
breadcrumb.data = {
|
|
54
|
+
...breadcrumb.data ?? {},
|
|
55
|
+
consoleType,
|
|
56
|
+
message: originalMessage,
|
|
57
|
+
...stacks.length > 0 ? { stack: stacks.join("\n\n") } : {}
|
|
58
|
+
};
|
|
45
59
|
}
|
|
46
60
|
return breadcrumb;
|
|
47
61
|
}
|
|
@@ -49,7 +63,7 @@ function createConsoleObserver(keywords, subscribers) {
|
|
|
49
63
|
}
|
|
50
64
|
|
|
51
65
|
// src/capture/network.ts
|
|
52
|
-
import { getClient } from "@sentry/core";
|
|
66
|
+
import { getClient, getIsolationScope } from "@sentry/core";
|
|
53
67
|
|
|
54
68
|
// ../../node_modules/.pnpm/@sentry-internal+browser-utils@9.47.1/node_modules/@sentry-internal/browser-utils/build/esm/debug-build.js
|
|
55
69
|
var DEBUG_BUILD = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
|
|
@@ -87,9 +101,42 @@ function getFetchRequestArgBody(fetchArgs = []) {
|
|
|
87
101
|
return fetchArgs[1].body;
|
|
88
102
|
}
|
|
89
103
|
|
|
104
|
+
// src/utils.ts
|
|
105
|
+
function stripUrlOrigin(url) {
|
|
106
|
+
try {
|
|
107
|
+
const u = new URL(url);
|
|
108
|
+
return u.pathname + u.search + u.hash;
|
|
109
|
+
} catch {
|
|
110
|
+
return url;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
90
114
|
// src/capture/pgrest.ts
|
|
91
115
|
var DEFAULT_PGREST_URL_PATTERNS = [/\/rest\/v1\//];
|
|
92
|
-
var DEFAULT_PGREST_WHITELIST_CODES = [
|
|
116
|
+
var DEFAULT_PGREST_WHITELIST_CODES = [
|
|
117
|
+
"22P02",
|
|
118
|
+
// 无效的文本表示(如类型转换失败)
|
|
119
|
+
"42703",
|
|
120
|
+
// 未定义的列
|
|
121
|
+
"42P01",
|
|
122
|
+
// 未定义的表
|
|
123
|
+
"42501",
|
|
124
|
+
// 权限不足
|
|
125
|
+
"23503",
|
|
126
|
+
// 外键约束失败
|
|
127
|
+
"42P17",
|
|
128
|
+
// 对象已存在
|
|
129
|
+
"22008",
|
|
130
|
+
// 日期时间字段值超出范围
|
|
131
|
+
"23505",
|
|
132
|
+
// 唯一键冲突
|
|
133
|
+
"PGRST116",
|
|
134
|
+
// 期望单行但返回多行
|
|
135
|
+
"PGRST200",
|
|
136
|
+
// 外键关系查找失败
|
|
137
|
+
"PGRST204"
|
|
138
|
+
// 响应中找不到列
|
|
139
|
+
];
|
|
93
140
|
function isPgRestRequest(url, patterns) {
|
|
94
141
|
return patterns.some((p) => (typeof p === "string" ? new RegExp(p) : p).test(url));
|
|
95
142
|
}
|
|
@@ -114,8 +161,38 @@ function parsePgRestErrorBody(body) {
|
|
|
114
161
|
};
|
|
115
162
|
}
|
|
116
163
|
|
|
164
|
+
// src/capture/auth.ts
|
|
165
|
+
var DEFAULT_AUTH_URL_PATTERNS = [/\/auth\/v1\//];
|
|
166
|
+
var DEFAULT_AUTH_WHITELIST_CODES = ["unexpected_failure"];
|
|
167
|
+
function isAuthRequest(url, patterns) {
|
|
168
|
+
return patterns.some((p) => (typeof p === "string" ? new RegExp(p) : p).test(url));
|
|
169
|
+
}
|
|
170
|
+
function parseAuthErrorBody(body) {
|
|
171
|
+
if (!body) return null;
|
|
172
|
+
let parsed;
|
|
173
|
+
try {
|
|
174
|
+
parsed = JSON.parse(body);
|
|
175
|
+
} catch {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
if (typeof parsed !== "object") return null;
|
|
179
|
+
if (parsed === null) return null;
|
|
180
|
+
const p = parsed;
|
|
181
|
+
if (typeof p["code"] !== "string") return null;
|
|
182
|
+
if (typeof p["message"] !== "string") return null;
|
|
183
|
+
return {
|
|
184
|
+
code: p["code"],
|
|
185
|
+
message: p["message"],
|
|
186
|
+
requestId: typeof p["requestId"] === "string" ? p["requestId"] : null
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
117
190
|
// src/capture/network.ts
|
|
118
191
|
var BODY_TRUNCATE_LIMIT = 2e3;
|
|
192
|
+
function calcDuration(hint) {
|
|
193
|
+
if (hint?.startTimestamp == null || hint?.endTimestamp == null) return void 0;
|
|
194
|
+
return Math.round((hint.endTimestamp - hint.startTimestamp) * 1e3);
|
|
195
|
+
}
|
|
119
196
|
var DEFAULT_IGNORE_URLS = [
|
|
120
197
|
/\.(js|css|png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf|eot|map)(\?.*)?$/,
|
|
121
198
|
/\.chunk\./,
|
|
@@ -165,7 +242,15 @@ function handleXhrBreadcrumb(breadcrumb, hint, handler) {
|
|
|
165
242
|
breadcrumb.data["requestBody"] = requestBody;
|
|
166
243
|
breadcrumb.data["responseBody"] = responseBody;
|
|
167
244
|
}
|
|
168
|
-
|
|
245
|
+
const duration = calcDuration(hint);
|
|
246
|
+
const relativeUrl = stripUrlOrigin(url);
|
|
247
|
+
const statusStr = statusCode != null ? String(statusCode) : "failed";
|
|
248
|
+
const durationStr = duration != null ? ` (${duration}ms)` : "";
|
|
249
|
+
breadcrumb.message = `XHR ${method} ${relativeUrl} -> ${statusStr}${durationStr}`;
|
|
250
|
+
if (breadcrumb.data) {
|
|
251
|
+
breadcrumb.data["duration"] = duration;
|
|
252
|
+
}
|
|
253
|
+
void handler({ type: "xhr", method, url, statusCode, requestBody, responseBody, isError, duration });
|
|
169
254
|
}
|
|
170
255
|
async function handleFetchBreadcrumb(breadcrumb, hint, handler) {
|
|
171
256
|
const data = breadcrumb.data;
|
|
@@ -175,19 +260,24 @@ async function handleFetchBreadcrumb(breadcrumb, hint, handler) {
|
|
|
175
260
|
const isError = hint?.data != null;
|
|
176
261
|
const response = hint?.response;
|
|
177
262
|
const cause = hint?.data instanceof Error ? hint.data : void 0;
|
|
178
|
-
const
|
|
179
|
-
const reqBody = getFetchRequestArgBody(fetchArgs ?? []);
|
|
263
|
+
const reqBody = getFetchRequestArgBody(hint?.input ?? []);
|
|
180
264
|
const [rawRequestBody] = getBodyString(reqBody);
|
|
181
265
|
const requestBody = rawRequestBody != null ? truncateBody(rawRequestBody) : void 0;
|
|
266
|
+
const duration = calcDuration(hint);
|
|
267
|
+
const relativeUrl = stripUrlOrigin(url);
|
|
268
|
+
const statusStr = statusCode != null ? String(statusCode) : "failed";
|
|
269
|
+
const durationStr = duration != null ? ` (${duration}ms)` : "";
|
|
270
|
+
breadcrumb.message = `Fetch ${method} ${relativeUrl} -> ${statusStr}${durationStr}`;
|
|
182
271
|
if (breadcrumb.data) {
|
|
183
272
|
breadcrumb.data["requestBody"] = requestBody;
|
|
273
|
+
breadcrumb.data["duration"] = duration;
|
|
184
274
|
}
|
|
185
275
|
const contentType = response?.headers?.get("content-type") ?? "";
|
|
186
276
|
if (isStreamByContentType(contentType)) {
|
|
187
277
|
if (breadcrumb.data) {
|
|
188
278
|
breadcrumb.data["responseBody"] = "[streaming response - not captured]";
|
|
189
279
|
}
|
|
190
|
-
await handler({ type: "fetch", method, url, statusCode, requestBody, responseBody: "[streaming response - not captured]", isError, cause });
|
|
280
|
+
await handler({ type: "fetch", method, url, statusCode, requestBody, responseBody: "[streaming response - not captured]", isError, cause, duration });
|
|
191
281
|
return;
|
|
192
282
|
}
|
|
193
283
|
let responseBody;
|
|
@@ -207,18 +297,23 @@ async function handleFetchBreadcrumb(breadcrumb, hint, handler) {
|
|
|
207
297
|
if (breadcrumb.data) {
|
|
208
298
|
breadcrumb.data["responseBody"] = responseBody;
|
|
209
299
|
}
|
|
210
|
-
await handler({ type: "fetch", method, url, statusCode, requestBody, responseBody, isError, cause });
|
|
300
|
+
await handler({ type: "fetch", method, url, statusCode, requestBody, responseBody, isError, cause, duration });
|
|
211
301
|
}
|
|
212
302
|
function createNetworkObserver(opts, subscribers) {
|
|
213
303
|
const shouldIgnore = createUrlMatcher(opts.ignoreUrls);
|
|
214
304
|
const pgRestPatterns = opts.pgRestUrlPatterns ?? DEFAULT_PGREST_URL_PATTERNS;
|
|
215
305
|
const pgRestWhitelistCodes = opts.pgRestWhitelistCodes ?? DEFAULT_PGREST_WHITELIST_CODES;
|
|
306
|
+
const precedingBreadcrumbsLimit = opts.precedingBreadcrumbsLimit;
|
|
307
|
+
const authPatterns = opts.authUrlPatterns ?? DEFAULT_AUTH_URL_PATTERNS;
|
|
308
|
+
const authWhitelistCodes = opts.authWhitelistCodes ?? DEFAULT_AUTH_WHITELIST_CODES;
|
|
216
309
|
function tryDispatchPgRestWhitelistError(requestType, method, url, statusCode, requestBody, responseBody) {
|
|
217
310
|
if (statusCode == null) return;
|
|
218
311
|
if (!isPgRestRequest(url, pgRestPatterns)) return;
|
|
219
312
|
const pgRestError = parsePgRestErrorBody(responseBody);
|
|
220
313
|
if (!pgRestError) return;
|
|
221
314
|
if (pgRestWhitelistCodes.length > 0 && !pgRestWhitelistCodes.includes(pgRestError.code)) return;
|
|
315
|
+
const allBreadcrumbs = getIsolationScope().getScopeData().breadcrumbs;
|
|
316
|
+
const precedingBreadcrumbs = precedingBreadcrumbsLimit != null ? allBreadcrumbs.slice(-precedingBreadcrumbsLimit) : allBreadcrumbs.slice();
|
|
222
317
|
const info = {
|
|
223
318
|
type: requestType,
|
|
224
319
|
method,
|
|
@@ -226,10 +321,31 @@ function createNetworkObserver(opts, subscribers) {
|
|
|
226
321
|
statusCode,
|
|
227
322
|
pgRestError,
|
|
228
323
|
requestBody,
|
|
229
|
-
responseBody
|
|
324
|
+
responseBody,
|
|
325
|
+
precedingBreadcrumbs
|
|
230
326
|
};
|
|
231
327
|
for (const sub of subscribers) sub.onPgRestWhitelistError(info);
|
|
232
328
|
}
|
|
329
|
+
function tryDispatchAuthWhitelistError(requestType, method, url, statusCode, requestBody, responseBody) {
|
|
330
|
+
if (statusCode == null) return;
|
|
331
|
+
if (!isAuthRequest(url, authPatterns)) return;
|
|
332
|
+
const authError = parseAuthErrorBody(responseBody);
|
|
333
|
+
if (!authError) return;
|
|
334
|
+
if (authWhitelistCodes.length > 0 && !authWhitelistCodes.includes(authError.code)) return;
|
|
335
|
+
const allBreadcrumbs = getIsolationScope().getScopeData().breadcrumbs;
|
|
336
|
+
const precedingBreadcrumbs = precedingBreadcrumbsLimit != null ? allBreadcrumbs.slice(-precedingBreadcrumbsLimit) : allBreadcrumbs.slice();
|
|
337
|
+
const info = {
|
|
338
|
+
type: requestType,
|
|
339
|
+
method,
|
|
340
|
+
url,
|
|
341
|
+
statusCode,
|
|
342
|
+
authError,
|
|
343
|
+
requestBody,
|
|
344
|
+
responseBody,
|
|
345
|
+
precedingBreadcrumbs
|
|
346
|
+
};
|
|
347
|
+
for (const sub of subscribers) sub.onAuthWhitelistError(info);
|
|
348
|
+
}
|
|
233
349
|
function makeHandler(requestType) {
|
|
234
350
|
return (info) => {
|
|
235
351
|
for (const sub of subscribers) void sub.onNetworkRequest(info);
|
|
@@ -241,6 +357,14 @@ function createNetworkObserver(opts, subscribers) {
|
|
|
241
357
|
info.requestBody,
|
|
242
358
|
info.responseBody
|
|
243
359
|
);
|
|
360
|
+
tryDispatchAuthWhitelistError(
|
|
361
|
+
requestType,
|
|
362
|
+
info.method,
|
|
363
|
+
info.url,
|
|
364
|
+
info.statusCode,
|
|
365
|
+
info.requestBody,
|
|
366
|
+
info.responseBody
|
|
367
|
+
);
|
|
244
368
|
};
|
|
245
369
|
}
|
|
246
370
|
return {
|
|
@@ -253,10 +377,11 @@ function createNetworkObserver(opts, subscribers) {
|
|
|
253
377
|
const fetchHandler = makeHandler("fetch");
|
|
254
378
|
client.on("beforeAddBreadcrumb", (breadcrumb, hint) => {
|
|
255
379
|
const url = breadcrumb.data?.url ?? "";
|
|
256
|
-
if (shouldIgnore(url)) return;
|
|
257
380
|
if (breadcrumb.category === "xhr") {
|
|
381
|
+
if (shouldIgnore(url)) return;
|
|
258
382
|
handleXhrBreadcrumb(breadcrumb, hint, xhrHandler);
|
|
259
383
|
} else if (breadcrumb.category === "fetch") {
|
|
384
|
+
if (shouldIgnore(url)) return;
|
|
260
385
|
void handleFetchBreadcrumb(breadcrumb, hint, fetchHandler);
|
|
261
386
|
}
|
|
262
387
|
});
|
|
@@ -349,56 +474,10 @@ var PostMessageSubscriber = class {
|
|
|
349
474
|
};
|
|
350
475
|
this.send(msg, "*");
|
|
351
476
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
if (!isError && !isClientError) return;
|
|
355
|
-
const urlPath = extractUrlPath(url);
|
|
356
|
-
if (isError) {
|
|
357
|
-
const causeDesc = cause != null ? String(cause) : "NetworkError";
|
|
358
|
-
const errorMessage = `${method} ${urlPath} failed: ${causeDesc}`;
|
|
359
|
-
const msg = {
|
|
360
|
-
type: "GLOBAL_ERROR",
|
|
361
|
-
message: errorMessage,
|
|
362
|
-
error: cause != null ? { name: cause.name, message: cause.message, stack: cause.stack } : null,
|
|
363
|
-
errorData: {
|
|
364
|
-
name: cause?.name ?? "NetworkError",
|
|
365
|
-
message: cause?.message ?? causeDesc,
|
|
366
|
-
stack: cause?.stack ?? null,
|
|
367
|
-
fileName: url,
|
|
368
|
-
lineNumber: 0,
|
|
369
|
-
columnNumber: 0,
|
|
370
|
-
httpPath: urlPath,
|
|
371
|
-
httpStatus: 0,
|
|
372
|
-
httpMethod: method,
|
|
373
|
-
requestBody: requestBody ?? "",
|
|
374
|
-
responseBody: ""
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
this.send(msg, "*");
|
|
378
|
-
} else {
|
|
379
|
-
const errorMessage = `${method} ${urlPath} -> ${statusCode}`;
|
|
380
|
-
const msg = {
|
|
381
|
-
type: "GLOBAL_ERROR",
|
|
382
|
-
message: errorMessage,
|
|
383
|
-
error: null,
|
|
384
|
-
errorData: {
|
|
385
|
-
name: "HTTPClientError",
|
|
386
|
-
message: errorMessage,
|
|
387
|
-
stack: null,
|
|
388
|
-
fileName: url,
|
|
389
|
-
lineNumber: 0,
|
|
390
|
-
columnNumber: 0,
|
|
391
|
-
httpPath: urlPath,
|
|
392
|
-
httpStatus: statusCode,
|
|
393
|
-
httpMethod: method,
|
|
394
|
-
requestBody: requestBody ?? "",
|
|
395
|
-
responseBody: responseBody ?? ""
|
|
396
|
-
}
|
|
397
|
-
};
|
|
398
|
-
this.send(msg, "*");
|
|
399
|
-
}
|
|
477
|
+
// postMessage 场景不需要上报 network 日志
|
|
478
|
+
onNetworkRequest(_info) {
|
|
400
479
|
}
|
|
401
|
-
onPgRestWhitelistError({ type, method, url, statusCode, pgRestError, requestBody, responseBody }) {
|
|
480
|
+
onPgRestWhitelistError({ type, method, url, statusCode, pgRestError, requestBody, responseBody, precedingBreadcrumbs }) {
|
|
402
481
|
const urlPath = extractUrlPath(url);
|
|
403
482
|
const code = pgRestError.code;
|
|
404
483
|
const errorMessage = `${method} ${urlPath} -> ${statusCode} [PgRest:${code}]`;
|
|
@@ -421,7 +500,36 @@ var PostMessageSubscriber = class {
|
|
|
421
500
|
pgRestCode: code,
|
|
422
501
|
pgRestDetails: pgRestError.details ?? void 0,
|
|
423
502
|
pgRestHint: pgRestError.hint ?? void 0,
|
|
424
|
-
requestType: type
|
|
503
|
+
requestType: type,
|
|
504
|
+
precedingBreadcrumbs
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
this.send(msg, "*");
|
|
508
|
+
}
|
|
509
|
+
onAuthWhitelistError({ type, method, url, statusCode, authError, requestBody, responseBody, precedingBreadcrumbs }) {
|
|
510
|
+
const urlPath = extractUrlPath(url);
|
|
511
|
+
const code = authError.code;
|
|
512
|
+
const errorMessage = `${method} ${urlPath} -> ${statusCode} [Auth:${code}]`;
|
|
513
|
+
const msg = {
|
|
514
|
+
type: "GLOBAL_ERROR",
|
|
515
|
+
message: errorMessage,
|
|
516
|
+
error: null,
|
|
517
|
+
errorData: {
|
|
518
|
+
name: "AuthWhitelistError",
|
|
519
|
+
message: authError.message,
|
|
520
|
+
stack: null,
|
|
521
|
+
fileName: url,
|
|
522
|
+
lineNumber: 0,
|
|
523
|
+
columnNumber: 0,
|
|
524
|
+
httpPath: urlPath,
|
|
525
|
+
httpStatus: statusCode,
|
|
526
|
+
httpMethod: method,
|
|
527
|
+
requestBody: requestBody ?? "",
|
|
528
|
+
responseBody,
|
|
529
|
+
authCode: code,
|
|
530
|
+
authRequestId: authError.requestId ?? void 0,
|
|
531
|
+
requestType: type,
|
|
532
|
+
precedingBreadcrumbs
|
|
425
533
|
}
|
|
426
534
|
};
|
|
427
535
|
this.send(msg, "*");
|
|
@@ -434,7 +542,8 @@ function createPostMessageSubscriber(send) {
|
|
|
434
542
|
// src/stubs/sentry-react-stub.ts
|
|
435
543
|
export * from "@sentry/react";
|
|
436
544
|
var STUB_DSN = "https://stubPublicKey@o0.ingest.sentry.io/0";
|
|
437
|
-
var OVERRIDE_DSN =
|
|
545
|
+
var OVERRIDE_DSN = import.meta.env.VITE_SENTRY_DSN || STUB_DSN;
|
|
546
|
+
var OVERRIDE_ENVIRONMENT = import.meta.env.VITE_SENTRY_ENV;
|
|
438
547
|
var _subscribers = [createPostMessageSubscriber()];
|
|
439
548
|
function configureStubSubscribers(subscribers) {
|
|
440
549
|
_subscribers = subscribers;
|
|
@@ -452,6 +561,7 @@ var init2 = (options) => {
|
|
|
452
561
|
const result = RealSentry.init({
|
|
453
562
|
...options,
|
|
454
563
|
dsn: OVERRIDE_DSN,
|
|
564
|
+
environment: OVERRIDE_ENVIRONMENT,
|
|
455
565
|
beforeSend(event, hint) {
|
|
456
566
|
const processed = capture.beforeSend(event, hint);
|
|
457
567
|
return upstreamBeforeSend ? upstreamBeforeSend(processed, hint) : processed;
|
|
@@ -462,6 +572,15 @@ var init2 = (options) => {
|
|
|
462
572
|
return upstreamBeforeBreadcrumb ? upstreamBeforeBreadcrumb(processed, hint) : processed;
|
|
463
573
|
}
|
|
464
574
|
});
|
|
575
|
+
const stubTags = {
|
|
576
|
+
app_id: import.meta.env.VITE_APP_ID,
|
|
577
|
+
environment: OVERRIDE_ENVIRONMENT
|
|
578
|
+
};
|
|
579
|
+
for (const [key, value] of Object.entries(stubTags)) {
|
|
580
|
+
if (value) {
|
|
581
|
+
RealSentry.setTag(key, value);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
465
584
|
capture.installNetworkObserver();
|
|
466
585
|
capture.installConsoleObserver();
|
|
467
586
|
return result;
|
|
@@ -470,4 +589,3 @@ export {
|
|
|
470
589
|
configureStubSubscribers,
|
|
471
590
|
init2 as init
|
|
472
591
|
};
|
|
473
|
-
//# sourceMappingURL=sentry-react-stub.js.map
|