miaoda-react-devkit 0.1.1-beta.11 → 0.1.1-beta.13
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.cjs +114 -46
- package/dist/index.d.cts +60 -1
- package/dist/index.d.ts +60 -1
- package/dist/index.js +112 -46
- package/dist/stubs/sentry-react-stub.js +178 -47
- package/dist/vite/index.cjs +50 -59
- package/dist/vite/index.js +50 -59
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -28,6 +28,8 @@ __export(src_exports, {
|
|
|
28
28
|
DEFAULT_IGNORE_URLS: () => DEFAULT_IGNORE_URLS,
|
|
29
29
|
DEFAULT_PGREST_URL_PATTERNS: () => DEFAULT_PGREST_URL_PATTERNS,
|
|
30
30
|
DEFAULT_PGREST_WHITELIST_CODES: () => DEFAULT_PGREST_WHITELIST_CODES,
|
|
31
|
+
DEFAULT_STORAGE_URL_PATTERNS: () => DEFAULT_STORAGE_URL_PATTERNS,
|
|
32
|
+
DEFAULT_STORAGE_WHITELIST_ERRORS: () => DEFAULT_STORAGE_WHITELIST_ERRORS,
|
|
31
33
|
SentryCapture: () => SentryCapture,
|
|
32
34
|
createNoopSubscriber: () => createNoopSubscriber,
|
|
33
35
|
createPostMessageSubscriber: () => createPostMessageSubscriber,
|
|
@@ -217,11 +219,37 @@ function parseAuthErrorBody(body) {
|
|
|
217
219
|
};
|
|
218
220
|
}
|
|
219
221
|
|
|
222
|
+
// src/capture/storage.ts
|
|
223
|
+
var DEFAULT_STORAGE_URL_PATTERNS = [/\/storage\/v1\//];
|
|
224
|
+
var DEFAULT_STORAGE_WHITELIST_ERRORS = ["Unauthorized"];
|
|
225
|
+
function isStorageRequest(url, patterns) {
|
|
226
|
+
return patterns.some((p) => (typeof p === "string" ? new RegExp(p) : p).test(url));
|
|
227
|
+
}
|
|
228
|
+
function parseStorageErrorBody(body) {
|
|
229
|
+
if (!body) return null;
|
|
230
|
+
let parsed;
|
|
231
|
+
try {
|
|
232
|
+
parsed = JSON.parse(body);
|
|
233
|
+
} catch {
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
if (typeof parsed !== "object" || parsed === null) return null;
|
|
237
|
+
const p = parsed;
|
|
238
|
+
if (typeof p["statusCode"] !== "string") return null;
|
|
239
|
+
if (typeof p["error"] !== "string") return null;
|
|
240
|
+
if (typeof p["message"] !== "string") return null;
|
|
241
|
+
return {
|
|
242
|
+
statusCode: p["statusCode"],
|
|
243
|
+
error: p["error"],
|
|
244
|
+
message: p["message"]
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
|
|
220
248
|
// src/capture/network.ts
|
|
221
249
|
var BODY_TRUNCATE_LIMIT = 2e3;
|
|
222
250
|
function calcDuration(hint) {
|
|
223
251
|
if (hint?.startTimestamp == null || hint?.endTimestamp == null) return void 0;
|
|
224
|
-
return Math.round(
|
|
252
|
+
return Math.round(hint.endTimestamp - hint.startTimestamp);
|
|
225
253
|
}
|
|
226
254
|
var DEFAULT_IGNORE_URLS = [
|
|
227
255
|
/\.(js|css|png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf|eot|map)(\?.*)?$/,
|
|
@@ -336,58 +364,65 @@ function createNetworkObserver(opts, subscribers) {
|
|
|
336
364
|
const precedingBreadcrumbsLimit = opts.precedingBreadcrumbsLimit;
|
|
337
365
|
const authPatterns = opts.authUrlPatterns ?? DEFAULT_AUTH_URL_PATTERNS;
|
|
338
366
|
const authWhitelistCodes = opts.authWhitelistCodes ?? DEFAULT_AUTH_WHITELIST_CODES;
|
|
339
|
-
|
|
367
|
+
const storagePatterns = opts.storageUrlPatterns ?? DEFAULT_STORAGE_URL_PATTERNS;
|
|
368
|
+
const storageWhitelistErrors = opts.storageWhitelistErrors ?? DEFAULT_STORAGE_WHITELIST_ERRORS;
|
|
369
|
+
function tryDispatchError(requestType, method, url, statusCode, requestBody, responseBody) {
|
|
340
370
|
if (statusCode == null) return;
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
if (!pgRestError) return;
|
|
344
|
-
if (pgRestWhitelistCodes.length > 0 && !pgRestWhitelistCodes.includes(pgRestError.code)) return;
|
|
371
|
+
const errorRequestType = isPgRestRequest(url, pgRestPatterns) ? "pgrest" : isAuthRequest(url, authPatterns) ? "auth" : isStorageRequest(url, storagePatterns) ? "storage" : null;
|
|
372
|
+
if (!errorRequestType) return;
|
|
345
373
|
const allBreadcrumbs = (0, import_core3.getIsolationScope)().getScopeData().breadcrumbs;
|
|
346
374
|
const precedingBreadcrumbs = precedingBreadcrumbsLimit != null ? allBreadcrumbs.slice(-precedingBreadcrumbsLimit) : allBreadcrumbs.slice();
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
375
|
+
if (errorRequestType === "pgrest") {
|
|
376
|
+
const pgRestError = parsePgRestErrorBody(responseBody);
|
|
377
|
+
if (!pgRestError) return;
|
|
378
|
+
if (pgRestWhitelistCodes.length > 0 && !pgRestWhitelistCodes.includes(pgRestError.code)) return;
|
|
379
|
+
const info = {
|
|
380
|
+
type: requestType,
|
|
381
|
+
method,
|
|
382
|
+
url,
|
|
383
|
+
statusCode,
|
|
384
|
+
pgRestError,
|
|
385
|
+
requestBody,
|
|
386
|
+
responseBody,
|
|
387
|
+
precedingBreadcrumbs
|
|
388
|
+
};
|
|
389
|
+
for (const sub of subscribers) sub.onPgRestWhitelistError(info);
|
|
390
|
+
} else if (errorRequestType === "auth") {
|
|
391
|
+
const authError = parseAuthErrorBody(responseBody);
|
|
392
|
+
if (!authError) return;
|
|
393
|
+
if (authWhitelistCodes.length > 0 && !authWhitelistCodes.includes(authError.code)) return;
|
|
394
|
+
const info = {
|
|
395
|
+
type: requestType,
|
|
396
|
+
method,
|
|
397
|
+
url,
|
|
398
|
+
statusCode,
|
|
399
|
+
authError,
|
|
400
|
+
requestBody,
|
|
401
|
+
responseBody,
|
|
402
|
+
precedingBreadcrumbs
|
|
403
|
+
};
|
|
404
|
+
for (const sub of subscribers) sub.onAuthWhitelistError(info);
|
|
405
|
+
} else if (errorRequestType === "storage") {
|
|
406
|
+
const storageError = parseStorageErrorBody(responseBody);
|
|
407
|
+
if (!storageError) return;
|
|
408
|
+
if (storageWhitelistErrors.length > 0 && !storageWhitelistErrors.includes(storageError.error)) return;
|
|
409
|
+
const info = {
|
|
410
|
+
type: requestType,
|
|
411
|
+
method,
|
|
412
|
+
url,
|
|
413
|
+
statusCode,
|
|
414
|
+
storageError,
|
|
415
|
+
requestBody,
|
|
416
|
+
responseBody,
|
|
417
|
+
precedingBreadcrumbs
|
|
418
|
+
};
|
|
419
|
+
for (const sub of subscribers) sub.onStorageWhitelistError(info);
|
|
420
|
+
}
|
|
378
421
|
}
|
|
379
422
|
function makeHandler(requestType) {
|
|
380
423
|
return (info) => {
|
|
381
424
|
for (const sub of subscribers) void sub.onNetworkRequest(info);
|
|
382
|
-
|
|
383
|
-
requestType,
|
|
384
|
-
info.method,
|
|
385
|
-
info.url,
|
|
386
|
-
info.statusCode,
|
|
387
|
-
info.requestBody,
|
|
388
|
-
info.responseBody
|
|
389
|
-
);
|
|
390
|
-
tryDispatchAuthWhitelistError(
|
|
425
|
+
tryDispatchError(
|
|
391
426
|
requestType,
|
|
392
427
|
info.method,
|
|
393
428
|
info.url,
|
|
@@ -564,6 +599,33 @@ var PostMessageSubscriber = class {
|
|
|
564
599
|
};
|
|
565
600
|
this.send(msg, "*");
|
|
566
601
|
}
|
|
602
|
+
onStorageWhitelistError({ type, method, url, statusCode, storageError, requestBody, responseBody, precedingBreadcrumbs }) {
|
|
603
|
+
const urlPath = extractUrlPath(url);
|
|
604
|
+
const errorMessage = `${method} ${urlPath} -> ${statusCode} [Storage:${storageError.error}]`;
|
|
605
|
+
const msg = {
|
|
606
|
+
type: "GLOBAL_ERROR",
|
|
607
|
+
message: errorMessage,
|
|
608
|
+
error: null,
|
|
609
|
+
errorData: {
|
|
610
|
+
name: "StorageWhitelistError",
|
|
611
|
+
message: storageError.message,
|
|
612
|
+
stack: null,
|
|
613
|
+
fileName: url,
|
|
614
|
+
lineNumber: 0,
|
|
615
|
+
columnNumber: 0,
|
|
616
|
+
httpPath: urlPath,
|
|
617
|
+
httpStatus: statusCode,
|
|
618
|
+
httpMethod: method,
|
|
619
|
+
requestBody: requestBody ?? "",
|
|
620
|
+
responseBody,
|
|
621
|
+
storageError: storageError.error,
|
|
622
|
+
storageStatusCode: storageError.statusCode,
|
|
623
|
+
requestType: type,
|
|
624
|
+
precedingBreadcrumbs
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
this.send(msg, "*");
|
|
628
|
+
}
|
|
567
629
|
};
|
|
568
630
|
function createPostMessageSubscriber(send) {
|
|
569
631
|
return new PostMessageSubscriber(send);
|
|
@@ -581,6 +643,8 @@ function createNoopSubscriber() {
|
|
|
581
643
|
onPgRestWhitelistError() {
|
|
582
644
|
},
|
|
583
645
|
onAuthWhitelistError() {
|
|
646
|
+
},
|
|
647
|
+
onStorageWhitelistError() {
|
|
584
648
|
}
|
|
585
649
|
};
|
|
586
650
|
}
|
|
@@ -649,6 +713,8 @@ var SentryEventSubscriber = class {
|
|
|
649
713
|
}
|
|
650
714
|
onAuthWhitelistError(_info) {
|
|
651
715
|
}
|
|
716
|
+
onStorageWhitelistError(_info) {
|
|
717
|
+
}
|
|
652
718
|
};
|
|
653
719
|
function createSentryEventSubscriber(opts) {
|
|
654
720
|
return new SentryEventSubscriber(opts);
|
|
@@ -661,6 +727,8 @@ function createSentryEventSubscriber(opts) {
|
|
|
661
727
|
DEFAULT_IGNORE_URLS,
|
|
662
728
|
DEFAULT_PGREST_URL_PATTERNS,
|
|
663
729
|
DEFAULT_PGREST_WHITELIST_CODES,
|
|
730
|
+
DEFAULT_STORAGE_URL_PATTERNS,
|
|
731
|
+
DEFAULT_STORAGE_WHITELIST_ERRORS,
|
|
664
732
|
SentryCapture,
|
|
665
733
|
createNoopSubscriber,
|
|
666
734
|
createPostMessageSubscriber,
|
package/dist/index.d.cts
CHANGED
|
@@ -47,6 +47,28 @@ interface IAuthErrorBody {
|
|
|
47
47
|
message: string;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/** Supabase Storage 响应检测与错误体解析。 */
|
|
51
|
+
/**
|
|
52
|
+
* 默认匹配 Supabase Storage 的标准路径前缀。
|
|
53
|
+
* 可通过 ISentryCaptureOptions.storageUrlPatterns 覆盖。
|
|
54
|
+
*/
|
|
55
|
+
declare const DEFAULT_STORAGE_URL_PATTERNS: Array<string | RegExp>;
|
|
56
|
+
/**
|
|
57
|
+
* 白名单 Storage error 列表(匹配 error 字段)。
|
|
58
|
+
* 命中白名单的响应才触发 onStorageWhitelistError。
|
|
59
|
+
*
|
|
60
|
+
* TODO: 根据业务需要补充具体 error。格式示例:
|
|
61
|
+
* - 'Unauthorized'(行级安全策略拒绝)
|
|
62
|
+
*/
|
|
63
|
+
declare const DEFAULT_STORAGE_WHITELIST_ERRORS: string[];
|
|
64
|
+
/** Supabase Storage 标准错误响应体结构(HTTP 4xx/5xx 时返回)。 */
|
|
65
|
+
interface IStorageErrorBody {
|
|
66
|
+
/** HTTP 状态码字符串,如 '400'、'403' */
|
|
67
|
+
statusCode: string;
|
|
68
|
+
error: string;
|
|
69
|
+
message: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
50
72
|
/** Sentry 捕获模块共享类型定义。 */
|
|
51
73
|
|
|
52
74
|
interface IErrorCaptureInfo {
|
|
@@ -139,6 +161,25 @@ interface IAuthWhitelistErrorInfo {
|
|
|
139
161
|
/** 本次请求触发前 scope 中已积累的 breadcrumb 链路,用于还原用户操作路径。 */
|
|
140
162
|
precedingBreadcrumbs: Breadcrumb[];
|
|
141
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* 捕获到 Storage 白名单错误时的事件数据。
|
|
166
|
+
* 由 network observer 在响应体符合 Storage 结构且 error 字段命中白名单时构造并派发。
|
|
167
|
+
*/
|
|
168
|
+
interface IStorageWhitelistErrorInfo {
|
|
169
|
+
/** 请求类型 */
|
|
170
|
+
type: 'fetch' | 'xhr';
|
|
171
|
+
method: string;
|
|
172
|
+
url: string;
|
|
173
|
+
statusCode: number;
|
|
174
|
+
/** 解析后的 Storage 标准错误体 */
|
|
175
|
+
storageError: IStorageErrorBody;
|
|
176
|
+
/** 原始请求体文本 */
|
|
177
|
+
requestBody: string | undefined;
|
|
178
|
+
/** 原始响应体文本 */
|
|
179
|
+
responseBody: string;
|
|
180
|
+
/** 本次请求触发前 scope 中已积累的 breadcrumb 链路,用于还原用户操作路径。 */
|
|
181
|
+
precedingBreadcrumbs: Breadcrumb[];
|
|
182
|
+
}
|
|
142
183
|
/** SentryCapture 的初始化选项,仅包含过滤与端点配置;事件处理通过 subscribers 注入。 */
|
|
143
184
|
interface ISentryCaptureOptions {
|
|
144
185
|
/**
|
|
@@ -182,6 +223,16 @@ interface ISentryCaptureOptions {
|
|
|
182
223
|
* Auth error 白名单 error code 列表(可选,默认为 `DEFAULT_AUTH_WHITELIST_CODES`)。
|
|
183
224
|
*/
|
|
184
225
|
authWhitelistCodes?: string[];
|
|
226
|
+
/**
|
|
227
|
+
* 匹配 Storage 服务端点的 URL 模式(可选,默认为 `DEFAULT_STORAGE_URL_PATTERNS`)。
|
|
228
|
+
* 命中模式的请求会额外做 Storage 响应体解析,检查是否触发白名单错误事件。
|
|
229
|
+
*/
|
|
230
|
+
storageUrlPatterns?: Array<string | RegExp>;
|
|
231
|
+
/**
|
|
232
|
+
* Storage error 白名单列表(可选,默认为 `DEFAULT_STORAGE_WHITELIST_ERRORS`)。
|
|
233
|
+
* 响应体的 `error` 字段命中此列表时触发 subscriber 的 `onStorageWhitelistError`。
|
|
234
|
+
*/
|
|
235
|
+
storageWhitelistErrors?: string[];
|
|
185
236
|
}
|
|
186
237
|
|
|
187
238
|
/** 捕获事件订阅者接口与消息类型定义。 */
|
|
@@ -212,6 +263,11 @@ interface ICaptureSubscriber {
|
|
|
212
263
|
* 适用于需要对特定认证错误(如邮箱未确认、格式无效)做专项处理的场景。
|
|
213
264
|
*/
|
|
214
265
|
onAuthWhitelistError(info: IAuthWhitelistErrorInfo): void;
|
|
266
|
+
/**
|
|
267
|
+
* 请求命中 Storage 端点,且响应体 error 字段在白名单中时触发。
|
|
268
|
+
* 适用于需要对特定存储错误(如行级安全策略拒绝)做专项处理的场景。
|
|
269
|
+
*/
|
|
270
|
+
onStorageWhitelistError(info: IStorageWhitelistErrorInfo): void;
|
|
215
271
|
}
|
|
216
272
|
/** postMessage 发送函数,可注入替换(便于测试)。 */
|
|
217
273
|
interface GlobalErrorMessage {
|
|
@@ -242,6 +298,9 @@ interface GlobalErrorMessage {
|
|
|
242
298
|
/** AuthWhitelistError 专属字段 */
|
|
243
299
|
authCode?: string;
|
|
244
300
|
authRequestId?: string;
|
|
301
|
+
/** StorageWhitelistError 专属字段 */
|
|
302
|
+
storageError?: string;
|
|
303
|
+
storageStatusCode?: string;
|
|
245
304
|
precedingBreadcrumbs?: Breadcrumb[];
|
|
246
305
|
};
|
|
247
306
|
}
|
|
@@ -332,4 +391,4 @@ interface ISentryEventSubscriberOptions {
|
|
|
332
391
|
*/
|
|
333
392
|
declare function createSentryEventSubscriber(opts?: ISentryEventSubscriberOptions): ICaptureSubscriber;
|
|
334
393
|
|
|
335
|
-
export { DEFAULT_AUTH_URL_PATTERNS, DEFAULT_AUTH_WHITELIST_CODES, DEFAULT_CONSOLE_FILTER_KEYWORDS, DEFAULT_IGNORE_URLS, DEFAULT_PGREST_URL_PATTERNS, DEFAULT_PGREST_WHITELIST_CODES, type GlobalErrorMessage, type IAuthErrorBody, type IAuthWhitelistErrorInfo, type ICaptureSubscriber, type IConsoleCaptureInfo, type IErrorCaptureInfo, type INetworkRequestInfo, type IPgRestErrorBody, type IPgRestWhitelistErrorInfo, type ISentryCaptureOptions, type ISentryEventSubscriberOptions, type PostMessageFn, SentryCapture, createNoopSubscriber, createPostMessageSubscriber, createSentryEventSubscriber };
|
|
394
|
+
export { DEFAULT_AUTH_URL_PATTERNS, DEFAULT_AUTH_WHITELIST_CODES, DEFAULT_CONSOLE_FILTER_KEYWORDS, DEFAULT_IGNORE_URLS, DEFAULT_PGREST_URL_PATTERNS, DEFAULT_PGREST_WHITELIST_CODES, DEFAULT_STORAGE_URL_PATTERNS, DEFAULT_STORAGE_WHITELIST_ERRORS, type GlobalErrorMessage, type IAuthErrorBody, type IAuthWhitelistErrorInfo, type ICaptureSubscriber, type IConsoleCaptureInfo, type IErrorCaptureInfo, type INetworkRequestInfo, type IPgRestErrorBody, type IPgRestWhitelistErrorInfo, type ISentryCaptureOptions, type ISentryEventSubscriberOptions, type IStorageErrorBody, type IStorageWhitelistErrorInfo, type PostMessageFn, SentryCapture, createNoopSubscriber, createPostMessageSubscriber, createSentryEventSubscriber };
|
package/dist/index.d.ts
CHANGED
|
@@ -47,6 +47,28 @@ interface IAuthErrorBody {
|
|
|
47
47
|
message: string;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/** Supabase Storage 响应检测与错误体解析。 */
|
|
51
|
+
/**
|
|
52
|
+
* 默认匹配 Supabase Storage 的标准路径前缀。
|
|
53
|
+
* 可通过 ISentryCaptureOptions.storageUrlPatterns 覆盖。
|
|
54
|
+
*/
|
|
55
|
+
declare const DEFAULT_STORAGE_URL_PATTERNS: Array<string | RegExp>;
|
|
56
|
+
/**
|
|
57
|
+
* 白名单 Storage error 列表(匹配 error 字段)。
|
|
58
|
+
* 命中白名单的响应才触发 onStorageWhitelistError。
|
|
59
|
+
*
|
|
60
|
+
* TODO: 根据业务需要补充具体 error。格式示例:
|
|
61
|
+
* - 'Unauthorized'(行级安全策略拒绝)
|
|
62
|
+
*/
|
|
63
|
+
declare const DEFAULT_STORAGE_WHITELIST_ERRORS: string[];
|
|
64
|
+
/** Supabase Storage 标准错误响应体结构(HTTP 4xx/5xx 时返回)。 */
|
|
65
|
+
interface IStorageErrorBody {
|
|
66
|
+
/** HTTP 状态码字符串,如 '400'、'403' */
|
|
67
|
+
statusCode: string;
|
|
68
|
+
error: string;
|
|
69
|
+
message: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
50
72
|
/** Sentry 捕获模块共享类型定义。 */
|
|
51
73
|
|
|
52
74
|
interface IErrorCaptureInfo {
|
|
@@ -139,6 +161,25 @@ interface IAuthWhitelistErrorInfo {
|
|
|
139
161
|
/** 本次请求触发前 scope 中已积累的 breadcrumb 链路,用于还原用户操作路径。 */
|
|
140
162
|
precedingBreadcrumbs: Breadcrumb[];
|
|
141
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* 捕获到 Storage 白名单错误时的事件数据。
|
|
166
|
+
* 由 network observer 在响应体符合 Storage 结构且 error 字段命中白名单时构造并派发。
|
|
167
|
+
*/
|
|
168
|
+
interface IStorageWhitelistErrorInfo {
|
|
169
|
+
/** 请求类型 */
|
|
170
|
+
type: 'fetch' | 'xhr';
|
|
171
|
+
method: string;
|
|
172
|
+
url: string;
|
|
173
|
+
statusCode: number;
|
|
174
|
+
/** 解析后的 Storage 标准错误体 */
|
|
175
|
+
storageError: IStorageErrorBody;
|
|
176
|
+
/** 原始请求体文本 */
|
|
177
|
+
requestBody: string | undefined;
|
|
178
|
+
/** 原始响应体文本 */
|
|
179
|
+
responseBody: string;
|
|
180
|
+
/** 本次请求触发前 scope 中已积累的 breadcrumb 链路,用于还原用户操作路径。 */
|
|
181
|
+
precedingBreadcrumbs: Breadcrumb[];
|
|
182
|
+
}
|
|
142
183
|
/** SentryCapture 的初始化选项,仅包含过滤与端点配置;事件处理通过 subscribers 注入。 */
|
|
143
184
|
interface ISentryCaptureOptions {
|
|
144
185
|
/**
|
|
@@ -182,6 +223,16 @@ interface ISentryCaptureOptions {
|
|
|
182
223
|
* Auth error 白名单 error code 列表(可选,默认为 `DEFAULT_AUTH_WHITELIST_CODES`)。
|
|
183
224
|
*/
|
|
184
225
|
authWhitelistCodes?: string[];
|
|
226
|
+
/**
|
|
227
|
+
* 匹配 Storage 服务端点的 URL 模式(可选,默认为 `DEFAULT_STORAGE_URL_PATTERNS`)。
|
|
228
|
+
* 命中模式的请求会额外做 Storage 响应体解析,检查是否触发白名单错误事件。
|
|
229
|
+
*/
|
|
230
|
+
storageUrlPatterns?: Array<string | RegExp>;
|
|
231
|
+
/**
|
|
232
|
+
* Storage error 白名单列表(可选,默认为 `DEFAULT_STORAGE_WHITELIST_ERRORS`)。
|
|
233
|
+
* 响应体的 `error` 字段命中此列表时触发 subscriber 的 `onStorageWhitelistError`。
|
|
234
|
+
*/
|
|
235
|
+
storageWhitelistErrors?: string[];
|
|
185
236
|
}
|
|
186
237
|
|
|
187
238
|
/** 捕获事件订阅者接口与消息类型定义。 */
|
|
@@ -212,6 +263,11 @@ interface ICaptureSubscriber {
|
|
|
212
263
|
* 适用于需要对特定认证错误(如邮箱未确认、格式无效)做专项处理的场景。
|
|
213
264
|
*/
|
|
214
265
|
onAuthWhitelistError(info: IAuthWhitelistErrorInfo): void;
|
|
266
|
+
/**
|
|
267
|
+
* 请求命中 Storage 端点,且响应体 error 字段在白名单中时触发。
|
|
268
|
+
* 适用于需要对特定存储错误(如行级安全策略拒绝)做专项处理的场景。
|
|
269
|
+
*/
|
|
270
|
+
onStorageWhitelistError(info: IStorageWhitelistErrorInfo): void;
|
|
215
271
|
}
|
|
216
272
|
/** postMessage 发送函数,可注入替换(便于测试)。 */
|
|
217
273
|
interface GlobalErrorMessage {
|
|
@@ -242,6 +298,9 @@ interface GlobalErrorMessage {
|
|
|
242
298
|
/** AuthWhitelistError 专属字段 */
|
|
243
299
|
authCode?: string;
|
|
244
300
|
authRequestId?: string;
|
|
301
|
+
/** StorageWhitelistError 专属字段 */
|
|
302
|
+
storageError?: string;
|
|
303
|
+
storageStatusCode?: string;
|
|
245
304
|
precedingBreadcrumbs?: Breadcrumb[];
|
|
246
305
|
};
|
|
247
306
|
}
|
|
@@ -332,4 +391,4 @@ interface ISentryEventSubscriberOptions {
|
|
|
332
391
|
*/
|
|
333
392
|
declare function createSentryEventSubscriber(opts?: ISentryEventSubscriberOptions): ICaptureSubscriber;
|
|
334
393
|
|
|
335
|
-
export { DEFAULT_AUTH_URL_PATTERNS, DEFAULT_AUTH_WHITELIST_CODES, DEFAULT_CONSOLE_FILTER_KEYWORDS, DEFAULT_IGNORE_URLS, DEFAULT_PGREST_URL_PATTERNS, DEFAULT_PGREST_WHITELIST_CODES, type GlobalErrorMessage, type IAuthErrorBody, type IAuthWhitelistErrorInfo, type ICaptureSubscriber, type IConsoleCaptureInfo, type IErrorCaptureInfo, type INetworkRequestInfo, type IPgRestErrorBody, type IPgRestWhitelistErrorInfo, type ISentryCaptureOptions, type ISentryEventSubscriberOptions, type PostMessageFn, SentryCapture, createNoopSubscriber, createPostMessageSubscriber, createSentryEventSubscriber };
|
|
394
|
+
export { DEFAULT_AUTH_URL_PATTERNS, DEFAULT_AUTH_WHITELIST_CODES, DEFAULT_CONSOLE_FILTER_KEYWORDS, DEFAULT_IGNORE_URLS, DEFAULT_PGREST_URL_PATTERNS, DEFAULT_PGREST_WHITELIST_CODES, DEFAULT_STORAGE_URL_PATTERNS, DEFAULT_STORAGE_WHITELIST_ERRORS, type GlobalErrorMessage, type IAuthErrorBody, type IAuthWhitelistErrorInfo, type ICaptureSubscriber, type IConsoleCaptureInfo, type IErrorCaptureInfo, type INetworkRequestInfo, type IPgRestErrorBody, type IPgRestWhitelistErrorInfo, type ISentryCaptureOptions, type ISentryEventSubscriberOptions, type IStorageErrorBody, type IStorageWhitelistErrorInfo, type PostMessageFn, SentryCapture, createNoopSubscriber, createPostMessageSubscriber, createSentryEventSubscriber };
|
package/dist/index.js
CHANGED
|
@@ -184,11 +184,37 @@ function parseAuthErrorBody(body) {
|
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
// src/capture/storage.ts
|
|
188
|
+
var DEFAULT_STORAGE_URL_PATTERNS = [/\/storage\/v1\//];
|
|
189
|
+
var DEFAULT_STORAGE_WHITELIST_ERRORS = ["Unauthorized"];
|
|
190
|
+
function isStorageRequest(url, patterns) {
|
|
191
|
+
return patterns.some((p) => (typeof p === "string" ? new RegExp(p) : p).test(url));
|
|
192
|
+
}
|
|
193
|
+
function parseStorageErrorBody(body) {
|
|
194
|
+
if (!body) return null;
|
|
195
|
+
let parsed;
|
|
196
|
+
try {
|
|
197
|
+
parsed = JSON.parse(body);
|
|
198
|
+
} catch {
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
if (typeof parsed !== "object" || parsed === null) return null;
|
|
202
|
+
const p = parsed;
|
|
203
|
+
if (typeof p["statusCode"] !== "string") return null;
|
|
204
|
+
if (typeof p["error"] !== "string") return null;
|
|
205
|
+
if (typeof p["message"] !== "string") return null;
|
|
206
|
+
return {
|
|
207
|
+
statusCode: p["statusCode"],
|
|
208
|
+
error: p["error"],
|
|
209
|
+
message: p["message"]
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
187
213
|
// src/capture/network.ts
|
|
188
214
|
var BODY_TRUNCATE_LIMIT = 2e3;
|
|
189
215
|
function calcDuration(hint) {
|
|
190
216
|
if (hint?.startTimestamp == null || hint?.endTimestamp == null) return void 0;
|
|
191
|
-
return Math.round(
|
|
217
|
+
return Math.round(hint.endTimestamp - hint.startTimestamp);
|
|
192
218
|
}
|
|
193
219
|
var DEFAULT_IGNORE_URLS = [
|
|
194
220
|
/\.(js|css|png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf|eot|map)(\?.*)?$/,
|
|
@@ -303,58 +329,65 @@ function createNetworkObserver(opts, subscribers) {
|
|
|
303
329
|
const precedingBreadcrumbsLimit = opts.precedingBreadcrumbsLimit;
|
|
304
330
|
const authPatterns = opts.authUrlPatterns ?? DEFAULT_AUTH_URL_PATTERNS;
|
|
305
331
|
const authWhitelistCodes = opts.authWhitelistCodes ?? DEFAULT_AUTH_WHITELIST_CODES;
|
|
306
|
-
|
|
332
|
+
const storagePatterns = opts.storageUrlPatterns ?? DEFAULT_STORAGE_URL_PATTERNS;
|
|
333
|
+
const storageWhitelistErrors = opts.storageWhitelistErrors ?? DEFAULT_STORAGE_WHITELIST_ERRORS;
|
|
334
|
+
function tryDispatchError(requestType, method, url, statusCode, requestBody, responseBody) {
|
|
307
335
|
if (statusCode == null) return;
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
if (!pgRestError) return;
|
|
311
|
-
if (pgRestWhitelistCodes.length > 0 && !pgRestWhitelistCodes.includes(pgRestError.code)) return;
|
|
336
|
+
const errorRequestType = isPgRestRequest(url, pgRestPatterns) ? "pgrest" : isAuthRequest(url, authPatterns) ? "auth" : isStorageRequest(url, storagePatterns) ? "storage" : null;
|
|
337
|
+
if (!errorRequestType) return;
|
|
312
338
|
const allBreadcrumbs = getIsolationScope().getScopeData().breadcrumbs;
|
|
313
339
|
const precedingBreadcrumbs = precedingBreadcrumbsLimit != null ? allBreadcrumbs.slice(-precedingBreadcrumbsLimit) : allBreadcrumbs.slice();
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
340
|
+
if (errorRequestType === "pgrest") {
|
|
341
|
+
const pgRestError = parsePgRestErrorBody(responseBody);
|
|
342
|
+
if (!pgRestError) return;
|
|
343
|
+
if (pgRestWhitelistCodes.length > 0 && !pgRestWhitelistCodes.includes(pgRestError.code)) return;
|
|
344
|
+
const info = {
|
|
345
|
+
type: requestType,
|
|
346
|
+
method,
|
|
347
|
+
url,
|
|
348
|
+
statusCode,
|
|
349
|
+
pgRestError,
|
|
350
|
+
requestBody,
|
|
351
|
+
responseBody,
|
|
352
|
+
precedingBreadcrumbs
|
|
353
|
+
};
|
|
354
|
+
for (const sub of subscribers) sub.onPgRestWhitelistError(info);
|
|
355
|
+
} else if (errorRequestType === "auth") {
|
|
356
|
+
const authError = parseAuthErrorBody(responseBody);
|
|
357
|
+
if (!authError) return;
|
|
358
|
+
if (authWhitelistCodes.length > 0 && !authWhitelistCodes.includes(authError.code)) return;
|
|
359
|
+
const info = {
|
|
360
|
+
type: requestType,
|
|
361
|
+
method,
|
|
362
|
+
url,
|
|
363
|
+
statusCode,
|
|
364
|
+
authError,
|
|
365
|
+
requestBody,
|
|
366
|
+
responseBody,
|
|
367
|
+
precedingBreadcrumbs
|
|
368
|
+
};
|
|
369
|
+
for (const sub of subscribers) sub.onAuthWhitelistError(info);
|
|
370
|
+
} else if (errorRequestType === "storage") {
|
|
371
|
+
const storageError = parseStorageErrorBody(responseBody);
|
|
372
|
+
if (!storageError) return;
|
|
373
|
+
if (storageWhitelistErrors.length > 0 && !storageWhitelistErrors.includes(storageError.error)) return;
|
|
374
|
+
const info = {
|
|
375
|
+
type: requestType,
|
|
376
|
+
method,
|
|
377
|
+
url,
|
|
378
|
+
statusCode,
|
|
379
|
+
storageError,
|
|
380
|
+
requestBody,
|
|
381
|
+
responseBody,
|
|
382
|
+
precedingBreadcrumbs
|
|
383
|
+
};
|
|
384
|
+
for (const sub of subscribers) sub.onStorageWhitelistError(info);
|
|
385
|
+
}
|
|
345
386
|
}
|
|
346
387
|
function makeHandler(requestType) {
|
|
347
388
|
return (info) => {
|
|
348
389
|
for (const sub of subscribers) void sub.onNetworkRequest(info);
|
|
349
|
-
|
|
350
|
-
requestType,
|
|
351
|
-
info.method,
|
|
352
|
-
info.url,
|
|
353
|
-
info.statusCode,
|
|
354
|
-
info.requestBody,
|
|
355
|
-
info.responseBody
|
|
356
|
-
);
|
|
357
|
-
tryDispatchAuthWhitelistError(
|
|
390
|
+
tryDispatchError(
|
|
358
391
|
requestType,
|
|
359
392
|
info.method,
|
|
360
393
|
info.url,
|
|
@@ -531,6 +564,33 @@ var PostMessageSubscriber = class {
|
|
|
531
564
|
};
|
|
532
565
|
this.send(msg, "*");
|
|
533
566
|
}
|
|
567
|
+
onStorageWhitelistError({ type, method, url, statusCode, storageError, requestBody, responseBody, precedingBreadcrumbs }) {
|
|
568
|
+
const urlPath = extractUrlPath(url);
|
|
569
|
+
const errorMessage = `${method} ${urlPath} -> ${statusCode} [Storage:${storageError.error}]`;
|
|
570
|
+
const msg = {
|
|
571
|
+
type: "GLOBAL_ERROR",
|
|
572
|
+
message: errorMessage,
|
|
573
|
+
error: null,
|
|
574
|
+
errorData: {
|
|
575
|
+
name: "StorageWhitelistError",
|
|
576
|
+
message: storageError.message,
|
|
577
|
+
stack: null,
|
|
578
|
+
fileName: url,
|
|
579
|
+
lineNumber: 0,
|
|
580
|
+
columnNumber: 0,
|
|
581
|
+
httpPath: urlPath,
|
|
582
|
+
httpStatus: statusCode,
|
|
583
|
+
httpMethod: method,
|
|
584
|
+
requestBody: requestBody ?? "",
|
|
585
|
+
responseBody,
|
|
586
|
+
storageError: storageError.error,
|
|
587
|
+
storageStatusCode: storageError.statusCode,
|
|
588
|
+
requestType: type,
|
|
589
|
+
precedingBreadcrumbs
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
this.send(msg, "*");
|
|
593
|
+
}
|
|
534
594
|
};
|
|
535
595
|
function createPostMessageSubscriber(send) {
|
|
536
596
|
return new PostMessageSubscriber(send);
|
|
@@ -548,6 +608,8 @@ function createNoopSubscriber() {
|
|
|
548
608
|
onPgRestWhitelistError() {
|
|
549
609
|
},
|
|
550
610
|
onAuthWhitelistError() {
|
|
611
|
+
},
|
|
612
|
+
onStorageWhitelistError() {
|
|
551
613
|
}
|
|
552
614
|
};
|
|
553
615
|
}
|
|
@@ -616,6 +678,8 @@ var SentryEventSubscriber = class {
|
|
|
616
678
|
}
|
|
617
679
|
onAuthWhitelistError(_info) {
|
|
618
680
|
}
|
|
681
|
+
onStorageWhitelistError(_info) {
|
|
682
|
+
}
|
|
619
683
|
};
|
|
620
684
|
function createSentryEventSubscriber(opts) {
|
|
621
685
|
return new SentryEventSubscriber(opts);
|
|
@@ -627,6 +691,8 @@ export {
|
|
|
627
691
|
DEFAULT_IGNORE_URLS,
|
|
628
692
|
DEFAULT_PGREST_URL_PATTERNS,
|
|
629
693
|
DEFAULT_PGREST_WHITELIST_CODES,
|
|
694
|
+
DEFAULT_STORAGE_URL_PATTERNS,
|
|
695
|
+
DEFAULT_STORAGE_WHITELIST_ERRORS,
|
|
630
696
|
SentryCapture,
|
|
631
697
|
createNoopSubscriber,
|
|
632
698
|
createPostMessageSubscriber,
|
|
@@ -187,11 +187,37 @@ function parseAuthErrorBody(body) {
|
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
// src/capture/storage.ts
|
|
191
|
+
var DEFAULT_STORAGE_URL_PATTERNS = [/\/storage\/v1\//];
|
|
192
|
+
var DEFAULT_STORAGE_WHITELIST_ERRORS = ["Unauthorized"];
|
|
193
|
+
function isStorageRequest(url, patterns) {
|
|
194
|
+
return patterns.some((p) => (typeof p === "string" ? new RegExp(p) : p).test(url));
|
|
195
|
+
}
|
|
196
|
+
function parseStorageErrorBody(body) {
|
|
197
|
+
if (!body) return null;
|
|
198
|
+
let parsed;
|
|
199
|
+
try {
|
|
200
|
+
parsed = JSON.parse(body);
|
|
201
|
+
} catch {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
if (typeof parsed !== "object" || parsed === null) return null;
|
|
205
|
+
const p = parsed;
|
|
206
|
+
if (typeof p["statusCode"] !== "string") return null;
|
|
207
|
+
if (typeof p["error"] !== "string") return null;
|
|
208
|
+
if (typeof p["message"] !== "string") return null;
|
|
209
|
+
return {
|
|
210
|
+
statusCode: p["statusCode"],
|
|
211
|
+
error: p["error"],
|
|
212
|
+
message: p["message"]
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
190
216
|
// src/capture/network.ts
|
|
191
217
|
var BODY_TRUNCATE_LIMIT = 2e3;
|
|
192
218
|
function calcDuration(hint) {
|
|
193
219
|
if (hint?.startTimestamp == null || hint?.endTimestamp == null) return void 0;
|
|
194
|
-
return Math.round(
|
|
220
|
+
return Math.round(hint.endTimestamp - hint.startTimestamp);
|
|
195
221
|
}
|
|
196
222
|
var DEFAULT_IGNORE_URLS = [
|
|
197
223
|
/\.(js|css|png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf|eot|map)(\?.*)?$/,
|
|
@@ -306,58 +332,65 @@ function createNetworkObserver(opts, subscribers) {
|
|
|
306
332
|
const precedingBreadcrumbsLimit = opts.precedingBreadcrumbsLimit;
|
|
307
333
|
const authPatterns = opts.authUrlPatterns ?? DEFAULT_AUTH_URL_PATTERNS;
|
|
308
334
|
const authWhitelistCodes = opts.authWhitelistCodes ?? DEFAULT_AUTH_WHITELIST_CODES;
|
|
309
|
-
|
|
335
|
+
const storagePatterns = opts.storageUrlPatterns ?? DEFAULT_STORAGE_URL_PATTERNS;
|
|
336
|
+
const storageWhitelistErrors = opts.storageWhitelistErrors ?? DEFAULT_STORAGE_WHITELIST_ERRORS;
|
|
337
|
+
function tryDispatchError(requestType, method, url, statusCode, requestBody, responseBody) {
|
|
310
338
|
if (statusCode == null) return;
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
if (!pgRestError) return;
|
|
314
|
-
if (pgRestWhitelistCodes.length > 0 && !pgRestWhitelistCodes.includes(pgRestError.code)) return;
|
|
339
|
+
const errorRequestType = isPgRestRequest(url, pgRestPatterns) ? "pgrest" : isAuthRequest(url, authPatterns) ? "auth" : isStorageRequest(url, storagePatterns) ? "storage" : null;
|
|
340
|
+
if (!errorRequestType) return;
|
|
315
341
|
const allBreadcrumbs = getIsolationScope().getScopeData().breadcrumbs;
|
|
316
342
|
const precedingBreadcrumbs = precedingBreadcrumbsLimit != null ? allBreadcrumbs.slice(-precedingBreadcrumbsLimit) : allBreadcrumbs.slice();
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
343
|
+
if (errorRequestType === "pgrest") {
|
|
344
|
+
const pgRestError = parsePgRestErrorBody(responseBody);
|
|
345
|
+
if (!pgRestError) return;
|
|
346
|
+
if (pgRestWhitelistCodes.length > 0 && !pgRestWhitelistCodes.includes(pgRestError.code)) return;
|
|
347
|
+
const info = {
|
|
348
|
+
type: requestType,
|
|
349
|
+
method,
|
|
350
|
+
url,
|
|
351
|
+
statusCode,
|
|
352
|
+
pgRestError,
|
|
353
|
+
requestBody,
|
|
354
|
+
responseBody,
|
|
355
|
+
precedingBreadcrumbs
|
|
356
|
+
};
|
|
357
|
+
for (const sub of subscribers) sub.onPgRestWhitelistError(info);
|
|
358
|
+
} else if (errorRequestType === "auth") {
|
|
359
|
+
const authError = parseAuthErrorBody(responseBody);
|
|
360
|
+
if (!authError) return;
|
|
361
|
+
if (authWhitelistCodes.length > 0 && !authWhitelistCodes.includes(authError.code)) return;
|
|
362
|
+
const info = {
|
|
363
|
+
type: requestType,
|
|
364
|
+
method,
|
|
365
|
+
url,
|
|
366
|
+
statusCode,
|
|
367
|
+
authError,
|
|
368
|
+
requestBody,
|
|
369
|
+
responseBody,
|
|
370
|
+
precedingBreadcrumbs
|
|
371
|
+
};
|
|
372
|
+
for (const sub of subscribers) sub.onAuthWhitelistError(info);
|
|
373
|
+
} else if (errorRequestType === "storage") {
|
|
374
|
+
const storageError = parseStorageErrorBody(responseBody);
|
|
375
|
+
if (!storageError) return;
|
|
376
|
+
if (storageWhitelistErrors.length > 0 && !storageWhitelistErrors.includes(storageError.error)) return;
|
|
377
|
+
const info = {
|
|
378
|
+
type: requestType,
|
|
379
|
+
method,
|
|
380
|
+
url,
|
|
381
|
+
statusCode,
|
|
382
|
+
storageError,
|
|
383
|
+
requestBody,
|
|
384
|
+
responseBody,
|
|
385
|
+
precedingBreadcrumbs
|
|
386
|
+
};
|
|
387
|
+
for (const sub of subscribers) sub.onStorageWhitelistError(info);
|
|
388
|
+
}
|
|
348
389
|
}
|
|
349
390
|
function makeHandler(requestType) {
|
|
350
391
|
return (info) => {
|
|
351
392
|
for (const sub of subscribers) void sub.onNetworkRequest(info);
|
|
352
|
-
|
|
353
|
-
requestType,
|
|
354
|
-
info.method,
|
|
355
|
-
info.url,
|
|
356
|
-
info.statusCode,
|
|
357
|
-
info.requestBody,
|
|
358
|
-
info.responseBody
|
|
359
|
-
);
|
|
360
|
-
tryDispatchAuthWhitelistError(
|
|
393
|
+
tryDispatchError(
|
|
361
394
|
requestType,
|
|
362
395
|
info.method,
|
|
363
396
|
info.url,
|
|
@@ -534,17 +567,115 @@ var PostMessageSubscriber = class {
|
|
|
534
567
|
};
|
|
535
568
|
this.send(msg, "*");
|
|
536
569
|
}
|
|
570
|
+
onStorageWhitelistError({ type, method, url, statusCode, storageError, requestBody, responseBody, precedingBreadcrumbs }) {
|
|
571
|
+
const urlPath = extractUrlPath(url);
|
|
572
|
+
const errorMessage = `${method} ${urlPath} -> ${statusCode} [Storage:${storageError.error}]`;
|
|
573
|
+
const msg = {
|
|
574
|
+
type: "GLOBAL_ERROR",
|
|
575
|
+
message: errorMessage,
|
|
576
|
+
error: null,
|
|
577
|
+
errorData: {
|
|
578
|
+
name: "StorageWhitelistError",
|
|
579
|
+
message: storageError.message,
|
|
580
|
+
stack: null,
|
|
581
|
+
fileName: url,
|
|
582
|
+
lineNumber: 0,
|
|
583
|
+
columnNumber: 0,
|
|
584
|
+
httpPath: urlPath,
|
|
585
|
+
httpStatus: statusCode,
|
|
586
|
+
httpMethod: method,
|
|
587
|
+
requestBody: requestBody ?? "",
|
|
588
|
+
responseBody,
|
|
589
|
+
storageError: storageError.error,
|
|
590
|
+
storageStatusCode: storageError.statusCode,
|
|
591
|
+
requestType: type,
|
|
592
|
+
precedingBreadcrumbs
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
this.send(msg, "*");
|
|
596
|
+
}
|
|
537
597
|
};
|
|
538
598
|
function createPostMessageSubscriber(send) {
|
|
539
599
|
return new PostMessageSubscriber(send);
|
|
540
600
|
}
|
|
541
601
|
|
|
602
|
+
// src/subscribers/sentryEventSubscriber.ts
|
|
603
|
+
import { captureEvent } from "@sentry/core";
|
|
604
|
+
function toSentryLevel(consoleLevel) {
|
|
605
|
+
switch (consoleLevel) {
|
|
606
|
+
case "error":
|
|
607
|
+
return "error";
|
|
608
|
+
case "warn":
|
|
609
|
+
return "warning";
|
|
610
|
+
case "debug":
|
|
611
|
+
return "debug";
|
|
612
|
+
case "info":
|
|
613
|
+
return "info";
|
|
614
|
+
default:
|
|
615
|
+
return "log";
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
var SentryEventSubscriber = class {
|
|
619
|
+
constructor(opts = {}) {
|
|
620
|
+
__publicField(this, "captureAllNetworkRequests");
|
|
621
|
+
this.captureAllNetworkRequests = opts.captureAllNetworkRequests ?? true;
|
|
622
|
+
}
|
|
623
|
+
onConsole(info) {
|
|
624
|
+
const { level, args } = info;
|
|
625
|
+
const formattedMessage = formatConsoleArgs(args);
|
|
626
|
+
const sentryLevel = toSentryLevel(level);
|
|
627
|
+
captureEvent({
|
|
628
|
+
message: `[${level}]${formattedMessage}`,
|
|
629
|
+
level: sentryLevel,
|
|
630
|
+
// 按 level + 消息内容前 100 字符分组,同一类日志聚合为同一个 Issue
|
|
631
|
+
fingerprint: ["console", level, formattedMessage.slice(0, 100)],
|
|
632
|
+
tags: {
|
|
633
|
+
type: "console"
|
|
634
|
+
},
|
|
635
|
+
extra: { consoleType: level, args }
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
// Sentry 已自动捕获 JS 错误,不重复上报
|
|
639
|
+
onError(_info) {
|
|
640
|
+
}
|
|
641
|
+
onNetworkRequest(info) {
|
|
642
|
+
const { type, method, url, statusCode, requestBody, responseBody, isError, duration } = info;
|
|
643
|
+
const shouldCapture = this.captureAllNetworkRequests || isError || statusCode != null && statusCode >= 400;
|
|
644
|
+
if (!shouldCapture) return;
|
|
645
|
+
const urlPath = stripUrlOrigin(url);
|
|
646
|
+
const requestTypeLabel = type === "xhr" ? "XHR" : "Fetch";
|
|
647
|
+
const statusStr = statusCode != null ? String(statusCode) : "failed";
|
|
648
|
+
const durationStr = duration != null ? ` (${duration}ms)` : "";
|
|
649
|
+
const message = `${requestTypeLabel} ${method} ${urlPath} -> ${statusStr}${durationStr}`;
|
|
650
|
+
const level = isError ? "error" : statusCode != null && statusCode >= 400 ? "warning" : "info";
|
|
651
|
+
captureEvent({
|
|
652
|
+
message,
|
|
653
|
+
level,
|
|
654
|
+
// 按 method + url 路径固定分组,同一接口的多次报错聚合为同一个 Issue
|
|
655
|
+
fingerprint: ["network", method, urlPath],
|
|
656
|
+
tags: {
|
|
657
|
+
type: "network"
|
|
658
|
+
},
|
|
659
|
+
extra: { url, method, statusCode, duration, requestBody, responseBody }
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
onPgRestWhitelistError(_info) {
|
|
663
|
+
}
|
|
664
|
+
onAuthWhitelistError(_info) {
|
|
665
|
+
}
|
|
666
|
+
onStorageWhitelistError(_info) {
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
function createSentryEventSubscriber(opts) {
|
|
670
|
+
return new SentryEventSubscriber(opts);
|
|
671
|
+
}
|
|
672
|
+
|
|
542
673
|
// src/stubs/sentry-react-stub.ts
|
|
543
674
|
export * from "@sentry/react";
|
|
544
675
|
var STUB_DSN = "https://stubPublicKey@o0.ingest.sentry.io/0";
|
|
545
676
|
var OVERRIDE_DSN = import.meta.env.VITE_SENTRY_DSN || STUB_DSN;
|
|
546
677
|
var OVERRIDE_ENVIRONMENT = import.meta.env.VITE_SENTRY_ENV;
|
|
547
|
-
var _subscribers = [createPostMessageSubscriber()];
|
|
678
|
+
var _subscribers = [createPostMessageSubscriber(), createSentryEventSubscriber()];
|
|
548
679
|
function configureStubSubscribers(subscribers) {
|
|
549
680
|
_subscribers = subscribers;
|
|
550
681
|
}
|
package/dist/vite/index.cjs
CHANGED
|
@@ -214,6 +214,51 @@ var collectDeps = (mod, seen = /* @__PURE__ */ new Set()) => {
|
|
|
214
214
|
|
|
215
215
|
// src/vite/extractRouterPlugin/routeTransform.ts
|
|
216
216
|
var t2 = __toESM(require("@babel/types"), 1);
|
|
217
|
+
var findResolvableJSXComponent = (jsxEl, importMap, lazyImportMap) => {
|
|
218
|
+
const dfs = (el, map) => {
|
|
219
|
+
const nameNode = el.openingElement.name;
|
|
220
|
+
if (t2.isJSXIdentifier(nameNode) && map.has(nameNode.name)) return nameNode.name;
|
|
221
|
+
for (const child of el.children) {
|
|
222
|
+
if (t2.isJSXElement(child)) {
|
|
223
|
+
const found = dfs(child, map);
|
|
224
|
+
if (found) return found;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return "";
|
|
228
|
+
};
|
|
229
|
+
return dfs(jsxEl, lazyImportMap) || dfs(jsxEl, importMap) || (t2.isJSXIdentifier(jsxEl.openingElement.name) ? jsxEl.openingElement.name.name : "");
|
|
230
|
+
};
|
|
231
|
+
var eachTree = (tree, iterator, level = 1, parents = []) => {
|
|
232
|
+
for (let i = 0; i < tree.length; i++) {
|
|
233
|
+
const item = tree[i];
|
|
234
|
+
const result = iterator(item, i, level, parents);
|
|
235
|
+
if (result === "break") break;
|
|
236
|
+
if (result === "continue") continue;
|
|
237
|
+
if (Array.isArray(item.children)) {
|
|
238
|
+
eachTree(item.children, iterator, level + 1, parents.concat(item));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
var flattenTree = (tree, mapper) => {
|
|
243
|
+
const result = [];
|
|
244
|
+
eachTree(tree, (item, index, level, parents) => result.push(mapper(item, index, level, parents)));
|
|
245
|
+
return result;
|
|
246
|
+
};
|
|
247
|
+
var flattenRouteTree = (routes) => {
|
|
248
|
+
return flattenTree(routes, (item) => {
|
|
249
|
+
if ("pageId" in item) return item;
|
|
250
|
+
return {
|
|
251
|
+
title: item.title,
|
|
252
|
+
pageId: item.path,
|
|
253
|
+
pageName: item.path
|
|
254
|
+
};
|
|
255
|
+
});
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
// src/vite/extractRouterPlugin/valueResolver.ts
|
|
259
|
+
var t3 = __toESM(require("@babel/types"), 1);
|
|
260
|
+
var import_fs2 = __toESM(require("fs"), 1);
|
|
261
|
+
var import_path2 = __toESM(require("path"), 1);
|
|
217
262
|
|
|
218
263
|
// src/vite/extractRouterPlugin/pathUtils.ts
|
|
219
264
|
var import_fs = __toESM(require("fs"), 1);
|
|
@@ -281,56 +326,7 @@ var normalizeFilePath = (filePath, projectRoot) => {
|
|
|
281
326
|
return normalized.replace(/\.(tsx?|jsx?)$/, "");
|
|
282
327
|
};
|
|
283
328
|
|
|
284
|
-
// src/vite/extractRouterPlugin/routeTransform.ts
|
|
285
|
-
var findResolvableJSXComponent = (jsxEl, importMap, lazyImportMap) => {
|
|
286
|
-
const dfs = (el, map) => {
|
|
287
|
-
const nameNode = el.openingElement.name;
|
|
288
|
-
if (t2.isJSXIdentifier(nameNode) && map.has(nameNode.name)) return nameNode.name;
|
|
289
|
-
for (const child of el.children) {
|
|
290
|
-
if (t2.isJSXElement(child)) {
|
|
291
|
-
const found = dfs(child, map);
|
|
292
|
-
if (found) return found;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
return "";
|
|
296
|
-
};
|
|
297
|
-
return dfs(jsxEl, lazyImportMap) || dfs(jsxEl, importMap) || (t2.isJSXIdentifier(jsxEl.openingElement.name) ? jsxEl.openingElement.name.name : "");
|
|
298
|
-
};
|
|
299
|
-
var eachTree = (tree, iterator, level = 1, parents = []) => {
|
|
300
|
-
for (let i = 0; i < tree.length; i++) {
|
|
301
|
-
const item = tree[i];
|
|
302
|
-
const result = iterator(item, i, level, parents);
|
|
303
|
-
if (result === "break") break;
|
|
304
|
-
if (result === "continue") continue;
|
|
305
|
-
if (Array.isArray(item.children)) {
|
|
306
|
-
eachTree(item.children, iterator, level + 1, parents.concat(item));
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
var flattenTree = (tree, mapper) => {
|
|
311
|
-
const result = [];
|
|
312
|
-
eachTree(tree, (item, index, level, parents) => result.push(mapper(item, index, level, parents)));
|
|
313
|
-
return result;
|
|
314
|
-
};
|
|
315
|
-
var flattenRouteTree = (routes, option) => {
|
|
316
|
-
const { importMap, lazyImportMap, aliasMap } = option;
|
|
317
|
-
return flattenTree(routes, (item) => {
|
|
318
|
-
if ("pageId" in item) return item;
|
|
319
|
-
const componentName = item.filePath;
|
|
320
|
-
const componentPath = lazyImportMap.get(componentName) ?? importMap.get(componentName) ?? "";
|
|
321
|
-
return {
|
|
322
|
-
title: item.title,
|
|
323
|
-
pageId: item.path,
|
|
324
|
-
pageName: item.path,
|
|
325
|
-
path: toSrcPath(componentPath, aliasMap)
|
|
326
|
-
};
|
|
327
|
-
});
|
|
328
|
-
};
|
|
329
|
-
|
|
330
329
|
// src/vite/extractRouterPlugin/valueResolver.ts
|
|
331
|
-
var t3 = __toESM(require("@babel/types"), 1);
|
|
332
|
-
var import_fs2 = __toESM(require("fs"), 1);
|
|
333
|
-
var import_path2 = __toESM(require("path"), 1);
|
|
334
330
|
var parseFileWithImports = async (filePath) => {
|
|
335
331
|
try {
|
|
336
332
|
const code = await import_fs2.default.promises.readFile(filePath, "utf-8");
|
|
@@ -547,12 +543,8 @@ var resolveArrayExpression = async (arrayExpression, currentFilePath, context, o
|
|
|
547
543
|
for (const property of element.properties) {
|
|
548
544
|
if (!t3.isObjectProperty(property)) continue;
|
|
549
545
|
const key = t3.isIdentifier(property.key) ? property.key.name : t3.isStringLiteral(property.key) ? property.key.value : null;
|
|
550
|
-
if (!key || !["path", "name", "title", "
|
|
551
|
-
if (t3.
|
|
552
|
-
obj[key] = property.value.name;
|
|
553
|
-
} else if (t3.isJSXElement(property.value) && key === "element") {
|
|
554
|
-
obj[key] = findResolvableJSXComponent(property.value, option.importMap, option.lazyImportMap);
|
|
555
|
-
} else if (t3.isStringLiteral(property.value)) {
|
|
546
|
+
if (!key || !["path", "name", "title", "children"].includes(key)) continue;
|
|
547
|
+
if (t3.isStringLiteral(property.value)) {
|
|
556
548
|
obj[key] = property.value.value;
|
|
557
549
|
} else if (t3.isIdentifier(property.value)) {
|
|
558
550
|
const propBinding = context.scope.getBinding(property.value.name);
|
|
@@ -573,11 +565,10 @@ var resolveArrayExpression = async (arrayExpression, currentFilePath, context, o
|
|
|
573
565
|
result.push({
|
|
574
566
|
path: obj.path,
|
|
575
567
|
title: obj.title ?? obj.name ?? obj.path,
|
|
576
|
-
filePath: obj.element,
|
|
577
568
|
children: obj.children ?? []
|
|
578
569
|
});
|
|
579
570
|
}
|
|
580
|
-
return [...spreadRoutes, ...flattenRouteTree(result
|
|
571
|
+
return [...spreadRoutes, ...flattenRouteTree(result)];
|
|
581
572
|
};
|
|
582
573
|
var resolveExpressionValue = async (nodePath, expression, id, option) => {
|
|
583
574
|
if (t3.isStringLiteral(expression)) return expression.value;
|
|
@@ -851,9 +842,9 @@ var extractRouterPlugin = () => {
|
|
|
851
842
|
let finalRoute;
|
|
852
843
|
if (prefix && internal._isRelative) {
|
|
853
844
|
const corrected = joinPaths("/", prefix, route.pageId.replace(/^\//, ""));
|
|
854
|
-
finalRoute = { title: corrected, pageId: corrected, pageName: corrected
|
|
845
|
+
finalRoute = { title: corrected, pageId: corrected, pageName: corrected };
|
|
855
846
|
} else {
|
|
856
|
-
finalRoute = { title: route.title, pageId: route.pageId, pageName: route.pageName
|
|
847
|
+
finalRoute = { title: route.title, pageId: route.pageId, pageName: route.pageName };
|
|
857
848
|
}
|
|
858
849
|
if (finalRoute.pageId === "/*" || finalRoute.pageId === "*") continue;
|
|
859
850
|
merged.set(finalRoute.pageId, finalRoute);
|
package/dist/vite/index.js
CHANGED
|
@@ -171,6 +171,51 @@ var collectDeps = (mod, seen = /* @__PURE__ */ new Set()) => {
|
|
|
171
171
|
|
|
172
172
|
// src/vite/extractRouterPlugin/routeTransform.ts
|
|
173
173
|
import * as t2 from "@babel/types";
|
|
174
|
+
var findResolvableJSXComponent = (jsxEl, importMap, lazyImportMap) => {
|
|
175
|
+
const dfs = (el, map) => {
|
|
176
|
+
const nameNode = el.openingElement.name;
|
|
177
|
+
if (t2.isJSXIdentifier(nameNode) && map.has(nameNode.name)) return nameNode.name;
|
|
178
|
+
for (const child of el.children) {
|
|
179
|
+
if (t2.isJSXElement(child)) {
|
|
180
|
+
const found = dfs(child, map);
|
|
181
|
+
if (found) return found;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return "";
|
|
185
|
+
};
|
|
186
|
+
return dfs(jsxEl, lazyImportMap) || dfs(jsxEl, importMap) || (t2.isJSXIdentifier(jsxEl.openingElement.name) ? jsxEl.openingElement.name.name : "");
|
|
187
|
+
};
|
|
188
|
+
var eachTree = (tree, iterator, level = 1, parents = []) => {
|
|
189
|
+
for (let i = 0; i < tree.length; i++) {
|
|
190
|
+
const item = tree[i];
|
|
191
|
+
const result = iterator(item, i, level, parents);
|
|
192
|
+
if (result === "break") break;
|
|
193
|
+
if (result === "continue") continue;
|
|
194
|
+
if (Array.isArray(item.children)) {
|
|
195
|
+
eachTree(item.children, iterator, level + 1, parents.concat(item));
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
var flattenTree = (tree, mapper) => {
|
|
200
|
+
const result = [];
|
|
201
|
+
eachTree(tree, (item, index, level, parents) => result.push(mapper(item, index, level, parents)));
|
|
202
|
+
return result;
|
|
203
|
+
};
|
|
204
|
+
var flattenRouteTree = (routes) => {
|
|
205
|
+
return flattenTree(routes, (item) => {
|
|
206
|
+
if ("pageId" in item) return item;
|
|
207
|
+
return {
|
|
208
|
+
title: item.title,
|
|
209
|
+
pageId: item.path,
|
|
210
|
+
pageName: item.path
|
|
211
|
+
};
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
// src/vite/extractRouterPlugin/valueResolver.ts
|
|
216
|
+
import * as t3 from "@babel/types";
|
|
217
|
+
import fs2 from "fs";
|
|
218
|
+
import path4 from "path";
|
|
174
219
|
|
|
175
220
|
// src/vite/extractRouterPlugin/pathUtils.ts
|
|
176
221
|
import fs from "fs";
|
|
@@ -238,56 +283,7 @@ var normalizeFilePath = (filePath, projectRoot) => {
|
|
|
238
283
|
return normalized.replace(/\.(tsx?|jsx?)$/, "");
|
|
239
284
|
};
|
|
240
285
|
|
|
241
|
-
// src/vite/extractRouterPlugin/routeTransform.ts
|
|
242
|
-
var findResolvableJSXComponent = (jsxEl, importMap, lazyImportMap) => {
|
|
243
|
-
const dfs = (el, map) => {
|
|
244
|
-
const nameNode = el.openingElement.name;
|
|
245
|
-
if (t2.isJSXIdentifier(nameNode) && map.has(nameNode.name)) return nameNode.name;
|
|
246
|
-
for (const child of el.children) {
|
|
247
|
-
if (t2.isJSXElement(child)) {
|
|
248
|
-
const found = dfs(child, map);
|
|
249
|
-
if (found) return found;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
return "";
|
|
253
|
-
};
|
|
254
|
-
return dfs(jsxEl, lazyImportMap) || dfs(jsxEl, importMap) || (t2.isJSXIdentifier(jsxEl.openingElement.name) ? jsxEl.openingElement.name.name : "");
|
|
255
|
-
};
|
|
256
|
-
var eachTree = (tree, iterator, level = 1, parents = []) => {
|
|
257
|
-
for (let i = 0; i < tree.length; i++) {
|
|
258
|
-
const item = tree[i];
|
|
259
|
-
const result = iterator(item, i, level, parents);
|
|
260
|
-
if (result === "break") break;
|
|
261
|
-
if (result === "continue") continue;
|
|
262
|
-
if (Array.isArray(item.children)) {
|
|
263
|
-
eachTree(item.children, iterator, level + 1, parents.concat(item));
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
var flattenTree = (tree, mapper) => {
|
|
268
|
-
const result = [];
|
|
269
|
-
eachTree(tree, (item, index, level, parents) => result.push(mapper(item, index, level, parents)));
|
|
270
|
-
return result;
|
|
271
|
-
};
|
|
272
|
-
var flattenRouteTree = (routes, option) => {
|
|
273
|
-
const { importMap, lazyImportMap, aliasMap } = option;
|
|
274
|
-
return flattenTree(routes, (item) => {
|
|
275
|
-
if ("pageId" in item) return item;
|
|
276
|
-
const componentName = item.filePath;
|
|
277
|
-
const componentPath = lazyImportMap.get(componentName) ?? importMap.get(componentName) ?? "";
|
|
278
|
-
return {
|
|
279
|
-
title: item.title,
|
|
280
|
-
pageId: item.path,
|
|
281
|
-
pageName: item.path,
|
|
282
|
-
path: toSrcPath(componentPath, aliasMap)
|
|
283
|
-
};
|
|
284
|
-
});
|
|
285
|
-
};
|
|
286
|
-
|
|
287
286
|
// src/vite/extractRouterPlugin/valueResolver.ts
|
|
288
|
-
import * as t3 from "@babel/types";
|
|
289
|
-
import fs2 from "fs";
|
|
290
|
-
import path4 from "path";
|
|
291
287
|
var parseFileWithImports = async (filePath) => {
|
|
292
288
|
try {
|
|
293
289
|
const code = await fs2.promises.readFile(filePath, "utf-8");
|
|
@@ -504,12 +500,8 @@ var resolveArrayExpression = async (arrayExpression, currentFilePath, context, o
|
|
|
504
500
|
for (const property of element.properties) {
|
|
505
501
|
if (!t3.isObjectProperty(property)) continue;
|
|
506
502
|
const key = t3.isIdentifier(property.key) ? property.key.name : t3.isStringLiteral(property.key) ? property.key.value : null;
|
|
507
|
-
if (!key || !["path", "name", "title", "
|
|
508
|
-
if (t3.
|
|
509
|
-
obj[key] = property.value.name;
|
|
510
|
-
} else if (t3.isJSXElement(property.value) && key === "element") {
|
|
511
|
-
obj[key] = findResolvableJSXComponent(property.value, option.importMap, option.lazyImportMap);
|
|
512
|
-
} else if (t3.isStringLiteral(property.value)) {
|
|
503
|
+
if (!key || !["path", "name", "title", "children"].includes(key)) continue;
|
|
504
|
+
if (t3.isStringLiteral(property.value)) {
|
|
513
505
|
obj[key] = property.value.value;
|
|
514
506
|
} else if (t3.isIdentifier(property.value)) {
|
|
515
507
|
const propBinding = context.scope.getBinding(property.value.name);
|
|
@@ -530,11 +522,10 @@ var resolveArrayExpression = async (arrayExpression, currentFilePath, context, o
|
|
|
530
522
|
result.push({
|
|
531
523
|
path: obj.path,
|
|
532
524
|
title: obj.title ?? obj.name ?? obj.path,
|
|
533
|
-
filePath: obj.element,
|
|
534
525
|
children: obj.children ?? []
|
|
535
526
|
});
|
|
536
527
|
}
|
|
537
|
-
return [...spreadRoutes, ...flattenRouteTree(result
|
|
528
|
+
return [...spreadRoutes, ...flattenRouteTree(result)];
|
|
538
529
|
};
|
|
539
530
|
var resolveExpressionValue = async (nodePath, expression, id, option) => {
|
|
540
531
|
if (t3.isStringLiteral(expression)) return expression.value;
|
|
@@ -808,9 +799,9 @@ var extractRouterPlugin = () => {
|
|
|
808
799
|
let finalRoute;
|
|
809
800
|
if (prefix && internal._isRelative) {
|
|
810
801
|
const corrected = joinPaths("/", prefix, route.pageId.replace(/^\//, ""));
|
|
811
|
-
finalRoute = { title: corrected, pageId: corrected, pageName: corrected
|
|
802
|
+
finalRoute = { title: corrected, pageId: corrected, pageName: corrected };
|
|
812
803
|
} else {
|
|
813
|
-
finalRoute = { title: route.title, pageId: route.pageId, pageName: route.pageName
|
|
804
|
+
finalRoute = { title: route.title, pageId: route.pageId, pageName: route.pageName };
|
|
814
805
|
}
|
|
815
806
|
if (finalRoute.pageId === "/*" || finalRoute.pageId === "*") continue;
|
|
816
807
|
merged.set(finalRoute.pageId, finalRoute);
|