sentry-miniapp 1.2.0 → 1.4.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.
- package/CHANGELOG.md +123 -0
- package/README.md +113 -0
- package/dist/sentry-miniapp.cjs.js +187 -39
- package/dist/sentry-miniapp.cjs.js.map +1 -1
- package/dist/sentry-miniapp.esm.js +187 -39
- package/dist/sentry-miniapp.esm.js.map +1 -1
- package/dist/sentry-miniapp.umd.js +187 -39
- package/dist/sentry-miniapp.umd.js.map +1 -1
- package/dist/types/client.d.ts +4 -6
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/integrations/index.d.ts +2 -0
- package/dist/types/integrations/index.d.ts.map +1 -1
- package/dist/types/integrations/networkbreadcrumbs.d.ts +29 -0
- package/dist/types/integrations/networkbreadcrumbs.d.ts.map +1 -0
- package/dist/types/integrations/rewriteframes.d.ts +35 -0
- package/dist/types/integrations/rewriteframes.d.ts.map +1 -0
- package/dist/types/sdk.d.ts +6 -4
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/transports/offlineStore.d.ts +4 -1
- package/dist/types/transports/offlineStore.d.ts.map +1 -1
- package/dist/types/types.d.ts +6 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +94 -16
- package/src/.keep +0 -0
- package/src/client.ts +203 -0
- package/src/crossPlatform.ts +407 -0
- package/src/eventbuilder.ts +291 -0
- package/src/helpers.ts +214 -0
- package/src/index.ts +86 -0
- package/src/integrations/dedupe.ts +215 -0
- package/src/integrations/globalhandlers.ts +209 -0
- package/src/integrations/httpcontext.ts +140 -0
- package/src/integrations/index.ts +10 -0
- package/src/integrations/linkederrors.ts +107 -0
- package/src/integrations/networkbreadcrumbs.ts +155 -0
- package/src/integrations/performance.ts +622 -0
- package/src/integrations/rewriteframes.ts +77 -0
- package/src/integrations/router.ts +180 -0
- package/src/integrations/system.ts +135 -0
- package/src/integrations/trycatch.ts +233 -0
- package/src/polyfills.ts +242 -0
- package/src/sdk.ts +182 -0
- package/src/transports/index.ts +3 -0
- package/src/transports/offlineStore.ts +85 -0
- package/src/transports/xhr.ts +68 -0
- package/src/types.ts +129 -0
- package/src/version.ts +3 -0
package/dist/types/client.d.ts
CHANGED
|
@@ -20,13 +20,11 @@ export declare class MiniappClient extends Client<any> {
|
|
|
20
20
|
eventFromMessage(message: string, level?: any): PromiseLike<Event>;
|
|
21
21
|
protected _prepareEvent(event: Event, hint?: EventHint, scope?: Scope): PromiseLike<Event | null>;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* @param options Set individual options for the dialog
|
|
23
|
+
* @deprecated Miniapp environment does not support Sentry's default HTML report dialog.
|
|
24
|
+
* Please implement your own UI form to collect user feedback (name, email, comments)
|
|
25
|
+
* and use `Sentry.captureFeedback()` to submit it to Sentry.
|
|
28
26
|
*/
|
|
29
|
-
showReportDialog(
|
|
27
|
+
showReportDialog(_options?: ReportDialogOptions): void;
|
|
30
28
|
/**
|
|
31
29
|
* Capture feedback using the new feedback API.
|
|
32
30
|
* 使用新的反馈 API 捕获反馈
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,KAAK,EAIN,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,KAAK,EACL,SAAS,EACV,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAIvF;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,MAAM,CAAC,GAAG,CAAC;IAC5C;;;;OAIG;gBACgB,OAAO,GAAE,cAAmB;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,KAAK,EAIN,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,KAAK,EACL,SAAS,EACV,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAIvF;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,MAAM,CAAC,GAAG,CAAC;IAC5C;;;;OAIG;gBACgB,OAAO,GAAE,cAAmB;IAuB/C;;OAEG;IACI,kBAAkB,CAAC,SAAS,EAAE,GAAG,GAAG,WAAW,CAAC,KAAK,CAAC;IAYtD,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,GAAY,GAAG,WAAW,CAAC,KAAK,CAAC;cAO9D,aAAa,CAC9B,KAAK,EAAE,KAAK,EACZ,IAAI,CAAC,EAAE,SAAS,EAChB,KAAK,CAAC,EAAE,KAAK,GACZ,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC;IAiF5B;;;;OAIG;IACI,gBAAgB,CAAC,QAAQ,GAAE,mBAAwB,GAAG,IAAI;IASjE;;;;;;OAMG;IACI,eAAe,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM;CAsB3D"}
|
|
@@ -6,4 +6,6 @@ export { Dedupe } from './dedupe';
|
|
|
6
6
|
export { System } from './system';
|
|
7
7
|
export { Router } from './router';
|
|
8
8
|
export { PerformanceIntegration, performanceIntegration } from './performance';
|
|
9
|
+
export { RewriteFrames } from './rewriteframes';
|
|
10
|
+
export { NetworkBreadcrumbs } from './networkbreadcrumbs';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Integration } from '@sentry/core';
|
|
2
|
+
/**
|
|
3
|
+
* Network Breadcrumbs Integration.
|
|
4
|
+
* Monkey patches miniapp network API (e.g. wx.request, my.httpRequest)
|
|
5
|
+
* to record network breadcrumbs, including request and response body if configured.
|
|
6
|
+
*/
|
|
7
|
+
export declare class NetworkBreadcrumbs implements Integration {
|
|
8
|
+
/**
|
|
9
|
+
* @inheritDoc
|
|
10
|
+
*/
|
|
11
|
+
static id: string;
|
|
12
|
+
/**
|
|
13
|
+
* @inheritDoc
|
|
14
|
+
*/
|
|
15
|
+
name: string;
|
|
16
|
+
private readonly _traceNetworkBody;
|
|
17
|
+
constructor(options?: {
|
|
18
|
+
traceNetworkBody?: boolean | undefined;
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
setupOnce(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Wraps the miniapp request API to capture breadcrumbs
|
|
26
|
+
*/
|
|
27
|
+
private _createRequestWrapper;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=networkbreadcrumbs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networkbreadcrumbs.d.ts","sourceRoot":"","sources":["../../../src/integrations/networkbreadcrumbs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhD;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,WAAW;IACpD;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAwB;IAEhD;;OAEG;IACI,IAAI,EAAE,MAAM,CAAyB;IAE5C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAU;gBAEzB,OAAO,GAAE;QAAE,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;KAAO;IAI3E;;OAEG;IACI,SAAS,IAAI,IAAI;IAcxB;;OAEG;IACH,OAAO,CAAC,qBAAqB;CA2G9B"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Event, Integration } from '@sentry/core';
|
|
2
|
+
/**
|
|
3
|
+
* Normalize miniapp stack trace paths to a standard format for source map resolution.
|
|
4
|
+
* E.g., 'appservice/pages/index.js' -> 'app:///pages/index.js'
|
|
5
|
+
*/
|
|
6
|
+
export declare class RewriteFrames implements Integration {
|
|
7
|
+
/**
|
|
8
|
+
* @inheritDoc
|
|
9
|
+
*/
|
|
10
|
+
static id: string;
|
|
11
|
+
/**
|
|
12
|
+
* @inheritDoc
|
|
13
|
+
*/
|
|
14
|
+
name: string;
|
|
15
|
+
/**
|
|
16
|
+
* Optional prefix to append to the normalized path. Defaults to 'app:///'
|
|
17
|
+
*/
|
|
18
|
+
private readonly _prefix;
|
|
19
|
+
constructor(options?: {
|
|
20
|
+
prefix?: string;
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
setupOnce(): void;
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
processEvent(event: Event): Event;
|
|
30
|
+
/**
|
|
31
|
+
* Normalizes a filename from various miniapp platforms
|
|
32
|
+
*/
|
|
33
|
+
private _normalizeFilename;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=rewriteframes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rewriteframes.d.ts","sourceRoot":"","sources":["../../../src/integrations/rewriteframes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAyB,MAAM,cAAc,CAAC;AAE9E;;;GAGG;AACH,qBAAa,aAAc,YAAW,WAAW;IAC/C;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAmB;IAE3C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAoB;IAEvC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAEd,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO;IAIpD;;OAEG;IACI,SAAS,IAAI,IAAI;IAMxB;;OAEG;IACI,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;IAexC;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAoB3B"}
|
package/dist/types/sdk.d.ts
CHANGED
|
@@ -16,12 +16,14 @@ export declare function getDefaultIntegrations(): Integration[];
|
|
|
16
16
|
*/
|
|
17
17
|
export declare function init(options?: MiniappOptions): MiniappClient | undefined;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* @deprecated Miniapp environment does not support Sentry's default HTML report dialog.
|
|
20
|
+
* Please implement your own UI form to collect user feedback (name, email, comments)
|
|
21
|
+
* and use `Sentry.captureFeedback()` to submit it to Sentry.
|
|
21
22
|
*
|
|
22
|
-
*
|
|
23
|
+
* 小程序环境不支持 Sentry 官方的 HTML 反馈弹窗。
|
|
24
|
+
* 请自行实现 UI 表单收集用户反馈,并调用 `Sentry.captureFeedback()` 进行上报。
|
|
23
25
|
*/
|
|
24
|
-
export declare function showReportDialog(
|
|
26
|
+
export declare function showReportDialog(_options?: ReportDialogOptions): void;
|
|
25
27
|
/**
|
|
26
28
|
* Get the last event ID
|
|
27
29
|
*/
|
package/dist/types/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,WAAW,EACZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,WAAW,EACZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAYzC,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEvF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,EAgB5C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,WAAW,EAAE,CAEtD;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,cAA0B,GAAG,aAAa,GAAG,SAAS,CA6CnF;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,GAAE,mBAAwB,GAAG,IAAI,CAKzE;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,MAAM,GAAG,SAAS,CAEhD;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAM5D;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAM5D;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAWhE;AAID;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAQlE"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { OfflineStore, OfflineTransportOptions } from '@sentry/core/build/types/transports/offline';
|
|
2
|
+
export interface MiniappOfflineStoreOptions extends OfflineTransportOptions {
|
|
3
|
+
offlineCacheLimit?: number;
|
|
4
|
+
}
|
|
2
5
|
/**
|
|
3
6
|
* Creates an offline store using miniapp storage API
|
|
4
7
|
*/
|
|
5
|
-
export declare function createMiniappOfflineStore(
|
|
8
|
+
export declare function createMiniappOfflineStore(options: MiniappOfflineStoreOptions): OfflineStore;
|
|
6
9
|
//# sourceMappingURL=offlineStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offlineStore.d.ts","sourceRoot":"","sources":["../../../src/transports/offlineStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAMzG;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,
|
|
1
|
+
{"version":3,"file":"offlineStore.d.ts","sourceRoot":"","sources":["../../../src/transports/offlineStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAMzG,MAAM,WAAW,0BAA2B,SAAQ,uBAAuB;IACzE,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,0BAA0B,GAAG,YAAY,CA2C3F"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -33,8 +33,14 @@ export interface MiniappOptions {
|
|
|
33
33
|
enableConsoleBreadcrumbs?: boolean;
|
|
34
34
|
/** Whether to enable navigation breadcrumbs */
|
|
35
35
|
enableNavigationBreadcrumbs?: boolean;
|
|
36
|
+
/** Whether to enable automatic source map path rewrite */
|
|
37
|
+
enableSourceMap?: boolean;
|
|
38
|
+
/** Whether to capture and record request and response body in network breadcrumbs */
|
|
39
|
+
traceNetworkBody?: boolean;
|
|
36
40
|
/** Whether to enable offline cache to retry sending events later */
|
|
37
41
|
enableOfflineCache?: boolean;
|
|
42
|
+
/** Maximum number of events to store in offline cache (default: 30) */
|
|
43
|
+
offlineCacheLimit?: number;
|
|
38
44
|
/** Array of strings or regexes that match error URLs which should be exclusively sent to Sentry */
|
|
39
45
|
allowUrls?: Array<string | RegExp>;
|
|
40
46
|
/** Array of strings or regexes that match error URLs which should not be sent to Sentry */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAErF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,iBAAiB;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,kBAAkB;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,iBAAiB;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,kBAAkB;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M,CAAC;IAC3B;;OAEG;IACH,IAAI,CAAC,EAAE;QACL,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;KAC1C,CAAC;CACH"}
|
package/dist/types/version.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sentry-miniapp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "用于小程序平台的 Sentry SDK",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
},
|
|
9
9
|
"homepage": "https://github.com/lizhiyao/sentry-miniapp",
|
|
10
10
|
"scripts": {
|
|
11
|
-
"build": "vite build",
|
|
11
|
+
"build": "vite build && npm run sync:examples",
|
|
12
|
+
"sync:examples": "cp dist/sentry-miniapp.umd.js examples/wxapp/lib/sentry-miniapp.js",
|
|
12
13
|
"build:miniapp": "vite build --mode miniapp",
|
|
13
14
|
"build:types": "vite build && tsc --emitDeclarationOnly --outDir dist/types",
|
|
14
15
|
"dev": "vite build --watch",
|
|
@@ -17,19 +18,40 @@
|
|
|
17
18
|
"test:integration": "npm run build && cp dist/sentry-miniapp.umd.js examples/wxapp/lib/sentry-miniapp.js && node integration-tests/test-duplicate-async-error.js && node integration-tests/test-multiple-exceptions.js && node integration-tests/test-size-limit-fix.js",
|
|
18
19
|
"test:all": "npm run test && npm run test:integration",
|
|
19
20
|
"prepublishOnly": "npm run build",
|
|
20
|
-
"prepare": "husky"
|
|
21
|
+
"prepare": "husky",
|
|
22
|
+
"release": "commit-and-tag-version"
|
|
21
23
|
},
|
|
22
24
|
"keywords": [
|
|
23
25
|
"sentry",
|
|
24
|
-
"weapp",
|
|
25
26
|
"miniapp",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
27
|
+
"wechat",
|
|
28
|
+
"alipay",
|
|
29
|
+
"bytedance",
|
|
30
|
+
"swan",
|
|
31
|
+
"kuaishou",
|
|
32
|
+
"dingtalk",
|
|
33
|
+
"qq",
|
|
34
|
+
"taro",
|
|
35
|
+
"uniapp",
|
|
36
|
+
"error-monitoring",
|
|
37
|
+
"exception-tracking",
|
|
38
|
+
"performance-monitoring",
|
|
39
|
+
"sourcemap",
|
|
40
|
+
"offline-cache",
|
|
41
|
+
"小程序",
|
|
42
|
+
"微信小程序",
|
|
43
|
+
"支付宝小程序",
|
|
44
|
+
"字节跳动小程序",
|
|
45
|
+
"抖音小程序",
|
|
46
|
+
"百度小程序",
|
|
47
|
+
"快手小程序",
|
|
48
|
+
"钉钉小程序",
|
|
49
|
+
"QQ小程序",
|
|
50
|
+
"跨端开发",
|
|
29
51
|
"异常监控",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
52
|
+
"错误收集",
|
|
53
|
+
"性能监控",
|
|
54
|
+
"前端监控"
|
|
33
55
|
],
|
|
34
56
|
"author": "dancerlzy@gmail.com",
|
|
35
57
|
"license": "MIT",
|
|
@@ -43,21 +65,28 @@
|
|
|
43
65
|
".": {
|
|
44
66
|
"types": "./dist/types/index.d.ts",
|
|
45
67
|
"import": "./dist/sentry-miniapp.esm.js",
|
|
46
|
-
"require": "./dist/sentry-miniapp.cjs.js"
|
|
68
|
+
"require": "./dist/sentry-miniapp.cjs.js",
|
|
69
|
+
"default": "./dist/sentry-miniapp.umd.js"
|
|
47
70
|
}
|
|
48
71
|
},
|
|
49
72
|
"files": [
|
|
50
73
|
"dist",
|
|
51
|
-
"
|
|
74
|
+
"src",
|
|
75
|
+
"README.md",
|
|
76
|
+
"LICENSE",
|
|
77
|
+
"CHANGELOG.md"
|
|
52
78
|
],
|
|
53
79
|
"devDependencies": {
|
|
80
|
+
"@commitlint/cli": "^20.5.0",
|
|
81
|
+
"@commitlint/config-conventional": "^20.5.0",
|
|
54
82
|
"@jest/globals": "^30.0.4",
|
|
55
83
|
"@types/jest": "^30.0.0",
|
|
56
84
|
"@types/node": "^20.19.11",
|
|
57
85
|
"@typescript-eslint/eslint-plugin": "^8.57.1",
|
|
58
86
|
"@typescript-eslint/parser": "^8.57.1",
|
|
59
87
|
"@vue/language-core": "^3.2.6",
|
|
60
|
-
"
|
|
88
|
+
"commit-and-tag-version": "^12.7.1",
|
|
89
|
+
"eslint": "^8.57.1",
|
|
61
90
|
"husky": "^9.1.7",
|
|
62
91
|
"jest": "^29.0.0",
|
|
63
92
|
"js-yaml": "3.14.2",
|
|
@@ -72,8 +101,57 @@
|
|
|
72
101
|
"@sentry/core": "^10.45.0"
|
|
73
102
|
},
|
|
74
103
|
"lint-staged": {
|
|
75
|
-
"src/**/*.ts": [
|
|
76
|
-
"eslint --fix"
|
|
104
|
+
"src/**/*.{ts,js}": [
|
|
105
|
+
"eslint --fix",
|
|
106
|
+
"prettier --write"
|
|
107
|
+
],
|
|
108
|
+
"yarn.lock": [
|
|
109
|
+
"node -e \"const fs = require('fs'); const content = fs.readFileSync('yarn.lock', 'utf8'); if (/registry\\.[a-zA-Z0-9-]+\\.(cn|net|com|org)(?!npmjs\\.org)/i.test(content)) { console.error('Error: yarn.lock contains non-official registry URLs. Please clean it.'); process.exit(1); }\""
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
"commit-and-tag-version": {
|
|
113
|
+
"header": "# 更新日志\n\n本文档记录了 sentry-miniapp 项目的所有重要变更。",
|
|
114
|
+
"types": [
|
|
115
|
+
{
|
|
116
|
+
"type": "feat",
|
|
117
|
+
"section": "✨ Features | 新功能"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"type": "fix",
|
|
121
|
+
"section": "🐛 Bug Fixes | 修复"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"type": "chore",
|
|
125
|
+
"section": "🎫 Chores | 其他更新"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"type": "docs",
|
|
129
|
+
"section": "📝 Documentation | 文档"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"type": "style",
|
|
133
|
+
"section": "💄 Styles | 风格"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"type": "refactor",
|
|
137
|
+
"section": "♻️ Code Refactoring | 代码重构"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"type": "perf",
|
|
141
|
+
"section": "⚡ Performance Improvements | 性能优化"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"type": "test",
|
|
145
|
+
"section": "✅ Tests | 测试"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"type": "revert",
|
|
149
|
+
"section": "⏪ Reverts | 回退"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"type": "build",
|
|
153
|
+
"section": "👷 Build System | 构建"
|
|
154
|
+
}
|
|
77
155
|
]
|
|
78
156
|
}
|
|
79
|
-
}
|
|
157
|
+
}
|
package/src/.keep
ADDED
|
File without changes
|
package/src/client.ts
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Client,
|
|
3
|
+
Scope,
|
|
4
|
+
getIsolationScope,
|
|
5
|
+
getCurrentScope,
|
|
6
|
+
makeOfflineTransport,
|
|
7
|
+
} from '@sentry/core';
|
|
8
|
+
import type {
|
|
9
|
+
Event,
|
|
10
|
+
EventHint,
|
|
11
|
+
} from '@sentry/core';
|
|
12
|
+
|
|
13
|
+
import { appName, getSystemInfo } from './crossPlatform';
|
|
14
|
+
import type { MiniappOptions, ReportDialogOptions, SendFeedbackParams } from './types';
|
|
15
|
+
import { createMiniappTransport, createMiniappOfflineStore } from './transports';
|
|
16
|
+
import { SDK_NAME, SDK_VERSION } from './version';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The Sentry Miniapp SDK Client.
|
|
20
|
+
*
|
|
21
|
+
* @see MiniappOptions for documentation on configuration options.
|
|
22
|
+
* @see SentryClient for usage documentation.
|
|
23
|
+
*/
|
|
24
|
+
export class MiniappClient extends Client<any> {
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new Miniapp SDK instance.
|
|
27
|
+
*
|
|
28
|
+
* @param options Configuration options for this SDK.
|
|
29
|
+
*/
|
|
30
|
+
public constructor(options: MiniappOptions = {}) {
|
|
31
|
+
super({
|
|
32
|
+
...options,
|
|
33
|
+
transport: options.transport || ((transportOptions: any) => {
|
|
34
|
+
const baseTransport = createMiniappTransport({
|
|
35
|
+
...transportOptions,
|
|
36
|
+
headers: {},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
if (options.enableOfflineCache !== false) {
|
|
40
|
+
return makeOfflineTransport(() => baseTransport)({
|
|
41
|
+
...transportOptions,
|
|
42
|
+
offlineCacheLimit: options.offlineCacheLimit,
|
|
43
|
+
createStore: createMiniappOfflineStore,
|
|
44
|
+
flushAtStartup: true, // 启动时自动重试发送
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return baseTransport;
|
|
49
|
+
}),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @inheritDoc
|
|
55
|
+
*/
|
|
56
|
+
public eventFromException(exception: any): PromiseLike<Event> {
|
|
57
|
+
return Promise.resolve({
|
|
58
|
+
exception: {
|
|
59
|
+
values: [{
|
|
60
|
+
type: exception.name || 'Error',
|
|
61
|
+
value: exception.message || String(exception),
|
|
62
|
+
}]
|
|
63
|
+
},
|
|
64
|
+
level: 'error',
|
|
65
|
+
} as Event);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public eventFromMessage(message: string, level: any = 'info'): PromiseLike<Event> {
|
|
69
|
+
return Promise.resolve({
|
|
70
|
+
message: message,
|
|
71
|
+
level,
|
|
72
|
+
} as Event);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
protected override _prepareEvent(
|
|
76
|
+
event: Event,
|
|
77
|
+
hint?: EventHint,
|
|
78
|
+
scope?: Scope,
|
|
79
|
+
): PromiseLike<Event | null> {
|
|
80
|
+
event.platform = event.platform || this.getOptions().platform || 'javascript';
|
|
81
|
+
|
|
82
|
+
// Add SDK information
|
|
83
|
+
event.sdk = {
|
|
84
|
+
...event.sdk,
|
|
85
|
+
name: SDK_NAME,
|
|
86
|
+
packages: [
|
|
87
|
+
...((event.sdk && event.sdk.packages) || []),
|
|
88
|
+
{
|
|
89
|
+
name: 'npm:@sentry/miniapp',
|
|
90
|
+
version: SDK_VERSION,
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
version: SDK_VERSION,
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// Add miniapp context
|
|
97
|
+
if (!event.contexts) {
|
|
98
|
+
event.contexts = {};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Add miniapp platform info
|
|
102
|
+
event.contexts['miniapp'] = {
|
|
103
|
+
platform: appName(),
|
|
104
|
+
sdk_version: SDK_VERSION,
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// Add system info if available
|
|
108
|
+
const systemInfo = getSystemInfo();
|
|
109
|
+
if (systemInfo) {
|
|
110
|
+
event.contexts.device = {
|
|
111
|
+
brand: systemInfo.brand || 'unknown',
|
|
112
|
+
model: systemInfo.model || 'unknown',
|
|
113
|
+
screen_resolution: `${systemInfo.screenWidth || 0}x${systemInfo.screenHeight || 0}`,
|
|
114
|
+
language: systemInfo.language || 'unknown',
|
|
115
|
+
version: systemInfo.version || 'unknown',
|
|
116
|
+
system: systemInfo.system || 'unknown',
|
|
117
|
+
platform: systemInfo.platform || 'unknown',
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
event.contexts.os = {
|
|
121
|
+
name: systemInfo.system || 'unknown',
|
|
122
|
+
version: systemInfo.version || 'unknown',
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
event.contexts.app = {
|
|
126
|
+
app_version: systemInfo.SDKVersion || 'unknown',
|
|
127
|
+
};
|
|
128
|
+
} else {
|
|
129
|
+
// Provide fallback values when system info is not available
|
|
130
|
+
event.contexts.device = {
|
|
131
|
+
brand: 'unknown',
|
|
132
|
+
model: 'unknown',
|
|
133
|
+
screen_resolution: '0x0',
|
|
134
|
+
language: 'unknown',
|
|
135
|
+
version: 'unknown',
|
|
136
|
+
system: 'unknown',
|
|
137
|
+
platform: 'unknown',
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
event.contexts.os = {
|
|
141
|
+
name: 'unknown',
|
|
142
|
+
version: 'unknown',
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
event.contexts.app = {
|
|
146
|
+
app_version: 'unknown',
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
try {
|
|
151
|
+
const currentScope = scope || getCurrentScope();
|
|
152
|
+
const isolationScope = getIsolationScope();
|
|
153
|
+
return super._prepareEvent(event, hint || {}, currentScope, isolationScope);
|
|
154
|
+
} catch (error) {
|
|
155
|
+
// Fallback if scopes are not properly initialized
|
|
156
|
+
return Promise.resolve(event);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @deprecated Miniapp environment does not support Sentry's default HTML report dialog.
|
|
162
|
+
* Please implement your own UI form to collect user feedback (name, email, comments)
|
|
163
|
+
* and use `Sentry.captureFeedback()` to submit it to Sentry.
|
|
164
|
+
*/
|
|
165
|
+
public showReportDialog(_options: ReportDialogOptions = {}): void {
|
|
166
|
+
console.warn(
|
|
167
|
+
'[sentry-miniapp] showReportDialog is deprecated and does nothing. ' +
|
|
168
|
+
'Please build your own UI and use `Sentry.captureFeedback()` instead.'
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Capture feedback using the new feedback API.
|
|
176
|
+
* 使用新的反馈 API 捕获反馈
|
|
177
|
+
*
|
|
178
|
+
* @param params Feedback parameters
|
|
179
|
+
* @returns Event ID
|
|
180
|
+
*/
|
|
181
|
+
public captureFeedback(params: SendFeedbackParams): string {
|
|
182
|
+
const feedbackEvent: Event = {
|
|
183
|
+
contexts: {
|
|
184
|
+
feedback: {
|
|
185
|
+
contact_email: params.email,
|
|
186
|
+
name: params.name,
|
|
187
|
+
message: params.message,
|
|
188
|
+
url: params.url,
|
|
189
|
+
source: params.source,
|
|
190
|
+
associated_event_id: params.associatedEventId,
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
type: 'feedback',
|
|
194
|
+
level: 'info',
|
|
195
|
+
tags: params.tags || {},
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const scope = getCurrentScope();
|
|
199
|
+
return scope.captureEvent(feedbackEvent);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
}
|