sentry-uniapp 1.0.6 → 1.0.7

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/README.md CHANGED
@@ -1,13 +1,12 @@
1
1
  # Sentry 小程序 SDK
2
2
 
3
- ![npm version](https://img.shields.io/npm/v/sentry-uniapp)
4
- ![npm download](https://img.shields.io/npm/dm/sentry-uniapp)
5
- ![github forks](https://img.shields.io/github/forks/uappkit/sentry-uniapp?style=social)
6
- ![github stars](https://img.shields.io/github/stars/uappkit/sentry-uniapp?style=social)
7
- ![github watchers](https://img.shields.io/github/watchers/uappkit/sentry-uniapp?style=social)
8
- ![github license](https://img.shields.io/github/license/uappkit/sentry-uniapp)
3
+ Sentry SDK 的封装,可用于Uniapp全端,及微信小程序,抖音小程序,百度小程序等各家平台。
9
4
 
10
- 用于小程序平台的 Sentry SDK
5
+ > 提示:由于快应用 require 方式特殊性,webpack是在编译期处理的,所以动态代码检测无效,使用时去更改webpack配置也增加了复杂行,所以单独维护,包名为 sentry-quickapp。
6
+
7
+ 快应用项目可参考:
8
+
9
+ <https://github.com/uappkit/sentry-quickapp>
11
10
 
12
11
  ## 功能特点
13
12
 
@@ -29,8 +28,6 @@
29
28
  - [x] 默认上报异常发生时的路由栈
30
29
  - [ ] 完善的代码测试
31
30
 
32
- > 提示:由于快 应用 require 方式特殊性,webpack是在编译期处理的,所以动态代码检测无效,使用时去更改webpack配置也增加了复杂行,所以单独维护,包名为 sentry-quickapp,快应用项目请改为 sentry-quickapp
33
-
34
31
  ## 用法
35
32
 
36
33
  支持两种使用方式:
package/esm/client.js CHANGED
@@ -26,7 +26,7 @@ var MiniappClient = /** @class */ (function (_super) {
26
26
  event.platform = event.platform || "javascript";
27
27
  event.sdk = __assign(__assign({}, event.sdk), { name: SDK_NAME, packages: __spread(((event.sdk && event.sdk.packages) || []), [
28
28
  {
29
- name: "npm:sentry-uniapp",
29
+ name: "npm:sentry-quickapp",
30
30
  version: SDK_VERSION
31
31
  }
32
32
  ]), version: SDK_VERSION });
@@ -41,9 +41,9 @@ var MiniappClient = /** @class */ (function (_super) {
41
41
  MiniappClient.prototype.showReportDialog = function (options) {
42
42
  if (options === void 0) { options = {}; }
43
43
  // doesn't work without a document (React Native)
44
- console.log('sentry-uniapp 暂未实现该方法', options);
44
+ console.log('sentry-quickapp 暂未实现该方法', options);
45
45
  };
46
46
  return MiniappClient;
47
47
  }(BaseClient));
48
48
  export { MiniappClient };
49
- //# sourceMappingURL=client.js.map
49
+ //# sourceMappingURL=client.js.map
package/esm/client.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAS,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,cAAc,EAAkB,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AA6BlD;;;;;GAKG;AACH;IAAmC,iCAA0C;IAC3E;;;;OAIG;IACH,uBAAmB,OAA4B;QAA5B,wBAAA,EAAA,YAA4B;eAC7C,kBAAM,cAAc,EAAE,OAAO,CAAC;IAChC,CAAC;IAED;;OAEG;IACO,qCAAa,GAAvB,UAAwB,KAAY,EAAE,KAAa,EAAE,IAAgB;QACnE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,YAAY,CAAC;QAChD,KAAK,CAAC,GAAG,yBACJ,KAAK,CAAC,GAAG,KACZ,IAAI,EAAE,QAAQ,EACd,QAAQ,WACH,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAC5C;oBACE,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE,WAAW;iBACrB;gBAEH,OAAO,EAAE,WAAW,GACrB,CAAC;QAEF,OAAO,iBAAM,aAAa,YAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;;;;OAKG;IACI,wCAAgB,GAAvB,UAAwB,OAAiC;QAAjC,wBAAA,EAAA,YAAiC;QACvD,iDAAiD;QACjD,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IACH,oBAAC;AAAD,CAAC,AAzCD,CAAmC,UAAU,GAyC5C","sourcesContent":["import { BaseClient, Scope } from \"@sentry/core\";\nimport { DsnLike, Event, EventHint } from \"@sentry/types\";\n\nimport { MiniappBackend, MiniappOptions } from \"./backend\";\nimport { SDK_NAME, SDK_VERSION } from \"./version\";\n\n/**\n * All properties the report dialog supports\n */\nexport interface ReportDialogOptions {\n [key: string]: any;\n eventId?: string;\n dsn?: DsnLike;\n user?: {\n email?: string;\n name?: string;\n };\n lang?: string;\n title?: string;\n subtitle?: string;\n subtitle2?: string;\n labelName?: string;\n labelEmail?: string;\n labelComments?: string;\n labelClose?: string;\n labelSubmit?: string;\n errorGeneric?: string;\n errorFormEntry?: string;\n successMessage?: string;\n /** Callback after reportDialog showed up */\n onLoad?(): void;\n}\n\n/**\n * The Sentry Miniapp SDK Client.\n *\n * @see MiniappOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class MiniappClient extends BaseClient<MiniappBackend, MiniappOptions> {\n /**\n * Creates a new Miniapp SDK instance.\n *\n * @param options Configuration options for this SDK.\n */\n public constructor(options: MiniappOptions = {}) {\n super(MiniappBackend, options);\n }\n\n /**\n * @inheritDoc\n */\n protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): PromiseLike<Event | null> {\n event.platform = event.platform || \"javascript\";\n event.sdk = {\n ...event.sdk,\n name: SDK_NAME,\n packages: [\n ...((event.sdk && event.sdk.packages) || []),\n {\n name: \"npm:sentry-uniapp\",\n version: SDK_VERSION\n }\n ],\n version: SDK_VERSION\n };\n\n return super._prepareEvent(event, scope, hint);\n }\n\n /**\n * Show a report dialog to the user to send feedback to a specific event.\n * 向用户显示报告对话框以将反馈发送到特定事件。---> 小程序上暂时用不到&不考虑。\n *\n * @param options Set individual options for the dialog\n */\n public showReportDialog(options: ReportDialogOptions = {}): void {\n // doesn't work without a document (React Native)\n console.log('sentry-uniapp 暂未实现该方法', options);\n }\n}\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAS,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,cAAc,EAAkB,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AA6BlD;;;;;GAKG;AACH;IAAmC,iCAA0C;IAC3E;;;;OAIG;IACH,uBAAmB,OAA4B;QAA5B,wBAAA,EAAA,YAA4B;eAC7C,kBAAM,cAAc,EAAE,OAAO,CAAC;IAChC,CAAC;IAED;;OAEG;IACO,qCAAa,GAAvB,UAAwB,KAAY,EAAE,KAAa,EAAE,IAAgB;QACnE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,YAAY,CAAC;QAChD,KAAK,CAAC,GAAG,yBACJ,KAAK,CAAC,GAAG,KACZ,IAAI,EAAE,QAAQ,EACd,QAAQ,WACH,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAC5C;oBACE,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE,WAAW;iBACrB;gBAEH,OAAO,EAAE,WAAW,GACrB,CAAC;QAEF,OAAO,iBAAM,aAAa,YAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;;;;OAKG;IACI,wCAAgB,GAAvB,UAAwB,OAAiC;QAAjC,wBAAA,EAAA,YAAiC;QACvD,iDAAiD;QACjD,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IACH,oBAAC;AAAD,CAAC,AAzCD,CAAmC,UAAU,GAyC5C","sourcesContent":["import { BaseClient, Scope } from \"@sentry/core\";\nimport { DsnLike, Event, EventHint } from \"@sentry/types\";\n\nimport { MiniappBackend, MiniappOptions } from \"./backend\";\nimport { SDK_NAME, SDK_VERSION } from \"./version\";\n\n/**\n * All properties the report dialog supports\n */\nexport interface ReportDialogOptions {\n [key: string]: any;\n eventId?: string;\n dsn?: DsnLike;\n user?: {\n email?: string;\n name?: string;\n };\n lang?: string;\n title?: string;\n subtitle?: string;\n subtitle2?: string;\n labelName?: string;\n labelEmail?: string;\n labelComments?: string;\n labelClose?: string;\n labelSubmit?: string;\n errorGeneric?: string;\n errorFormEntry?: string;\n successMessage?: string;\n /** Callback after reportDialog showed up */\n onLoad?(): void;\n}\n\n/**\n * The Sentry Miniapp SDK Client.\n *\n * @see MiniappOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class MiniappClient extends BaseClient<MiniappBackend, MiniappOptions> {\n /**\n * Creates a new Miniapp SDK instance.\n *\n * @param options Configuration options for this SDK.\n */\n public constructor(options: MiniappOptions = {}) {\n super(MiniappBackend, options);\n }\n\n /**\n * @inheritDoc\n */\n protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): PromiseLike<Event | null> {\n event.platform = event.platform || \"javascript\";\n event.sdk = {\n ...event.sdk,\n name: SDK_NAME,\n packages: [\n ...((event.sdk && event.sdk.packages) || []),\n {\n name: \"npm:sentry-quickapp\",\n version: SDK_VERSION\n }\n ],\n version: SDK_VERSION\n };\n\n return super._prepareEvent(event, scope, hint);\n }\n\n /**\n * Show a report dialog to the user to send feedback to a specific event.\n * 向用户显示报告对话框以将反馈发送到特定事件。---> 小程序上暂时用不到&不考虑。\n *\n * @param options Set individual options for the dialog\n */\n public showReportDialog(options: ReportDialogOptions = {}): void {\n // doesn't work without a document (React Native)\n console.log('sentry-quickapp 暂未实现该方法', options);\n }\n}\n"]}
@@ -39,7 +39,7 @@ var getSDK = function () {
39
39
  }
40
40
  else {
41
41
  // tslint:disable-next-line:no-console
42
- console.log("sentry-uniapp 暂不支持此平台, 快应用请使用 sentry-quickapp");
42
+ console.log("sentry-quickapp 暂不支持此平台, 快应用请使用 sentry-quickapp");
43
43
  }
44
44
  return currentSdk;
45
45
  };
@@ -74,4 +74,4 @@ var getAppName = function () {
74
74
  var sdk = getSDK();
75
75
  var appName = getAppName();
76
76
  export { sdk, appName };
77
- //# sourceMappingURL=crossPlatform.js.map
77
+ //# sourceMappingURL=crossPlatform.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"crossPlatform.js","sourceRoot":"","sources":["../src/crossPlatform.ts"],"names":[],"mappings":"AAqCA,IAAI,UAAU,GAAQ;IACpB,qCAAqC;IACrC,OAAO,EAAE;IACT,CAAC;IACD,qCAAqC;IACrC,WAAW,EAAE;IACb,CAAC;IACD,qCAAqC;IACrC,iBAAiB,EAAE;IACnB,CAAC;IACD,qCAAqC;IACrC,aAAa,EAAE;IACf,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,IAAM,MAAM,GAAG;IACb,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,UAAU,GAAG,GAAG,CAAC;KAClB;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,UAAU,GAAG,GAAG,CAAC;KAClB;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,UAAU,GAAG,EAAE,CAAC;KACjB;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,UAAU,GAAG,EAAE,CAAC;KACjB;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,UAAU,GAAG,EAAE,CAAC;KACjB;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,UAAU,GAAG,EAAE,CAAC;KACjB;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QACnC,UAAU,GAAG,IAAI,CAAC;KACnB;SAAM;QACL,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;KAC9D;IAED,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEF;;GAEG;AACH,IAAM,UAAU,GAAG;IACjB,IAAI,cAAc,GAAY,SAAS,CAAC;IAExC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,cAAc,GAAG,QAAQ,CAAC;KAC3B;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,cAAc,GAAG,QAAQ,CAAC;KAC3B;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,cAAc,GAAG,QAAQ,CAAC;KAC3B;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,cAAc,GAAG,WAAW,CAAC;KAC9B;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,cAAc,GAAG,UAAU,CAAC;KAC7B;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,cAAc,GAAG,IAAI,CAAC;KACvB;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QACnC,cAAc,GAAG,MAAM,CAAC;KACzB;IAED,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC;AAEF,IAAM,GAAG,GAAG,MAAM,EAAE,CAAC;AACrB,IAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAE7B,OAAO,EAAC,GAAG,EAAE,OAAO,EAAC,CAAC","sourcesContent":["declare const uni: any; // uniapp\ndeclare const wx: any; // 微信小程序、微信小游戏\ndeclare const my: any; // 支付宝小程序\ndeclare const tt: any; // 字节跳动小程序\ndeclare const dd: any; // 钉钉小程序\ndeclare const qq: any; // QQ 小程序、QQ 小游戏\ndeclare const swan: any; // 百度小程序\n\n/**\n * 小程序平台 SDK 接口\n */\ninterface SDK {\n request: Function;\n httpRequest?: Function; // 针对钉钉小程序\n getSystemInfo: Function;\n getSystemInfoSync: Function;\n onError?: Function;\n onUnhandledRejection?: Function;\n onPageNotFound?: Function;\n onMemoryWarning?: Function;\n getLaunchOptionsSync?: Function;\n}\n\n/**\n * 小程序平台 接口\n */\ntype AppName =\n | \"uniapp\"\n | \"wechat\"\n | \"alipay\"\n | \"bytedance\"\n | \"dingtalk\"\n | \"qq\"\n | \"swan\"\n | \"quickapp\"\n | \"unknown\";\n\nlet currentSdk: SDK = {\n // tslint:disable-next-line: no-empty\n request: () => {\n },\n // tslint:disable-next-line: no-empty\n httpRequest: () => {\n },\n // tslint:disable-next-line: no-empty\n getSystemInfoSync: () => {\n },\n // tslint:disable-next-line: no-empty\n getSystemInfo: () => {\n },\n};\n\n/**\n * 获取跨平台的 SDK\n */\nconst getSDK = () => {\n if (typeof uni === \"object\") {\n currentSdk = uni;\n } else if (typeof wx === \"object\") {\n currentSdk = uni;\n } else if (typeof my === \"object\") {\n currentSdk = my;\n } else if (typeof tt === \"object\") {\n currentSdk = tt;\n } else if (typeof dd === \"object\") {\n currentSdk = dd;\n } else if (typeof qq === \"object\") {\n currentSdk = qq;\n } else if (typeof swan === \"object\") {\n currentSdk = swan;\n } else {\n // tslint:disable-next-line:no-console\n console.log(\"sentry-uniapp 暂不支持此平台, 快应用请使用 sentry-quickapp\");\n }\n\n return currentSdk;\n};\n\n/**\n * 获取平台名称\n */\nconst getAppName = () => {\n let currentAppName: AppName = \"unknown\";\n\n if (typeof uni === \"object\") {\n currentAppName = \"uniapp\";\n } else if (typeof wx === \"object\") {\n currentAppName = \"wechat\";\n } else if (typeof my === \"object\") {\n currentAppName = \"alipay\";\n } else if (typeof tt === \"object\") {\n currentAppName = \"bytedance\";\n } else if (typeof dd === \"object\") {\n currentAppName = \"dingtalk\";\n } else if (typeof qq === \"object\") {\n currentAppName = \"qq\";\n } else if (typeof swan === \"object\") {\n currentAppName = \"swan\";\n }\n\n return currentAppName;\n};\n\nconst sdk = getSDK();\nconst appName = getAppName();\n\nexport {sdk, appName};\n"]}
1
+ {"version":3,"file":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,EAAE,KAAK,QAAQ,EAAE;QACjC,cAAc,GAAG,QAAQ,CAAC;KAC3B;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,cAAc,GAAG,WAAW,CAAC;KAC9B;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,cAAc,GAAG,UAAU,CAAC;KAC7B;SAAM,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QACjC,cAAc,GAAG,IAAI,CAAC;KACvB;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QACnC,cAAc,GAAG,MAAM,CAAC;KACzB;IAED,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC;AAEF,IAAM,GAAG,GAAG,MAAM,EAAE,CAAC;AACrB,IAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAE7B,OAAO,EAAC,GAAG,EAAE,OAAO,EAAC,CAAC","sourcesContent":["declare const uni: any; // uniapp\ndeclare const wx: any; // 微信小程序、微信小游戏\ndeclare const my: any; // 支付宝小程序\ndeclare const tt: any; // 字节跳动小程序\ndeclare const dd: any; // 钉钉小程序\ndeclare const qq: any; // QQ 小程序、QQ 小游戏\ndeclare const swan: any; // 百度小程序\n\n/**\n * 小程序平台 SDK 接口\n */\ninterface SDK {\n request: Function;\n httpRequest?: Function; // 针对钉钉小程序\n getSystemInfo: Function;\n getSystemInfoSync: Function;\n onError?: Function;\n onUnhandledRejection?: Function;\n onPageNotFound?: Function;\n onMemoryWarning?: Function;\n getLaunchOptionsSync?: Function;\n}\n\n/**\n * 小程序平台 接口\n */\ntype AppName =\n | \"uniapp\"\n | \"wechat\"\n | \"alipay\"\n | \"bytedance\"\n | \"dingtalk\"\n | \"qq\"\n | \"swan\"\n | \"quickapp\"\n | \"unknown\";\n\nlet currentSdk: SDK = {\n // tslint:disable-next-line: no-empty\n request: () => {\n },\n // tslint:disable-next-line: no-empty\n httpRequest: () => {\n },\n // tslint:disable-next-line: no-empty\n getSystemInfoSync: () => {\n },\n // tslint:disable-next-line: no-empty\n getSystemInfo: () => {\n },\n};\n\n/**\n * 获取跨平台的 SDK\n */\nconst getSDK = () => {\n if (typeof uni === \"object\") {\n currentSdk = uni;\n } else if (typeof wx === \"object\") {\n currentSdk = uni;\n } else if (typeof my === \"object\") {\n currentSdk = my;\n } else if (typeof tt === \"object\") {\n currentSdk = tt;\n } else if (typeof dd === \"object\") {\n currentSdk = dd;\n } else if (typeof qq === \"object\") {\n currentSdk = qq;\n } else if (typeof swan === \"object\") {\n currentSdk = swan;\n } else {\n // tslint:disable-next-line:no-console\n console.log(\"sentry-quickapp 暂不支持此平台, 快应用请使用 sentry-quickapp\");\n }\n\n return currentSdk;\n};\n\n/**\n * 获取平台名称\n */\nconst getAppName = () => {\n let currentAppName: AppName = \"unknown\";\n\n if (typeof uni === \"object\") {\n currentAppName = \"uniapp\";\n } else if (typeof wx === \"object\") {\n currentAppName = \"wechat\";\n } else if (typeof my === \"object\") {\n currentAppName = \"alipay\";\n } else if (typeof tt === \"object\") {\n currentAppName = \"bytedance\";\n } else if (typeof dd === \"object\") {\n currentAppName = \"dingtalk\";\n } else if (typeof qq === \"object\") {\n currentAppName = \"qq\";\n } else if (typeof swan === \"object\") {\n currentAppName = \"swan\";\n }\n\n return currentAppName;\n};\n\nconst sdk = getSDK();\nconst appName = getAppName();\n\nexport {sdk, appName};\n"]}
@@ -51,7 +51,7 @@ var GlobalHandlers = /** @class */ (function () {
51
51
  var currentHub_1 = getCurrentHub();
52
52
  // https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html
53
53
  sdk.onError(function (err) {
54
- // console.info("sentry-uniapp", error);
54
+ // console.info("sentry-quickapp", error);
55
55
  var error = typeof err === 'string' ? new Error(err) : err;
56
56
  currentHub_1.captureException(error);
57
57
  });
@@ -131,4 +131,4 @@ var GlobalHandlers = /** @class */ (function () {
131
131
  return GlobalHandlers;
132
132
  }());
133
133
  export { GlobalHandlers };
134
- //# sourceMappingURL=globalhandlers.js.map
134
+ //# sourceMappingURL=globalhandlers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"globalhandlers.js","sourceRoot":"","sources":["../../src/integrations/globalhandlers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAUvC,sBAAsB;AACtB;IA0BE,YAAY;IACZ,wBAAmB,OAAoC;QA1BvD;;WAEG;QACI,SAAI,GAAW,cAAc,CAAC,EAAE,CAAC;QAUxC,YAAY;QACJ,6BAAwB,GAAY,KAAK,CAAC;QAElD,YAAY;QACJ,0CAAqC,GAAY,KAAK,CAAC;QAE/D,YAAY;QACJ,oCAA+B,GAAY,KAAK,CAAC;QAEzD,YAAY;QACJ,qCAAgC,GAAY,KAAK,CAAC;QAIxD,IAAI,CAAC,QAAQ,cACX,OAAO,EAAE,IAAI,EACb,oBAAoB,EAAE,IAAI,EAC1B,cAAc,EAAE,IAAI,EACpB,eAAe,EAAE,IAAI,IAClB,OAAO,CACX,CAAC;IACJ,CAAC;IACD;;OAEG;IACI,kCAAS,GAAhB;QACE,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;QAE3B,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;YACzB,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;YAC/C,IAAI,CAAC,4BAA4B,EAAE,CAAC;SACrC;QAED,IAAI,IAAI,CAAC,QAAQ,CAAC,oBAAoB,EAAE;YACtC,MAAM,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;YAC5D,IAAI,CAAC,yCAAyC,EAAE,CAAC;SAClD;QAED,IAAI,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE;YAChC,MAAM,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;YACtD,IAAI,CAAC,mCAAmC,EAAE,CAAC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BACV;gBAED,YAAU,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;gBACnD,YAAU,CAAC,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;gBAC7C,YAAU,CAAC,cAAc,CAAC,sCAAQ,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;SACJ;QAED,IAAI,CAAC,gCAAgC,GAAG,IAAI,CAAC;IAC/C,CAAC;IAjKD;;OAEG;IACW,iBAAE,GAAW,gBAAgB,CAAC;IA+J9C,qBAAC;CAAA,AAxKD,IAwKC;SAxKY,cAAc","sourcesContent":["import { getCurrentHub } from \"@sentry/core\";\nimport { Integration } from \"@sentry/types\";\nimport { logger } from \"@sentry/utils\";\n\nimport { sdk } from \"../crossPlatform\";\n\n/** JSDoc */\ninterface GlobalHandlersIntegrations {\n onerror: boolean;\n onunhandledrejection: boolean;\n onpagenotfound: boolean;\n onmemorywarning: boolean;\n}\n\n/** Global handlers */\nexport class GlobalHandlers implements Integration {\n /**\n * @inheritDoc\n */\n public name: string = GlobalHandlers.id;\n\n /**\n * @inheritDoc\n */\n public static id: string = \"GlobalHandlers\";\n\n /** JSDoc */\n private readonly _options: GlobalHandlersIntegrations;\n\n /** JSDoc */\n private _onErrorHandlerInstalled: boolean = false;\n\n /** JSDoc */\n private _onUnhandledRejectionHandlerInstalled: boolean = false;\n\n /** JSDoc */\n private _onPageNotFoundHandlerInstalled: boolean = false;\n\n /** JSDoc */\n private _onMemoryWarningHandlerInstalled: boolean = false;\n\n /** JSDoc */\n public constructor(options?: GlobalHandlersIntegrations) {\n this._options = {\n onerror: true,\n onunhandledrejection: true,\n onpagenotfound: true,\n onmemorywarning: true,\n ...options,\n };\n }\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n Error.stackTraceLimit = 50;\n\n if (this._options.onerror) {\n logger.log(\"Global Handler attached: onError\");\n this._installGlobalOnErrorHandler();\n }\n\n if (this._options.onunhandledrejection) {\n logger.log(\"Global Handler attached: onunhandledrejection\");\n this._installGlobalOnUnhandledRejectionHandler();\n }\n\n if (this._options.onpagenotfound) {\n logger.log(\"Global Handler attached: onPageNotFound\");\n this._installGlobalOnPageNotFoundHandler();\n }\n\n if (this._options.onmemorywarning) {\n logger.log(\"Global Handler attached: onMemoryWarning\");\n this._installGlobalOnMemoryWarningHandler();\n }\n }\n\n /** JSDoc */\n private _installGlobalOnErrorHandler(): void {\n if (this._onErrorHandlerInstalled) {\n return;\n }\n\n if (!!sdk.onError) {\n const currentHub = getCurrentHub();\n\n // https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html\n sdk.onError((err: string | object) => {\n // console.info(\"sentry-uniapp\", error);\n const error = typeof err === 'string' ? new Error(err) : err\n currentHub.captureException(error);\n });\n }\n\n this._onErrorHandlerInstalled = true;\n }\n\n /** JSDoc */\n private _installGlobalOnUnhandledRejectionHandler(): void {\n if (this._onUnhandledRejectionHandlerInstalled) {\n return;\n }\n\n if (!!sdk.onUnhandledRejection) {\n const currentHub = getCurrentHub();\n /** JSDoc */\n interface OnUnhandledRejectionRes {\n reason: string | object;\n promise: Promise<any>;\n }\n\n // https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html\n sdk.onUnhandledRejection(\n ({ reason, promise }: OnUnhandledRejectionRes) => {\n // console.log(reason, typeof reason, promise)\n // 为什么官方文档上说 reason 是 string 类型,但是实际返回的确实 object 类型\n const error = typeof reason === 'string' ? new Error(reason) : reason\n currentHub.captureException(error, {\n data: promise,\n });\n }\n );\n }\n\n this._onUnhandledRejectionHandlerInstalled = true;\n }\n\n /** JSDoc */\n private _installGlobalOnPageNotFoundHandler(): void {\n if (this._onPageNotFoundHandlerInstalled) {\n return;\n }\n\n if (!!sdk.onPageNotFound) {\n const currentHub = getCurrentHub();\n\n sdk.onPageNotFound((res: { path: string }) => {\n const url = res.path.split(\"?\")[0];\n\n currentHub.setTag(\"pagenotfound\", url);\n currentHub.setExtra(\"message\", JSON.stringify(res));\n currentHub.captureMessage(`页面无法找到: ${url}`);\n });\n }\n\n this._onPageNotFoundHandlerInstalled = true;\n }\n\n /** JSDoc */\n private _installGlobalOnMemoryWarningHandler(): void {\n if (this._onMemoryWarningHandlerInstalled) {\n return;\n }\n\n if (!!sdk.onMemoryWarning) {\n const currentHub = getCurrentHub();\n\n sdk.onMemoryWarning(({ level = -1 }: { level: number }) => {\n let levelMessage = \"没有获取到告警级别信息\";\n\n switch (level) {\n case 5:\n levelMessage = \"TRIM_MEMORY_RUNNING_MODERATE\";\n break;\n case 10:\n levelMessage = \"TRIM_MEMORY_RUNNING_LOW\";\n break;\n case 15:\n levelMessage = \"TRIM_MEMORY_RUNNING_CRITICAL\";\n break;\n default:\n return;\n }\n\n currentHub.setTag(\"memory-warning\", String(level));\n currentHub.setExtra(\"message\", levelMessage);\n currentHub.captureMessage(`内存不足告警`);\n });\n }\n\n this._onMemoryWarningHandlerInstalled = true;\n }\n}\n"]}
1
+ {"version":3,"file":"globalhandlers.js","sourceRoot":"","sources":["../../src/integrations/globalhandlers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAUvC,sBAAsB;AACtB;IA0BE,YAAY;IACZ,wBAAmB,OAAoC;QA1BvD;;WAEG;QACI,SAAI,GAAW,cAAc,CAAC,EAAE,CAAC;QAUxC,YAAY;QACJ,6BAAwB,GAAY,KAAK,CAAC;QAElD,YAAY;QACJ,0CAAqC,GAAY,KAAK,CAAC;QAE/D,YAAY;QACJ,oCAA+B,GAAY,KAAK,CAAC;QAEzD,YAAY;QACJ,qCAAgC,GAAY,KAAK,CAAC;QAIxD,IAAI,CAAC,QAAQ,cACX,OAAO,EAAE,IAAI,EACb,oBAAoB,EAAE,IAAI,EAC1B,cAAc,EAAE,IAAI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9C,CAAC;IAED,YAAY;IACJ,6DAAoC,GAA5C;QACE,IAAI,IAAI,CAAC,gCAAgC,EAAE;YACzC,OAAO;SACR;QAED,IAAI,CAAC,CAAC,GAAG,CAAC,eAAe,EAAE;YACzB,IAAM,YAAU,GAAG,aAAa,EAAE,CAAC;YAEnC,GAAG,CAAC,eAAe,CAAC,UAAC,EAAiC;oBAA/B,aAAU,EAAV,KAAK,mBAAG,CAAC,CAAC,KAAA;gBAC/B,IAAI,YAAY,GAAG,aAAa,CAAC;gBAEjC,QAAQ,KAAK,EAAE;oBACb,KAAK,CAAC;wBACJ,YAAY,GAAG,8BAA8B,CAAC;wBAC9C,MAAM;oBACR,KAAK,EAAE;wBACL,YAAY,GAAG,yBAAyB,CAAC;wBACzC,MAAM;oBACR,KAAK,EAAE;wBACL,YAAY,GAAG,8BAA8B,CAAC;wBAC9C,MAAM;oBACR;wBACE,OAAO;iBACV;gBAED,YAAU,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;gBACnD,YAAU,CAAC,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;gBAC7C,YAAU,CAAC,cAAc,CAAC,sCAAQ,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;SACJ;QAED,IAAI,CAAC,gCAAgC,GAAG,IAAI,CAAC;IAC/C,CAAC;IAjKD;;OAEG;IACW,iBAAE,GAAW,gBAAgB,CAAC;IA+J9C,qBAAC;CAAA,AAxKD,IAwKC;SAxKY,cAAc","sourcesContent":["import { getCurrentHub } from \"@sentry/core\";\nimport { Integration } from \"@sentry/types\";\nimport { logger } from \"@sentry/utils\";\n\nimport { sdk } from \"../crossPlatform\";\n\n/** JSDoc */\ninterface GlobalHandlersIntegrations {\n onerror: boolean;\n onunhandledrejection: boolean;\n onpagenotfound: boolean;\n onmemorywarning: boolean;\n}\n\n/** Global handlers */\nexport class GlobalHandlers implements Integration {\n /**\n * @inheritDoc\n */\n public name: string = GlobalHandlers.id;\n\n /**\n * @inheritDoc\n */\n public static id: string = \"GlobalHandlers\";\n\n /** JSDoc */\n private readonly _options: GlobalHandlersIntegrations;\n\n /** JSDoc */\n private _onErrorHandlerInstalled: boolean = false;\n\n /** JSDoc */\n private _onUnhandledRejectionHandlerInstalled: boolean = false;\n\n /** JSDoc */\n private _onPageNotFoundHandlerInstalled: boolean = false;\n\n /** JSDoc */\n private _onMemoryWarningHandlerInstalled: boolean = false;\n\n /** JSDoc */\n public constructor(options?: GlobalHandlersIntegrations) {\n this._options = {\n onerror: true,\n onunhandledrejection: true,\n onpagenotfound: true,\n onmemorywarning: true,\n ...options,\n };\n }\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n Error.stackTraceLimit = 50;\n\n if (this._options.onerror) {\n logger.log(\"Global Handler attached: onError\");\n this._installGlobalOnErrorHandler();\n }\n\n if (this._options.onunhandledrejection) {\n logger.log(\"Global Handler attached: onunhandledrejection\");\n this._installGlobalOnUnhandledRejectionHandler();\n }\n\n if (this._options.onpagenotfound) {\n logger.log(\"Global Handler attached: onPageNotFound\");\n this._installGlobalOnPageNotFoundHandler();\n }\n\n if (this._options.onmemorywarning) {\n logger.log(\"Global Handler attached: onMemoryWarning\");\n this._installGlobalOnMemoryWarningHandler();\n }\n }\n\n /** JSDoc */\n private _installGlobalOnErrorHandler(): void {\n if (this._onErrorHandlerInstalled) {\n return;\n }\n\n if (!!sdk.onError) {\n const currentHub = getCurrentHub();\n\n // https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html\n sdk.onError((err: string | object) => {\n // console.info(\"sentry-quickapp\", error);\n const error = typeof err === 'string' ? new Error(err) : err\n currentHub.captureException(error);\n });\n }\n\n this._onErrorHandlerInstalled = true;\n }\n\n /** JSDoc */\n private _installGlobalOnUnhandledRejectionHandler(): void {\n if (this._onUnhandledRejectionHandlerInstalled) {\n return;\n }\n\n if (!!sdk.onUnhandledRejection) {\n const currentHub = getCurrentHub();\n /** JSDoc */\n interface OnUnhandledRejectionRes {\n reason: string | object;\n promise: Promise<any>;\n }\n\n // https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html\n sdk.onUnhandledRejection(\n ({ reason, promise }: OnUnhandledRejectionRes) => {\n // console.log(reason, typeof reason, promise)\n // 为什么官方文档上说 reason 是 string 类型,但是实际返回的确实 object 类型\n const error = typeof reason === 'string' ? new Error(reason) : reason\n currentHub.captureException(error, {\n data: promise,\n });\n }\n );\n }\n\n this._onUnhandledRejectionHandlerInstalled = true;\n }\n\n /** JSDoc */\n private _installGlobalOnPageNotFoundHandler(): void {\n if (this._onPageNotFoundHandlerInstalled) {\n return;\n }\n\n if (!!sdk.onPageNotFound) {\n const currentHub = getCurrentHub();\n\n sdk.onPageNotFound((res: { path: string }) => {\n const url = res.path.split(\"?\")[0];\n\n currentHub.setTag(\"pagenotfound\", url);\n currentHub.setExtra(\"message\", JSON.stringify(res));\n currentHub.captureMessage(`页面无法找到: ${url}`);\n });\n }\n\n this._onPageNotFoundHandlerInstalled = true;\n }\n\n /** JSDoc */\n private _installGlobalOnMemoryWarningHandler(): void {\n if (this._onMemoryWarningHandlerInstalled) {\n return;\n }\n\n if (!!sdk.onMemoryWarning) {\n const currentHub = getCurrentHub();\n\n sdk.onMemoryWarning(({ level = -1 }: { level: number }) => {\n let levelMessage = \"没有获取到告警级别信息\";\n\n switch (level) {\n case 5:\n levelMessage = \"TRIM_MEMORY_RUNNING_MODERATE\";\n break;\n case 10:\n levelMessage = \"TRIM_MEMORY_RUNNING_LOW\";\n break;\n case 15:\n levelMessage = \"TRIM_MEMORY_RUNNING_CRITICAL\";\n break;\n default:\n return;\n }\n\n currentHub.setTag(\"memory-warning\", String(level));\n currentHub.setExtra(\"message\", levelMessage);\n currentHub.captureMessage(`内存不足告警`);\n });\n }\n\n this._onMemoryWarningHandlerInstalled = true;\n }\n}\n"]}
@@ -28,7 +28,7 @@ var Router = /** @class */ (function () {
28
28
  return __assign(__assign({}, event), { extra: __assign(__assign({}, event.extra), { routers: routers }) });
29
29
  }
30
30
  catch (e) {
31
- console.warn("sentry-uniapp get router info fail: " + e);
31
+ console.warn("sentry-quickapp get router info fail: " + e);
32
32
  }
33
33
  }
34
34
  }
@@ -42,4 +42,4 @@ var Router = /** @class */ (function () {
42
42
  return Router;
43
43
  }());
44
44
  export { Router };
45
- //# sourceMappingURL=router.js.map
45
+ //# sourceMappingURL=router.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/integrations/router.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAUtE,gBAAgB;AAChB;IAcE;;OAEG;IACH,gBAAmB,OAA4B;QAhB/C;;WAEG;QACI,SAAI,GAAW,MAAM,CAAC,EAAE,CAAC;QAc9B,IAAI,CAAC,QAAQ,cACX,MAAM,EAAE,IAAI,IACT,OAAO,CACX,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,0BAAS,GAAhB;QAAA,iBA2BC;QA1BC,uBAAuB,CAAC,UAAC,KAAY;YACnC,IAAI,aAAa,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE;gBAC1C,IAAI,KAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;oBACxB,IAAI;wBACF,IAAM,OAAO,GAAG,eAAe,EAAE,CAAC,GAAG,CACnC,UAAC,KAAyC,IAAK,OAAA,CAAC;4BAC9C,KAAK,EAAE,KAAK,CAAC,KAAK;4BAClB,OAAO,EAAE,KAAK,CAAC,OAAO;yBACvB,CAAC,EAH6C,CAG7C,CACH,CAAC;wBAEF,6BACK,KAAK,KACR,KAAK,wBACA,KAAK,CAAC,KAAK,KACd,OAAO,SAAA,OAET;qBACH;oBAAC,OAAO,CAAC,EAAE;wBACV,OAAO,CAAC,IAAI,CAAC,yCAAuC,CAAG,CAAC,CAAC;qBAC1D;iBACF;aACF;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;IAhDD;;OAEG;IACW,SAAE,GAAW,QAAQ,CAAC;IA8CtC,aAAC;CAAA,AAvDD,IAuDC;SAvDY,MAAM","sourcesContent":["import { addGlobalEventProcessor, getCurrentHub } from \"@sentry/core\";\nimport { Event, Integration } from \"@sentry/types\";\n\ndeclare const getCurrentPages: any;\n\n/** JSDoc */\ninterface RouterIntegrations {\n enable?: boolean;\n}\n\n/** UserAgent */\nexport class Router implements Integration {\n /**\n * @inheritDoc\n */\n public name: string = Router.id;\n\n /**\n * @inheritDoc\n */\n public static id: string = \"Router\";\n\n /** JSDoc */\n private readonly _options: RouterIntegrations;\n\n /**\n * @inheritDoc\n */\n public constructor(options?: RouterIntegrations) {\n this._options = {\n enable: true,\n ...options,\n };\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor((event: Event) => {\n if (getCurrentHub().getIntegration(Router)) {\n if (this._options.enable) {\n try {\n const routers = getCurrentPages().map(\n (route: { route: string; options: object }) => ({\n route: route.route,\n options: route.options,\n })\n );\n\n return {\n ...event,\n extra: {\n ...event.extra,\n routers,\n },\n };\n } catch (e) {\n console.warn(`sentry-uniapp get router info fail: ${e}`);\n }\n }\n }\n\n return event;\n });\n }\n}\n"]}
1
+ {"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/integrations/router.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAUtE,gBAAgB;AAChB;IAcE;;OAEG;IACH,gBAAmB,OAA4B;QAhB/C;;WAEG;QACI,SAAI,GAAW,MAAM,CAAC,EAAE,CAAC;QAc9B,IAAI,CAAC,QAAQ,cACX,MAAM,EAAE,IAAI,IACT,OAAO,CACX,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,0BAAS,GAAhB;QAAA,iBA2BC;QA1BC,uBAAuB,CAAC,UAAC,KAAY;YACnC,IAAI,aAAa,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE;gBAC1C,IAAI,KAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;oBACxB,IAAI;wBACF,IAAM,OAAO,GAAG,eAAe,EAAE,CAAC,GAAG,CACnC,UAAC,KAAyC,IAAK,OAAA,CAAC;4BAC9C,KAAK,EAAE,KAAK,CAAC,KAAK;4BAClB,OAAO,EAAE,KAAK,CAAC,OAAO;yBACvB,CAAC,EAH6C,CAG7C,CACH,CAAC;wBAEF,6BACK,KAAK,KACR,KAAK,wBACA,KAAK,CAAC,KAAK,KACd,OAAO,SAAA,OAET;qBACH;oBAAC,OAAO,CAAC,EAAE;wBACV,OAAO,CAAC,IAAI,CAAC,yCAAuC,CAAG,CAAC,CAAC;qBAC1D;iBACF;aACF;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;IAhDD;;OAEG;IACW,SAAE,GAAW,QAAQ,CAAC;IA8CtC,aAAC;CAAA,AAvDD,IAuDC;SAvDY,MAAM","sourcesContent":["import { addGlobalEventProcessor, getCurrentHub } from \"@sentry/core\";\nimport { Event, Integration } from \"@sentry/types\";\n\ndeclare const getCurrentPages: any;\n\n/** JSDoc */\ninterface RouterIntegrations {\n enable?: boolean;\n}\n\n/** UserAgent */\nexport class Router implements Integration {\n /**\n * @inheritDoc\n */\n public name: string = Router.id;\n\n /**\n * @inheritDoc\n */\n public static id: string = \"Router\";\n\n /** JSDoc */\n private readonly _options: RouterIntegrations;\n\n /**\n * @inheritDoc\n */\n public constructor(options?: RouterIntegrations) {\n this._options = {\n enable: true,\n ...options,\n };\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor((event: Event) => {\n if (getCurrentHub().getIntegration(Router)) {\n if (this._options.enable) {\n try {\n const routers = getCurrentPages().map(\n (route: { route: string; options: object }) => ({\n route: route.route,\n options: route.options,\n })\n );\n\n return {\n ...event,\n extra: {\n ...event.extra,\n routers,\n },\n };\n } catch (e) {\n console.warn(`sentry-quickapp get router info fail: ${e}`);\n }\n }\n }\n\n return event;\n });\n }\n}\n"]}
@@ -50,7 +50,7 @@ var System = /** @class */ (function () {
50
50
  fontSizeSetting: fontSizeSetting, app: app || appName || currentAppName }, systemInfo) }) })];
51
51
  case 3:
52
52
  e_1 = _b.sent();
53
- console.warn("sentry-uniapp get system info fail: " + e_1);
53
+ console.warn("sentry-quickapp get system info fail: " + e_1);
54
54
  return [3 /*break*/, 4];
55
55
  case 4: return [2 /*return*/, event];
56
56
  }
@@ -64,4 +64,4 @@ var System = /** @class */ (function () {
64
64
  return System;
65
65
  }());
66
66
  export { System };
67
- //# sourceMappingURL=system.js.map
67
+ //# sourceMappingURL=system.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"system.js","sourceRoot":"","sources":["../../src/integrations/system.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGtE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,gBAAgB;AAChB;IAAA;QACE;;WAEG;QACI,SAAI,GAAW,MAAM,CAAC,EAAE,CAAC;IA+ElC,CAAC;IAxEC;;OAEG;IACI,0BAAS,GAAhB;QAAA,iBAoEC;QAnEC,uBAAuB,CAAC,UAAO,KAAY;;;;;6BACrC,aAAa,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,EAAtC,wBAAsC;;;;wBAEnB,qBAAM,GAAG,CAAC,aAAa,EAAE,EAAA;;wBAAtC,UAAU,GAAG,SAAyB;wBAG1C,YAAY,GAkBV,UAAU,aAlBA,EACZ,cAAc,GAiBZ,UAAU,eAjBE,EACd,OAAO,GAgBL,UAAU,QAhBL,EACP,KAAK,GAeH,UAAU,MAfP,EACL,QAAQ,GAcN,UAAU,SAdJ,EACR,KAAK,GAaH,UAAU,MAbP,EACL,UAAU,GAYR,UAAU,WAZF,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ent":["import { addGlobalEventProcessor, getCurrentHub } from \"@sentry/core\";\nimport { Event, Integration } from \"@sentry/types\";\n\nimport { appName as currentAppName, sdk } from \"../crossPlatform\";\nimport { SDK_VERSION } from \"../version\";\n\n/** UserAgent */\nexport class System implements Integration {\n /**\n * @inheritDoc\n */\n public name: string = System.id;\n\n /**\n * @inheritDoc\n */\n public static id: string = \"System\";\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor(async (event: Event) => {\n if (getCurrentHub().getIntegration(System)) {\n try {\n const systemInfo = await sdk.getSystemInfo()\n\n const {\n batteryLevel, // 微信小程序\n currentBattery, // 支付宝小程序、 钉钉小程序\n battery, // 字节跳动小程序\n brand,\n language,\n model,\n pixelRatio,\n platform,\n screenHeight,\n screenWidth,\n statusBarHeight,\n system,\n version,\n windowHeight,\n windowWidth,\n app, // 支付宝小程序\n appName, // 字节跳动小程序\n fontSizeSetting, // 支付宝小程序、 钉钉小程序、微信小程序\n } = systemInfo;\n\n // tslint:disable-next-line:variable-name\n const SDKVersion = SDK_VERSION;\n const [systemName, systemVersion] = system.split(\" \");\n\n return {\n ...event,\n contexts: {\n ...event.contexts,\n device: {\n brand,\n battery_level: batteryLevel || currentBattery || battery,\n model,\n screen_dpi: pixelRatio\n },\n os: {\n name: systemName || system,\n version: systemVersion || system\n },\n extra: {\n SDKVersion,\n language,\n platform,\n screenHeight,\n screenWidth,\n statusBarHeight,\n version,\n windowHeight,\n windowWidth,\n fontSizeSetting,\n app: app || appName || currentAppName,\n ...systemInfo,\n }\n }\n };\n } catch (e) {\n console.warn(`sentry-uniapp get system info fail: ${e}`);\n }\n }\n\n return event;\n });\n }\n}\n"]}
1
+ {"version":3,"file":"system.js","sourceRoot":"","sources":["../../src/integrations/system.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGtE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,GAAG,EAAE,MAAM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,UAAU,EAAE,UAAU;qCACvB,EACD,EAAE,EAAE;wCACF,IAAI,EAAE,UAAU,IAAI,MAAM;wCAC1B,OAAO,EAAE,aAAa,IAAI,MAAM;qCACjC,EACD,KAAK,aACH,UAAU,YAAA;wCACV,QAAQ,UAAA;wCACR,QAAQ,UAAA;wCACR,YAAY,cAAA;wCACZ,WAAW,aAAA;wCACX,eAAe,iBAAA;wCACf,OAAO,SAAA;wCACP,YAAY,cAAA;wCACZ,WAAW,aAAA;wCACX,eAAe,iBAAA,EACf,GAAG,EAAE,GAAG,IAAI,OAAO,IAAI,cAAc,IAClC,UAAU,SAGjB;;;wBAEF,OAAO,CAAC,IAAI,CAAC,yCAAuC,GAAG,CAAC,CAAC;;4BAI7D,sBAAO,KAAK,EAAC;;;aACd,CAAC,CAAC;IACL,CAAC;IA5ED;;OAEG;IACW,SAAE,GAAW,QAAQ,CAAC;IA0EtC,aAAC;CAAA,AAnFD,IAmFC;SAnFY,MAAM","sourcesContent":["import { addGlobalEventProcessor, getCurrentHub } from \"@sentry/core\";\nimport { Event, Integration } from \"@sentry/types\";\n\nimport { appName as currentAppName, sdk } from \"../crossPlatform\";\nimport { SDK_VERSION } from \"../version\";\n\n/** UserAgent */\nexport class System implements Integration {\n /**\n * @inheritDoc\n */\n public name: string = System.id;\n\n /**\n * @inheritDoc\n */\n public static id: string = \"System\";\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor(async (event: Event) => {\n if (getCurrentHub().getIntegration(System)) {\n try {\n const systemInfo = await sdk.getSystemInfo()\n\n const {\n batteryLevel, // 微信小程序\n currentBattery, // 支付宝小程序、 钉钉小程序\n battery, // 字节跳动小程序\n brand,\n language,\n model,\n pixelRatio,\n platform,\n screenHeight,\n screenWidth,\n statusBarHeight,\n system,\n version,\n windowHeight,\n windowWidth,\n app, // 支付宝小程序\n appName, // 字节跳动小程序\n fontSizeSetting, // 支付宝小程序、 钉钉小程序、微信小程序\n } = systemInfo;\n\n // tslint:disable-next-line:variable-name\n const SDKVersion = SDK_VERSION;\n const [systemName, systemVersion] = system.split(\" \");\n\n return {\n ...event,\n contexts: {\n ...event.contexts,\n device: {\n brand,\n battery_level: batteryLevel || currentBattery || battery,\n model,\n screen_dpi: pixelRatio\n },\n os: {\n name: systemName || system,\n version: systemVersion || system\n },\n extra: {\n SDKVersion,\n language,\n platform,\n screenHeight,\n screenWidth,\n statusBarHeight,\n version,\n windowHeight,\n windowWidth,\n fontSizeSetting,\n app: app || appName || currentAppName,\n ...systemInfo,\n }\n }\n };\n } catch (e) {\n console.warn(`sentry-quickapp get system info fail: ${e}`);\n }\n }\n\n return event;\n });\n }\n}\n"]}
package/esm/sdk.d.ts CHANGED
@@ -12,7 +12,7 @@ export declare const defaultIntegrations: (CoreIntegrations.FunctionToString | C
12
12
  *
13
13
  * @example
14
14
  * ```
15
- * import { init } from 'sentry-uniapp';
15
+ * import { init } from 'sentry-quickapp';
16
16
  *
17
17
  * init({
18
18
  * dsn: '__DSN__',
@@ -22,7 +22,7 @@ export declare const defaultIntegrations: (CoreIntegrations.FunctionToString | C
22
22
  *
23
23
  * @example
24
24
  * ```
25
- * import { configureScope } from 'sentry-uniapp';
25
+ * import { configureScope } from 'sentry-quickapp';
26
26
  *
27
27
  * configureScope((scope: Scope) => {
28
28
  * scope.setExtra({ battery: 0.7 });
@@ -33,7 +33,7 @@ export declare const defaultIntegrations: (CoreIntegrations.FunctionToString | C
33
33
  *
34
34
  * @example
35
35
  * ```
36
- * import { addBreadcrumb } from 'sentry-uniapp';
36
+ * import { addBreadcrumb } from 'sentry-quickapp';
37
37
  *
38
38
  * addBreadcrumb({
39
39
  * message: 'My Breadcrumb',
@@ -43,7 +43,7 @@ export declare const defaultIntegrations: (CoreIntegrations.FunctionToString | C
43
43
  *
44
44
  * @example
45
45
  * ```
46
- * import * as Sentry from 'sentry-uniapp';
46
+ * import * as Sentry from 'sentry-quickapp';
47
47
  *
48
48
  * Sentry.captureMessage('Hello, world!');
49
49
  * Sentry.captureException(new Error('Good bye'));
@@ -96,4 +96,4 @@ export declare function close(timeout?: number): PromiseLike<boolean>;
96
96
  * @returns The result of wrapped function call.
97
97
  */
98
98
  export declare function wrap(fn: Function): any;
99
- //# sourceMappingURL=sdk.d.ts.map
99
+ //# sourceMappingURL=sdk.d.ts.map
package/esm/sdk.js CHANGED
@@ -22,7 +22,7 @@ export var defaultIntegrations = [
22
22
  *
23
23
  * @example
24
24
  * ```
25
- * import { init } from 'sentry-uniapp';
25
+ * import { init } from 'sentry-quickapp';
26
26
  *
27
27
  * init({
28
28
  * dsn: '__DSN__',
@@ -32,7 +32,7 @@ export var defaultIntegrations = [
32
32
  *
33
33
  * @example
34
34
  * ```
35
- * import { configureScope } from 'sentry-uniapp';
35
+ * import { configureScope } from 'sentry-quickapp';
36
36
  *
37
37
  * configureScope((scope: Scope) => {
38
38
  * scope.setExtra({ battery: 0.7 });
@@ -43,7 +43,7 @@ export var defaultIntegrations = [
43
43
  *
44
44
  * @example
45
45
  * ```
46
- * import { addBreadcrumb } from 'sentry-uniapp';
46
+ * import { addBreadcrumb } from 'sentry-quickapp';
47
47
  *
48
48
  * addBreadcrumb({
49
49
  * message: 'My Breadcrumb',
@@ -53,7 +53,7 @@ export var defaultIntegrations = [
53
53
  *
54
54
  * @example
55
55
  * ```
56
- * import * as Sentry from 'sentry-uniapp';
56
+ * import * as Sentry from 'sentry-quickapp';
57
57
  *
58
58
  * Sentry.captureMessage('Hello, world!');
59
59
  * Sentry.captureException(new Error('Good bye'));
@@ -74,7 +74,7 @@ export function init(options) {
74
74
  if (options.defaultIntegrations === undefined) {
75
75
  options.defaultIntegrations = defaultIntegrations;
76
76
  }
77
- // https://github.com/uappkit/sentry-uniapp/issues/23
77
+ // https://github.com/uappkit/sentry-quickapp/issues/23
78
78
  options.normalizeDepth = options.normalizeDepth || 5;
79
79
  initAndBind(MiniappClient, options);
80
80
  }
@@ -142,4 +142,4 @@ export function wrap(fn) {
142
142
  // tslint:disable-next-line: no-unsafe-any
143
143
  return internalWrap(fn)();
144
144
  }
145
- //# sourceMappingURL=sdk.js.map
145
+ //# sourceMappingURL=sdk.js.map
package/esm/sdk.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,YAAY,IAAI,gBAAgB,GACjC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAuB,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,MAAM,EACN,MAAM,EACN,QAAQ,GACT,MAAM,sBAAsB,CAAC;AAE9B,MAAM,CAAC,IAAM,mBAAmB,GAAG;IACjC,IAAI,gBAAgB,CAAC,cAAc,EAAE;IACrC,IAAI,gBAAgB,CAAC,gBAAgB,EAAE;IACvC,IAAI,QAAQ,EAAE;IACd,IAAI,cAAc,EAAE;IACpB,IAAI,YAAY,EAAE;IAElB,IAAI,MAAM,EAAE;IACZ,IAAI,MAAM,EAAE;IACZ,IAAI,qBAAqB,EAAE;CAC5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,UAAU,IAAI,CAAC,OAA4B;IAA5B,wBAAA,EAAA,YAA4B;IAC/C,0EAA0E;IAC1E,+CAA+C;IAC/C,IAAI,OAAO,CAAC,mBAAmB,KAAK,SAAS,EAAE;QAC7C,OAAO,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;KACnD;IAED,qDAAqD;IACrD,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,CAAC,CAAC;IAErD,WAAW,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAiC;IAAjC,wBAAA,EAAA,YAAiC;IAChE,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;QACpB,OAAO,CAAC,OAAO,GAAG,aAAa,EAAE,CAAC,WAAW,EAAE,CAAC;KACjD;IACD,IAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,EAAiB,CAAC;IAC1D,IAAI,MAAM,EAAE;QACV,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;KAClC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,aAAa,EAAE,CAAC,WAAW,EAAE,CAAC;AACvC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CAAC,OAAgB;IACpC,IAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,EAAiB,CAAC;IAC1D,IAAI,MAAM,EAAE;QACV,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC9B;IACD,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,OAAgB;IACpC,IAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,EAAiB,CAAC;IAC1D,IAAI,MAAM,EAAE;QACV,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC9B;IACD,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,IAAI,CAAC,EAAY;IAC/B,0CAA0C;IAC1C,OAAO,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["import {\n getCurrentHub,\n initAndBind,\n Integrations as CoreIntegrations,\n} from \"@sentry/core\";\nimport { resolvedSyncPromise } from \"@sentry/utils\";\n\nimport { MiniappOptions } from \"./backend\";\nimport { MiniappClient, ReportDialogOptions } from \"./client\";\nimport { wrap as internalWrap } from \"./helpers\";\nimport {\n GlobalHandlers,\n IgnoreMpcrawlerErrors,\n LinkedErrors,\n Router,\n System,\n TryCatch,\n} from \"./integrations/index\";\n\nexport const defaultIntegrations = [\n new CoreIntegrations.InboundFilters(),\n new CoreIntegrations.FunctionToString(),\n new TryCatch(),\n new GlobalHandlers(),\n new LinkedErrors(),\n\n new System(),\n new Router(),\n new IgnoreMpcrawlerErrors(),\n];\n\n/**\n * The Sentry Uniapp SDK Client.\n *\n * To use this SDK, call the {@link init} function as early as possible when\n * launching the app. To set context information or send manual events, use\n * the provided methods.\n *\n * @example\n * ```\n * import { init } from 'sentry-uniapp';\n *\n * init({\n * dsn: '__DSN__',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n * import { configureScope } from 'sentry-uniapp';\n *\n * configureScope((scope: Scope) => {\n * scope.setExtra({ battery: 0.7 });\n * scope.setTag({ user_mode: 'admin' });\n * scope.setUser({ id: '4711' });\n * });\n * ```\n *\n * @example\n * ```\n * import { addBreadcrumb } from 'sentry-uniapp';\n *\n * addBreadcrumb({\n * message: 'My Breadcrumb',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n * import * as Sentry from 'sentry-uniapp';\n *\n * Sentry.captureMessage('Hello, world!');\n * Sentry.captureException(new Error('Good bye'));\n * Sentry.captureEvent({\n * message: 'Manual',\n * stacktrace: [\n * // ...\n * ],\n * });\n * ```\n *\n * @see {@link MiniappOptions} for documentation on configuration options.\n */\nexport function init(options: MiniappOptions = {}): void {\n // 如果将 options.defaultIntegrations 设置为 false,则不会添加默认集成,否则将在内部将其设置为建议的默认集成。\n // tslint:disable-next-line: strict-comparisons\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = defaultIntegrations;\n }\n\n // https://github.com/uappkit/sentry-uniapp/issues/23\n options.normalizeDepth = options.normalizeDepth || 5;\n\n initAndBind(MiniappClient, options);\n}\n\n/**\n * Present the user with a report dialog.\n * 向用户显示报告对话框。小程序上暂时不考虑实现该功能。\n *\n * @param options Everything is optional, we try to fetch all info need from the global scope.\n */\nexport function showReportDialog(options: ReportDialogOptions = {}): void {\n if (!options.eventId) {\n options.eventId = getCurrentHub().lastEventId();\n }\n const client = getCurrentHub().getClient<MiniappClient>();\n if (client) {\n client.showReportDialog(options);\n }\n}\n\n/**\n * This is the getter for lastEventId. 获取 lastEventId。\n *\n * @returns The last event id of a captured event.\n */\nexport function lastEventId(): string | undefined {\n return getCurrentHub().lastEventId();\n}\n\n/**\n * A promise that resolves when all current events have been sent.\n * If you provide a timeout and the queue takes longer to drain the promise returns false.\n * 在发送所有当前事件时会变为 resolved 状态的 promise。如果提供了一个超时时间并且队列需要更长时间来消耗,则 promise 将返回 false。\n *\n * @param timeout Maximum time in ms the client should wait.\n */\nexport function flush(timeout?: number): PromiseLike<boolean> {\n const client = getCurrentHub().getClient<MiniappClient>();\n if (client) {\n return client.flush(timeout);\n }\n return resolvedSyncPromise(false);\n}\n\n/**\n * A promise that resolves when all current events have been sent.\n * If you provide a timeout and the queue takes longer to drain the promise returns false.\n *\n * @param timeout Maximum time in ms the client should wait.\n */\nexport function close(timeout?: number): PromiseLike<boolean> {\n const client = getCurrentHub().getClient<MiniappClient>();\n if (client) {\n return client.close(timeout);\n }\n return resolvedSyncPromise(false);\n}\n\n/**\n * Wrap code within a try/catch block so the SDK is able to capture errors.\n * 在 try / catch 块中包装代码,以便 SDK 能够捕获错误。\n * 实际上是 ./helpers 文件中 warp 方法的进一步封装。\n *\n * @param fn A function to wrap.\n *\n * @returns The result of wrapped function call.\n */\nexport function wrap(fn: Function): any {\n // tslint:disable-next-line: no-unsafe-any\n return internalWrap(fn)();\n}\n"]}
1
+ {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,YAAY,IAAI,gBAAgB,GACjC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB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,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;KAClC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,aAAa,EAAE,CAAC,WAAW,EAAE,CAAC;AACvC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CAAC,OAAgB;IACpC,IAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,EAAiB,CAAC;IAC1D,IAAI,MAAM,EAAE;QACV,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC9B;IACD,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,OAAgB;IACpC,IAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,EAAiB,CAAC;IAC1D,IAAI,MAAM,EAAE;QACV,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC9B;IACD,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,IAAI,CAAC,EAAY;IAC/B,0CAA0C;IAC1C,OAAO,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["import {\n getCurrentHub,\n initAndBind,\n Integrations as CoreIntegrations,\n} from \"@sentry/core\";\nimport { resolvedSyncPromise } from \"@sentry/utils\";\n\nimport { MiniappOptions } from \"./backend\";\nimport { MiniappClient, ReportDialogOptions } from \"./client\";\nimport { wrap as internalWrap } from \"./helpers\";\nimport {\n GlobalHandlers,\n IgnoreMpcrawlerErrors,\n LinkedErrors,\n Router,\n System,\n TryCatch,\n} from \"./integrations/index\";\n\nexport const defaultIntegrations = [\n new CoreIntegrations.InboundFilters(),\n new CoreIntegrations.FunctionToString(),\n new TryCatch(),\n new GlobalHandlers(),\n new LinkedErrors(),\n\n new System(),\n new Router(),\n new IgnoreMpcrawlerErrors(),\n];\n\n/**\n * The Sentry Uniapp SDK Client.\n *\n * To use this SDK, call the {@link init} function as early as possible when\n * launching the app. To set context information or send manual events, use\n * the provided methods.\n *\n * @example\n * ```\n * import { init } from 'sentry-quickapp';\n *\n * init({\n * dsn: '__DSN__',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n * import { configureScope } from 'sentry-quickapp';\n *\n * configureScope((scope: Scope) => {\n * scope.setExtra({ battery: 0.7 });\n * scope.setTag({ user_mode: 'admin' });\n * scope.setUser({ id: '4711' });\n * });\n * ```\n *\n * @example\n * ```\n * import { addBreadcrumb } from 'sentry-quickapp';\n *\n * addBreadcrumb({\n * message: 'My Breadcrumb',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n * import * as Sentry from 'sentry-quickapp';\n *\n * Sentry.captureMessage('Hello, world!');\n * Sentry.captureException(new Error('Good bye'));\n * Sentry.captureEvent({\n * message: 'Manual',\n * stacktrace: [\n * // ...\n * ],\n * });\n * ```\n *\n * @see {@link MiniappOptions} for documentation on configuration options.\n */\nexport function init(options: MiniappOptions = {}): void {\n // 如果将 options.defaultIntegrations 设置为 false,则不会添加默认集成,否则将在内部将其设置为建议的默认集成。\n // tslint:disable-next-line: strict-comparisons\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = defaultIntegrations;\n }\n\n // https://github.com/uappkit/sentry-quickapp/issues/23\n options.normalizeDepth = options.normalizeDepth || 5;\n\n initAndBind(MiniappClient, options);\n}\n\n/**\n * Present the user with a report dialog.\n * 向用户显示报告对话框。小程序上暂时不考虑实现该功能。\n *\n * @param options Everything is optional, we try to fetch all info need from the global scope.\n */\nexport function showReportDialog(options: ReportDialogOptions = {}): void {\n if (!options.eventId) {\n options.eventId = getCurrentHub().lastEventId();\n }\n const client = getCurrentHub().getClient<MiniappClient>();\n if (client) {\n client.showReportDialog(options);\n }\n}\n\n/**\n * This is the getter for lastEventId. 获取 lastEventId。\n *\n * @returns The last event id of a captured event.\n */\nexport function lastEventId(): string | undefined {\n return getCurrentHub().lastEventId();\n}\n\n/**\n * A promise that resolves when all current events have been sent.\n * If you provide a timeout and the queue takes longer to drain the promise returns false.\n * 在发送所有当前事件时会变为 resolved 状态的 promise。如果提供了一个超时时间并且队列需要更长时间来消耗,则 promise 将返回 false。\n *\n * @param timeout Maximum time in ms the client should wait.\n */\nexport function flush(timeout?: number): PromiseLike<boolean> {\n const client = getCurrentHub().getClient<MiniappClient>();\n if (client) {\n return client.flush(timeout);\n }\n return resolvedSyncPromise(false);\n}\n\n/**\n * A promise that resolves when all current events have been sent.\n * If you provide a timeout and the queue takes longer to drain the promise returns false.\n *\n * @param timeout Maximum time in ms the client should wait.\n */\nexport function close(timeout?: number): PromiseLike<boolean> {\n const client = getCurrentHub().getClient<MiniappClient>();\n if (client) {\n return client.close(timeout);\n }\n return resolvedSyncPromise(false);\n}\n\n/**\n * Wrap code within a try/catch block so the SDK is able to capture errors.\n * 在 try / catch 块中包装代码,以便 SDK 能够捕获错误。\n * 实际上是 ./helpers 文件中 warp 方法的进一步封装。\n *\n * @param fn A function to wrap.\n *\n * @returns The result of wrapped function call.\n */\nexport function wrap(fn: Function): any {\n // tslint:disable-next-line: no-unsafe-any\n return internalWrap(fn)();\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sentry-uniapp",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "用于Uniapp/小程序/快应用等平台的 Sentry SDK",
5
5
  "repository": "git://github.com/uappkit/sentry-uniapp.git",
6
6
  "homepage": "https://github.com/uappkit/sentry-uniapp",