sentry-uniapp 1.0.11 → 2.8.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.
Files changed (170) hide show
  1. package/README.md +112 -143
  2. package/dist/client.d.ts +38 -40
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +46 -38
  5. package/dist/client.js.map +1 -1
  6. package/dist/crossPlatform.d.ts +1 -1
  7. package/dist/crossPlatform.js +11 -10
  8. package/dist/crossPlatform.js.map +1 -1
  9. package/dist/eventbuilder.d.ts +9 -10
  10. package/dist/eventbuilder.d.ts.map +1 -1
  11. package/dist/eventbuilder.js +131 -58
  12. package/dist/eventbuilder.js.map +1 -1
  13. package/dist/flags.js +1 -0
  14. package/dist/flags.js.map +1 -1
  15. package/dist/index.d.ts +10 -9
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +84 -21
  18. package/dist/index.js.map +1 -1
  19. package/dist/integrations/globalhandlers.d.ts +10 -44
  20. package/dist/integrations/globalhandlers.d.ts.map +1 -1
  21. package/dist/integrations/globalhandlers.js +101 -134
  22. package/dist/integrations/globalhandlers.js.map +1 -1
  23. package/dist/integrations/ignoreMpcrawlerErrors.d.ts +3 -18
  24. package/dist/integrations/ignoreMpcrawlerErrors.d.ts.map +1 -1
  25. package/dist/integrations/ignoreMpcrawlerErrors.js +28 -28
  26. package/dist/integrations/ignoreMpcrawlerErrors.js.map +1 -1
  27. package/dist/integrations/index.d.ts +4 -6
  28. package/dist/integrations/index.d.ts.map +1 -1
  29. package/dist/integrations/index.js +12 -10
  30. package/dist/integrations/index.js.map +1 -1
  31. package/dist/integrations/router.d.ts +6 -24
  32. package/dist/integrations/router.d.ts.map +1 -1
  33. package/dist/integrations/router.js +39 -42
  34. package/dist/integrations/router.js.map +1 -1
  35. package/dist/integrations/system.d.ts +5 -16
  36. package/dist/integrations/system.d.ts.map +1 -1
  37. package/dist/integrations/system.js +62 -60
  38. package/dist/integrations/system.js.map +1 -1
  39. package/dist/parsers.d.ts +2 -2
  40. package/dist/parsers.d.ts.map +1 -1
  41. package/dist/parsers.js +27 -26
  42. package/dist/parsers.js.map +1 -1
  43. package/dist/sdk.d.ts +9 -85
  44. package/dist/sdk.d.ts.map +1 -1
  45. package/dist/sdk.js +55 -129
  46. package/dist/sdk.js.map +1 -1
  47. package/dist/tracekit.js +35 -33
  48. package/dist/tracekit.js.map +1 -1
  49. package/dist/transport.d.ts +7 -0
  50. package/dist/transport.d.ts.map +1 -0
  51. package/dist/transport.js +45 -0
  52. package/dist/transport.js.map +1 -0
  53. package/dist/transports/index.d.ts +1 -2
  54. package/dist/transports/index.d.ts.map +1 -1
  55. package/dist/transports/index.js +4 -4
  56. package/dist/transports/index.js.map +1 -1
  57. package/dist/version.d.ts +1 -1
  58. package/dist/version.d.ts.map +1 -1
  59. package/dist/version.js +2 -1
  60. package/dist/version.js.map +1 -1
  61. package/esm/client.d.ts +38 -40
  62. package/esm/client.d.ts.map +1 -1
  63. package/esm/client.js +43 -37
  64. package/esm/client.js.map +1 -1
  65. package/esm/crossPlatform.d.ts +1 -1
  66. package/esm/crossPlatform.js +10 -10
  67. package/esm/crossPlatform.js.map +1 -1
  68. package/esm/eventbuilder.d.ts +9 -10
  69. package/esm/eventbuilder.d.ts.map +1 -1
  70. package/esm/eventbuilder.js +125 -52
  71. package/esm/eventbuilder.js.map +1 -1
  72. package/esm/flags.js +1 -1
  73. package/esm/flags.js.map +1 -1
  74. package/esm/index.d.ts +10 -9
  75. package/esm/index.d.ts.map +1 -1
  76. package/esm/index.js +13 -8
  77. package/esm/index.js.map +1 -1
  78. package/esm/integrations/globalhandlers.d.ts +10 -44
  79. package/esm/integrations/globalhandlers.d.ts.map +1 -1
  80. package/esm/integrations/globalhandlers.js +99 -133
  81. package/esm/integrations/globalhandlers.js.map +1 -1
  82. package/esm/integrations/ignoreMpcrawlerErrors.d.ts +3 -18
  83. package/esm/integrations/ignoreMpcrawlerErrors.d.ts.map +1 -1
  84. package/esm/integrations/ignoreMpcrawlerErrors.js +25 -26
  85. package/esm/integrations/ignoreMpcrawlerErrors.js.map +1 -1
  86. package/esm/integrations/index.d.ts +4 -6
  87. package/esm/integrations/index.d.ts.map +1 -1
  88. package/esm/integrations/index.js +5 -6
  89. package/esm/integrations/index.js.map +1 -1
  90. package/esm/integrations/router.d.ts +6 -24
  91. package/esm/integrations/router.d.ts.map +1 -1
  92. package/esm/integrations/router.js +37 -41
  93. package/esm/integrations/router.js.map +1 -1
  94. package/esm/integrations/system.d.ts +5 -16
  95. package/esm/integrations/system.d.ts.map +1 -1
  96. package/esm/integrations/system.js +60 -59
  97. package/esm/integrations/system.js.map +1 -1
  98. package/esm/parsers.d.ts +2 -2
  99. package/esm/parsers.d.ts.map +1 -1
  100. package/esm/parsers.js +20 -19
  101. package/esm/parsers.js.map +1 -1
  102. package/esm/sdk.d.ts +9 -85
  103. package/esm/sdk.d.ts.map +1 -1
  104. package/esm/sdk.js +49 -122
  105. package/esm/sdk.js.map +1 -1
  106. package/esm/tracekit.js +33 -31
  107. package/esm/tracekit.js.map +1 -1
  108. package/esm/transport.d.ts +7 -0
  109. package/esm/transport.d.ts.map +1 -0
  110. package/esm/transport.js +41 -0
  111. package/esm/transport.js.map +1 -0
  112. package/esm/transports/index.d.ts +1 -2
  113. package/esm/transports/index.d.ts.map +1 -1
  114. package/esm/transports/index.js +1 -2
  115. package/esm/transports/index.js.map +1 -1
  116. package/esm/version.d.ts +1 -1
  117. package/esm/version.d.ts.map +1 -1
  118. package/esm/version.js +2 -2
  119. package/esm/version.js.map +1 -1
  120. package/package.json +24 -28
  121. package/dist/backend.d.ts +0 -41
  122. package/dist/backend.d.ts.map +0 -1
  123. package/dist/backend.js +0 -68
  124. package/dist/backend.js.map +0 -1
  125. package/dist/helpers.d.ts +0 -35
  126. package/dist/helpers.d.ts.map +0 -1
  127. package/dist/helpers.js +0 -236
  128. package/dist/helpers.js.map +0 -1
  129. package/dist/integrations/linkederrors.d.ts +0 -40
  130. package/dist/integrations/linkederrors.d.ts.map +0 -1
  131. package/dist/integrations/linkederrors.js +0 -65
  132. package/dist/integrations/linkederrors.js.map +0 -1
  133. package/dist/integrations/trycatch.d.ts +0 -26
  134. package/dist/integrations/trycatch.d.ts.map +0 -1
  135. package/dist/integrations/trycatch.js +0 -166
  136. package/dist/integrations/trycatch.js.map +0 -1
  137. package/dist/sentry-uniapp.min.js +0 -17
  138. package/dist/sentry-uniapp.min.js.map +0 -1
  139. package/dist/transports/base.d.ts +0 -22
  140. package/dist/transports/base.d.ts.map +0 -1
  141. package/dist/transports/base.js +0 -28
  142. package/dist/transports/base.js.map +0 -1
  143. package/dist/transports/xhr.d.ts +0 -10
  144. package/dist/transports/xhr.d.ts.map +0 -1
  145. package/dist/transports/xhr.js +0 -42
  146. package/dist/transports/xhr.js.map +0 -1
  147. package/esm/backend.d.ts +0 -41
  148. package/esm/backend.d.ts.map +0 -1
  149. package/esm/backend.js +0 -66
  150. package/esm/backend.js.map +0 -1
  151. package/esm/helpers.d.ts +0 -35
  152. package/esm/helpers.d.ts.map +0 -1
  153. package/esm/helpers.js +0 -229
  154. package/esm/helpers.js.map +0 -1
  155. package/esm/integrations/linkederrors.d.ts +0 -40
  156. package/esm/integrations/linkederrors.d.ts.map +0 -1
  157. package/esm/integrations/linkederrors.js +0 -63
  158. package/esm/integrations/linkederrors.js.map +0 -1
  159. package/esm/integrations/trycatch.d.ts +0 -26
  160. package/esm/integrations/trycatch.d.ts.map +0 -1
  161. package/esm/integrations/trycatch.js +0 -164
  162. package/esm/integrations/trycatch.js.map +0 -1
  163. package/esm/transports/base.d.ts +0 -22
  164. package/esm/transports/base.d.ts.map +0 -1
  165. package/esm/transports/base.js +0 -26
  166. package/esm/transports/base.js.map +0 -1
  167. package/esm/transports/xhr.d.ts +0 -10
  168. package/esm/transports/xhr.d.ts.map +0 -1
  169. package/esm/transports/xhr.js +0 -40
  170. package/esm/transports/xhr.js.map +0 -1
@@ -1,153 +1,120 @@
1
+ "use strict";
1
2
  Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.GlobalHandlers = void 0;
3
- var tslib_1 = require("tslib");
4
- var core_1 = require("@sentry/core");
5
- var utils_1 = require("@sentry/utils");
6
- var crossPlatform_1 = require("../crossPlatform");
7
- /** Global handlers */
8
- var GlobalHandlers = /** @class */ (function () {
9
- /** JSDoc */
10
- function GlobalHandlers(options) {
11
- /**
12
- * @inheritDoc
13
- */
14
- this.name = GlobalHandlers.id;
15
- /** JSDoc */
16
- this._onErrorHandlerInstalled = false;
17
- /** JSDoc */
18
- this._onUnhandledRejectionHandlerInstalled = false;
19
- /** JSDoc */
20
- this._onPageNotFoundHandlerInstalled = false;
21
- /** JSDoc */
22
- this._onMemoryWarningHandlerInstalled = false;
23
- this._options = tslib_1.__assign({ onerror: true, onunhandledrejection: true, onpagenotfound: true, onmemorywarning: true }, options);
24
- }
25
- /** JSDoc */
26
- GlobalHandlers.prototype.setExtraOptions = function (extraOptions) {
27
- if (extraOptions) {
28
- if (extraOptions.onerror !== undefined) {
29
- this._options.onerror = !!extraOptions.onerror;
3
+ exports.globalHandlersIntegration = void 0;
4
+ const core_1 = require("@sentry/core");
5
+ const core_2 = require("@sentry/core");
6
+ const crossPlatform_1 = require("../crossPlatform");
7
+ const INTEGRATION_NAME = 'GlobalHandlers';
8
+ const _globalHandlersIntegration = ((options = {}) => {
9
+ const _options = {
10
+ onerror: true,
11
+ onunhandledrejection: true,
12
+ onpagenotfound: true,
13
+ onmemorywarning: true,
14
+ ...options,
15
+ };
16
+ let _onErrorHandlerInstalled = false;
17
+ let _onUnhandledRejectionHandlerInstalled = false;
18
+ let _onPageNotFoundHandlerInstalled = false;
19
+ let _onMemoryWarningHandlerInstalled = false;
20
+ return {
21
+ name: INTEGRATION_NAME,
22
+ setup() {
23
+ if (_options.onerror) {
24
+ _installGlobalOnErrorHandler();
30
25
  }
31
- if (extraOptions.onunhandledrejection !== undefined) {
32
- this._options.onunhandledrejection = !!extraOptions.onunhandledrejection;
26
+ if (_options.onunhandledrejection) {
27
+ _installGlobalOnUnhandledRejectionHandler();
33
28
  }
34
- if (extraOptions.onpagenotfound !== undefined) {
35
- this._options.onpagenotfound = !!extraOptions.onpagenotfound;
29
+ if (_options.onpagenotfound) {
30
+ _installGlobalOnPageNotFoundHandler();
36
31
  }
37
- if (extraOptions.onmemorywarning !== undefined) {
38
- this._options.onmemorywarning = !!extraOptions.onmemorywarning;
32
+ if (_options.onmemorywarning) {
33
+ _installGlobalOnMemoryWarningHandler();
39
34
  }
40
- }
35
+ },
41
36
  };
42
- /**
43
- * @inheritDoc
44
- */
45
- GlobalHandlers.prototype.setupOnce = function () {
46
- Error.stackTraceLimit = 50;
47
- if (this._options.onerror) {
48
- utils_1.logger.log("Global Handler attached: onError");
49
- this._installGlobalOnErrorHandler();
50
- }
51
- if (this._options.onunhandledrejection) {
52
- utils_1.logger.log("Global Handler attached: onunhandledrejection");
53
- this._installGlobalOnUnhandledRejectionHandler();
54
- }
55
- if (this._options.onpagenotfound) {
56
- utils_1.logger.log("Global Handler attached: onPageNotFound");
57
- this._installGlobalOnPageNotFoundHandler();
58
- }
59
- if (this._options.onmemorywarning) {
60
- utils_1.logger.log("Global Handler attached: onMemoryWarning");
61
- this._installGlobalOnMemoryWarningHandler();
62
- }
63
- };
64
- /** JSDoc */
65
- GlobalHandlers.prototype._installGlobalOnErrorHandler = function () {
66
- if (this._onErrorHandlerInstalled) {
37
+ function _installGlobalOnErrorHandler() {
38
+ if (_onErrorHandlerInstalled || !crossPlatform_1.sdk.onError) {
67
39
  return;
68
40
  }
69
- if (!!crossPlatform_1.sdk.onError) {
70
- var currentHub_1 = core_1.getCurrentHub();
71
- // https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html
72
- crossPlatform_1.sdk.onError(function (err) {
73
- // console.info("sentry-uniapp", err);
74
- var error = typeof err === 'string' ? new Error(err) : err;
75
- currentHub_1.captureException(error);
41
+ crossPlatform_1.sdk.onError((err) => {
42
+ const error = typeof err === 'string' ? new Error(err) : err;
43
+ (0, core_1.captureException)(error, {
44
+ mechanism: {
45
+ type: 'onerror',
46
+ handled: false,
47
+ },
76
48
  });
77
- }
78
- this._onErrorHandlerInstalled = true;
79
- };
80
- /** JSDoc */
81
- GlobalHandlers.prototype._installGlobalOnUnhandledRejectionHandler = function () {
82
- if (this._onUnhandledRejectionHandlerInstalled) {
49
+ });
50
+ _onErrorHandlerInstalled = true;
51
+ core_2.logger.log('Global Handler attached: onError');
52
+ }
53
+ function _installGlobalOnUnhandledRejectionHandler() {
54
+ if (_onUnhandledRejectionHandlerInstalled || !crossPlatform_1.sdk.onUnhandledRejection) {
83
55
  return;
84
56
  }
85
- if (!!crossPlatform_1.sdk.onUnhandledRejection) {
86
- var currentHub_2 = core_1.getCurrentHub();
87
- // https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html
88
- crossPlatform_1.sdk.onUnhandledRejection(function (_a) {
89
- var reason = _a.reason, promise = _a.promise;
90
- // console.log(reason, typeof reason, promise)
91
- // 为什么官方文档上说 reason 是 string 类型,但是实际返回的确实 object 类型
92
- var error = typeof reason === 'string' ? new Error(reason) : reason;
93
- currentHub_2.captureException(error, {
94
- data: promise,
95
- });
57
+ crossPlatform_1.sdk.onUnhandledRejection((res) => {
58
+ const error = typeof res.reason === 'string' ? new Error(res.reason) : res.reason;
59
+ (0, core_1.captureException)(error, {
60
+ mechanism: {
61
+ type: 'onunhandledrejection',
62
+ handled: false,
63
+ },
64
+ data: { promise: res.promise },
96
65
  });
97
- }
98
- this._onUnhandledRejectionHandlerInstalled = true;
99
- };
100
- /** JSDoc */
101
- GlobalHandlers.prototype._installGlobalOnPageNotFoundHandler = function () {
102
- if (this._onPageNotFoundHandlerInstalled) {
66
+ });
67
+ _onUnhandledRejectionHandlerInstalled = true;
68
+ core_2.logger.log('Global Handler attached: onUnhandledRejection');
69
+ }
70
+ function _installGlobalOnPageNotFoundHandler() {
71
+ if (_onPageNotFoundHandlerInstalled || !crossPlatform_1.sdk.onPageNotFound) {
103
72
  return;
104
73
  }
105
- if (!!crossPlatform_1.sdk.onPageNotFound) {
106
- var currentHub_3 = core_1.getCurrentHub();
107
- crossPlatform_1.sdk.onPageNotFound(function (res) {
108
- var url = res.path.split("?")[0];
109
- currentHub_3.setTag("pagenotfound", url);
110
- currentHub_3.setExtra("message", JSON.stringify(res));
111
- currentHub_3.captureMessage("\u9875\u9762\u65E0\u6CD5\u627E\u5230: " + url);
74
+ crossPlatform_1.sdk.onPageNotFound((res) => {
75
+ const scope = (0, core_1.getCurrentScope)();
76
+ const url = res.path.split('?')[0];
77
+ scope.setTag('pagenotfound', url);
78
+ scope.setContext('pagenotfound', res);
79
+ (0, core_1.captureMessage)(`Page not found: ${url}`, {
80
+ level: 'warning',
112
81
  });
113
- }
114
- this._onPageNotFoundHandlerInstalled = true;
115
- };
116
- /** JSDoc */
117
- GlobalHandlers.prototype._installGlobalOnMemoryWarningHandler = function () {
118
- if (this._onMemoryWarningHandlerInstalled) {
82
+ });
83
+ _onPageNotFoundHandlerInstalled = true;
84
+ core_2.logger.log('Global Handler attached: onPageNotFound');
85
+ }
86
+ function _installGlobalOnMemoryWarningHandler() {
87
+ if (_onMemoryWarningHandlerInstalled || !crossPlatform_1.sdk.onMemoryWarning) {
119
88
  return;
120
89
  }
121
- if (!!crossPlatform_1.sdk.onMemoryWarning) {
122
- var currentHub_4 = core_1.getCurrentHub();
123
- crossPlatform_1.sdk.onMemoryWarning(function (_a) {
124
- var _b = _a.level, level = _b === void 0 ? -1 : _b;
125
- var levelMessage = "没有获取到告警级别信息";
126
- switch (level) {
127
- case 5:
128
- levelMessage = "TRIM_MEMORY_RUNNING_MODERATE";
129
- break;
130
- case 10:
131
- levelMessage = "TRIM_MEMORY_RUNNING_LOW";
132
- break;
133
- case 15:
134
- levelMessage = "TRIM_MEMORY_RUNNING_CRITICAL";
135
- break;
136
- default:
137
- return;
138
- }
139
- currentHub_4.setTag("memory-warning", String(level));
140
- currentHub_4.setExtra("message", levelMessage);
141
- currentHub_4.captureMessage("\u5185\u5B58\u4E0D\u8DB3\u544A\u8B66");
90
+ crossPlatform_1.sdk.onMemoryWarning(({ level = -1 }) => {
91
+ let levelMessage = 'Unknown memory warning level';
92
+ switch (level) {
93
+ case 5:
94
+ levelMessage = 'TRIM_MEMORY_RUNNING_MODERATE';
95
+ break;
96
+ case 10:
97
+ levelMessage = 'TRIM_MEMORY_RUNNING_LOW';
98
+ break;
99
+ case 15:
100
+ levelMessage = 'TRIM_MEMORY_RUNNING_CRITICAL';
101
+ break;
102
+ default:
103
+ return;
104
+ }
105
+ const scope = (0, core_1.getCurrentScope)();
106
+ scope.setTag('memory-warning', String(level));
107
+ scope.setContext('memory-warning', { level, levelMessage });
108
+ (0, core_1.captureMessage)('Memory warning', {
109
+ level: 'warning',
142
110
  });
143
- }
144
- this._onMemoryWarningHandlerInstalled = true;
145
- };
146
- /**
147
- * @inheritDoc
148
- */
149
- GlobalHandlers.id = "GlobalHandlers";
150
- return GlobalHandlers;
151
- }());
152
- exports.GlobalHandlers = GlobalHandlers;
111
+ });
112
+ _onMemoryWarningHandlerInstalled = true;
113
+ core_2.logger.log('Global Handler attached: onMemoryWarning');
114
+ }
115
+ });
116
+ /**
117
+ * Global handlers integration - captures unhandled errors and rejections
118
+ */
119
+ exports.globalHandlersIntegration = (0, core_1.defineIntegration)(_globalHandlersIntegration);
153
120
  //# sourceMappingURL=globalhandlers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"globalhandlers.js","sourceRoot":"","sources":["../../src/integrations/globalhandlers.ts"],"names":[],"mappings":";;;AAAA,qCAA6C;AAE7C,uCAAuC;AAEvC,kDAAuC;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,KA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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;IAvLD;;OAEG;IACW,iBAAE,GAAW,gBAAgB,CAAC;IAqL9C,qBAAC;CAAA,AA9LD,IA8LC;AA9LY,wCAAc","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 /** JSDoc */\n public setExtraOptions(extraOptions?: any): void {\n if (extraOptions) {\n if (extraOptions.onerror !== undefined) {\n this._options.onerror = !!extraOptions.onerror;\n }\n\n if (extraOptions.onunhandledrejection !== undefined) {\n this._options.onunhandledrejection = !!extraOptions.onunhandledrejection;\n }\n\n if (extraOptions.onpagenotfound !== undefined) {\n this._options.onpagenotfound = !!extraOptions.onpagenotfound;\n }\n\n if (extraOptions.onmemorywarning !== undefined) {\n this._options.onmemorywarning = !!extraOptions.onmemorywarning;\n }\n }\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\", err);\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,uCAAoG;AAEpG,uCAAs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,6 @@
1
- import { Integration } from "@sentry/types";
1
+ import type { Integration } from "@sentry/core";
2
2
  /**
3
- * IgnoreMpcrawlerErrors
4
- *
5
- * https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/sitemap.html
3
+ * IgnoreMpcrawlerErrors integration - filters out WeChat miniprogram crawler errors
6
4
  */
7
- export declare class IgnoreMpcrawlerErrors implements Integration {
8
- /**
9
- * @inheritDoc
10
- */
11
- name: string;
12
- /**
13
- * @inheritDoc
14
- */
15
- static id: string;
16
- /**
17
- * @inheritDoc
18
- */
19
- setupOnce(): void;
20
- }
5
+ export declare const ignoreMpcrawlerErrorsIntegration: () => Integration;
21
6
  //# sourceMappingURL=ignoreMpcrawlerErrors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ignoreMpcrawlerErrors.d.ts","sourceRoot":"","sources":["../../src/integrations/ignoreMpcrawlerErrors.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,WAAW,EAAE,MAAM,eAAe,CAAC;AAInD;;;;GAIG;AACH,qBAAa,qBAAsB,YAAW,WAAW;IACvD;;OAEG;IACI,IAAI,EAAE,MAAM,CAA4B;IAE/C;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAA2B;IAEnD;;OAEG;IACI,SAAS,IAAI,IAAI;CAiBzB"}
1
+ {"version":3,"file":"ignoreMpcrawlerErrors.d.ts","sourceRoot":"","sources":["../../src/integrations/ignoreMpcrawlerErrors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,WAAW,EAAiB,MAAM,cAAc,CAAC;AAuC9E;;GAEG;AACH,eAAO,MAAM,gCAAgC,mBAAuD,CAAC"}
@@ -1,40 +1,40 @@
1
+ "use strict";
1
2
  Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.IgnoreMpcrawlerErrors = void 0;
3
- var core_1 = require("@sentry/core");
4
- var crossPlatform_1 = require("../crossPlatform");
3
+ exports.ignoreMpcrawlerErrorsIntegration = void 0;
4
+ const core_1 = require("@sentry/core");
5
+ const crossPlatform_1 = require("../crossPlatform");
6
+ const INTEGRATION_NAME = 'IgnoreMpcrawlerErrors';
5
7
  /**
6
8
  * IgnoreMpcrawlerErrors
7
9
  *
8
10
  * https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/sitemap.html
9
11
  */
10
- var IgnoreMpcrawlerErrors = /** @class */ (function () {
11
- function IgnoreMpcrawlerErrors() {
12
- /**
13
- * @inheritDoc
14
- */
15
- this.name = IgnoreMpcrawlerErrors.id;
16
- }
17
- /**
18
- * @inheritDoc
19
- */
20
- IgnoreMpcrawlerErrors.prototype.setupOnce = function () {
21
- core_1.addGlobalEventProcessor(function (event) {
22
- if (core_1.getCurrentHub().getIntegration(IgnoreMpcrawlerErrors) &&
23
- crossPlatform_1.appName === "wechat" &&
12
+ const _ignoreMpcrawlerErrorsIntegration = (() => {
13
+ return {
14
+ name: INTEGRATION_NAME,
15
+ setupOnce() {
16
+ // Setup is now handled via processEvent
17
+ },
18
+ processEvent(event, _hint, _client) {
19
+ if (crossPlatform_1.appName === "wechat" &&
24
20
  crossPlatform_1.sdk.getLaunchOptionsSync) {
25
- var options = crossPlatform_1.sdk.getLaunchOptionsSync();
26
- if (options.scene === 1129) {
27
- return null;
21
+ try {
22
+ const options = crossPlatform_1.sdk.getLaunchOptionsSync();
23
+ if (options.scene === 1129) {
24
+ // Ignore miniprogram crawler errors
25
+ return null;
26
+ }
27
+ }
28
+ catch (e) {
29
+ // If we can't get launch options, just continue
28
30
  }
29
31
  }
30
32
  return event;
31
- });
33
+ },
32
34
  };
33
- /**
34
- * @inheritDoc
35
- */
36
- IgnoreMpcrawlerErrors.id = "IgnoreMpcrawlerErrors";
37
- return IgnoreMpcrawlerErrors;
38
- }());
39
- exports.IgnoreMpcrawlerErrors = IgnoreMpcrawlerErrors;
35
+ });
36
+ /**
37
+ * IgnoreMpcrawlerErrors integration - filters out WeChat miniprogram crawler errors
38
+ */
39
+ exports.ignoreMpcrawlerErrorsIntegration = (0, core_1.defineIntegration)(_ignoreMpcrawlerErrorsIntegration);
40
40
  //# sourceMappingURL=ignoreMpcrawlerErrors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ignoreMpcrawlerErrors.js","sourceRoot":"","sources":["../../src/integrations/ignoreMpcrawlerErrors.ts"],"names":[],"mappings":";;AAAA,qCAAsE;AAGtE,kDAAgD;AAEhD;;;;GAIG;AACH;IAAA;QACE;;WAEG;QACI,SAAI,GAAW,qBAAqB,CAAC,EAAE,CAAC;IA2BjD,CAAC;IApBC;;OAEG;IACI,yCAAS,GAAhB;QACE,8BAAuB,CAAC,UAAC,KAAY;YACnC,IACE,oBAAa,EAAE,CAAC,cAAc,CAAC,qBAAqB,CAAC;gBACrD,uBAAO,KAAK,QAAQ;gBACpB,mBAAG,CAAC,oBAAoB,EACxB;gBACA,IAAM,OAAO,GAAG,mBAAG,CAAC,oBAAoB,EAAE,CAAC;gBAE3C,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI,EAAE;oBAC1B,OAAO,IAAI,CAAC;iBACb;aACF;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;IAxBD;;OAEG;IACW,wBAAE,GAAW,uBAAuB,CAAC;IAsBrD,4BAAC;CAAA,AA/BD,IA+BC;AA/BY,sDAAqB","sourcesContent":["import { addGlobalEventProcessor, getCurrentHub } from \"@sentry/core\";\nimport { Event, Integration } from \"@sentry/types\";\n\nimport { appName, sdk } from \"../crossPlatform\";\n\n/**\n * IgnoreMpcrawlerErrors\n *\n * https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/sitemap.html\n */\nexport class IgnoreMpcrawlerErrors implements Integration {\n /**\n * @inheritDoc\n */\n public name: string = IgnoreMpcrawlerErrors.id;\n\n /**\n * @inheritDoc\n */\n public static id: string = \"IgnoreMpcrawlerErrors\";\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor((event: Event) => {\n if (\n getCurrentHub().getIntegration(IgnoreMpcrawlerErrors) &&\n appName === \"wechat\" &&\n sdk.getLaunchOptionsSync\n ) {\n const options = sdk.getLaunchOptionsSync();\n\n if (options.scene === 1129) {\n return null;\n }\n }\n\n return event;\n });\n }\n}\n"]}
1
+ {"version":3,"file":"ignoreMpcrawlerErrors.js","sourceRoot":"","sources":["../../src/integrations/ignoreMpcrawlerErrors.ts"],"names":[],"mappings":";;;AAAA,uCAAiD;AAGjD,oDAAgD;AAEhD,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,iCAAiC,GAAG,CAAC,GAAG,EAAE;IAC5C,OAAO;QACH,IAAI,EAAE,gBAAgB;QACtB,SAAS;YACL,wCAAwC;QAC5C,CAAC;QACD,YAAY,CAAC,KAAY,EAAE,KAAc,EAAE,OAAe;YACtD,IACI,uBAAO,KAAK,QAAQ;gBACpB,mBAAG,CAAC,oBAAoB,EAC1B,CAAC;gBACC,IAAI,CAAC;oBACD,MAAM,OAAO,GAAG,mBAAG,CAAC,oBAAoB,EAAE,CAAC;oBAE3C,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;wBACzB,oCAAoC;wBACpC,OAAO,IAAI,CAAC;oBAChB,CAAC;gBACL,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACT,gDAAgD;gBACpD,CAAC;YACL,CAAC;YAED,OAAO,KAAK,CAAC;QACjB,CAAC;KACkB,CAAC;AAC5B,CAAC,CAAyB,CAAC;AAE3B;;GAEG;AACU,QAAA,gCAAgC,GAAG,IAAA,wBAAiB,EAAC,iCAAiC,CAAC,CAAC"}
@@ -1,7 +1,5 @@
1
- export { GlobalHandlers } from "./globalhandlers";
2
- export { TryCatch } from "./trycatch";
3
- export { LinkedErrors } from "./linkederrors";
4
- export { System } from "./system";
5
- export { Router } from "./router";
6
- export { IgnoreMpcrawlerErrors } from "./ignoreMpcrawlerErrors";
1
+ export { globalHandlersIntegration } from './globalhandlers';
2
+ export { routerIntegration } from './router';
3
+ export { systemIntegration } from './system';
4
+ export { inboundFiltersIntegration, functionToStringIntegration, linkedErrorsIntegration, dedupeIntegration, } from '@sentry/core';
7
5
  //# 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;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAG7C,OAAO,EACH,yBAAyB,EACzB,2BAA2B,EAC3B,uBAAuB,EACvB,iBAAiB,GACpB,MAAM,cAAc,CAAC"}
@@ -1,14 +1,16 @@
1
+ "use strict";
1
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dedupeIntegration = exports.linkedErrorsIntegration = exports.functionToStringIntegration = exports.inboundFiltersIntegration = exports.systemIntegration = exports.routerIntegration = exports.globalHandlersIntegration = void 0;
2
4
  var globalhandlers_1 = require("./globalhandlers");
3
- Object.defineProperty(exports, "GlobalHandlers", { enumerable: true, get: function () { return globalhandlers_1.GlobalHandlers; } });
4
- var trycatch_1 = require("./trycatch");
5
- Object.defineProperty(exports, "TryCatch", { enumerable: true, get: function () { return trycatch_1.TryCatch; } });
6
- var linkederrors_1 = require("./linkederrors");
7
- Object.defineProperty(exports, "LinkedErrors", { enumerable: true, get: function () { return linkederrors_1.LinkedErrors; } });
8
- var system_1 = require("./system");
9
- Object.defineProperty(exports, "System", { enumerable: true, get: function () { return system_1.System; } });
5
+ Object.defineProperty(exports, "globalHandlersIntegration", { enumerable: true, get: function () { return globalhandlers_1.globalHandlersIntegration; } });
10
6
  var router_1 = require("./router");
11
- Object.defineProperty(exports, "Router", { enumerable: true, get: function () { return router_1.Router; } });
12
- var ignoreMpcrawlerErrors_1 = require("./ignoreMpcrawlerErrors");
13
- Object.defineProperty(exports, "IgnoreMpcrawlerErrors", { enumerable: true, get: function () { return ignoreMpcrawlerErrors_1.IgnoreMpcrawlerErrors; } });
7
+ Object.defineProperty(exports, "routerIntegration", { enumerable: true, get: function () { return router_1.routerIntegration; } });
8
+ var system_1 = require("./system");
9
+ Object.defineProperty(exports, "systemIntegration", { enumerable: true, get: function () { return system_1.systemIntegration; } });
10
+ // Re-export integrations from @sentry/core for convenience
11
+ var core_1 = require("@sentry/core");
12
+ Object.defineProperty(exports, "inboundFiltersIntegration", { enumerable: true, get: function () { return core_1.inboundFiltersIntegration; } });
13
+ Object.defineProperty(exports, "functionToStringIntegration", { enumerable: true, get: function () { return core_1.functionToStringIntegration; } });
14
+ Object.defineProperty(exports, "linkedErrorsIntegration", { enumerable: true, get: function () { return core_1.linkedErrorsIntegration; } });
15
+ Object.defineProperty(exports, "dedupeIntegration", { enumerable: true, get: function () { return core_1.dedupeIntegration; } });
14
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":";AAAA,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAErB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA","sourcesContent":["export { GlobalHandlers } from \"./globalhandlers\";\nexport { TryCatch } from \"./trycatch\";\nexport { LinkedErrors } from \"./linkederrors\";\n\nexport { System } from \"./system\";\nexport { Router } from \"./router\";\nexport { IgnoreMpcrawlerErrors } from \"./ignoreMpcrawlerErrors\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":";;;AAAA,mDAA6D;AAApD,2HAAA,yBAAyB,OAAA;AAClC,mCAA6C;AAApC,2GAAA,iBAAiB,OAAA;AAC1B,mCAA6C;AAApC,2GAAA,iBAAiB,OAAA;AAE1B,2DAA2D;AAC3D,qCAKsB;AAJlB,iHAAA,yBAAyB,OAAA;AACzB,mHAAA,2BAA2B,OAAA;AAC3B,+GAAA,uBAAuB,OAAA;AACvB,yGAAA,iBAAiB,OAAA"}
@@ -1,28 +1,10 @@
1
- import { Integration } from "@sentry/types";
2
- /** JSDoc */
3
- interface RouterIntegrations {
1
+ import type { Integration } from '@sentry/core';
2
+ interface RouterOptions {
4
3
  enable?: boolean;
5
4
  }
6
- /** UserAgent */
7
- export declare class Router implements Integration {
8
- /**
9
- * @inheritDoc
10
- */
11
- name: string;
12
- /**
13
- * @inheritDoc
14
- */
15
- static id: string;
16
- /** JSDoc */
17
- private readonly _options;
18
- /**
19
- * @inheritDoc
20
- */
21
- constructor(options?: RouterIntegrations);
22
- /**
23
- * @inheritDoc
24
- */
25
- setupOnce(): void;
26
- }
5
+ /**
6
+ * Router integration - captures route information from the miniapp
7
+ */
8
+ export declare const routerIntegration: (options?: RouterOptions) => Integration;
27
9
  export {};
28
10
  //# sourceMappingURL=router.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/integrations/router.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,WAAW,EAAE,MAAM,eAAe,CAAC;AAInD,YAAY;AACZ,UAAU,kBAAkB;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,gBAAgB;AAChB,qBAAa,MAAO,YAAW,WAAW;IACxC;;OAEG;IACI,IAAI,EAAE,MAAM,CAAa;IAEhC;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAY;IAEpC,YAAY;IACZ,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAE9C;;OAEG;gBACgB,OAAO,CAAC,EAAE,kBAAkB;IAO/C;;OAEG;IACI,SAAS,IAAI,IAAI;CA4BzB"}
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/integrations/router.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,WAAW,EAAiB,MAAM,cAAc,CAAC;AAM9E,UAAU,aAAa;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAwCD;;GAEG;AACH,eAAO,MAAM,iBAAiB,0CAAwC,CAAC"}
@@ -1,47 +1,44 @@
1
+ "use strict";
1
2
  Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.Router = void 0;
3
- var tslib_1 = require("tslib");
4
- var core_1 = require("@sentry/core");
5
- /** UserAgent */
6
- var Router = /** @class */ (function () {
7
- /**
8
- * @inheritDoc
9
- */
10
- function Router(options) {
11
- /**
12
- * @inheritDoc
13
- */
14
- this.name = Router.id;
15
- this._options = tslib_1.__assign({ enable: true }, options);
16
- }
17
- /**
18
- * @inheritDoc
19
- */
20
- Router.prototype.setupOnce = function () {
21
- var _this = this;
22
- core_1.addGlobalEventProcessor(function (event) {
23
- if (core_1.getCurrentHub().getIntegration(Router)) {
24
- if (_this._options.enable) {
25
- try {
26
- var routers = getCurrentPages().map(function (route) { return ({
27
- route: route.route,
28
- options: route.options,
29
- }); });
30
- return tslib_1.__assign(tslib_1.__assign({}, event), { extra: tslib_1.__assign(tslib_1.__assign({}, event.extra), { routers: routers }) });
31
- }
32
- catch (e) {
33
- console.warn("sentry-uniapp get router info fail: " + e);
34
- }
35
- }
3
+ exports.routerIntegration = void 0;
4
+ const core_1 = require("@sentry/core");
5
+ const INTEGRATION_NAME = 'Router';
6
+ const _routerIntegration = ((options = {}) => {
7
+ const enable = options.enable !== false;
8
+ return {
9
+ name: INTEGRATION_NAME,
10
+ setupOnce() {
11
+ // No setup needed
12
+ },
13
+ processEvent(event, _hint, _client) {
14
+ if (!enable) {
15
+ return event;
16
+ }
17
+ try {
18
+ const routers = getCurrentPages().map((route) => ({
19
+ route: route.route,
20
+ options: route.options,
21
+ }));
22
+ return {
23
+ ...event,
24
+ contexts: {
25
+ ...event.contexts,
26
+ router: {
27
+ routes: routers,
28
+ current: routers[routers.length - 1],
29
+ },
30
+ },
31
+ };
32
+ }
33
+ catch (e) {
34
+ // Silently fail if getCurrentPages is not available
36
35
  }
37
36
  return event;
38
- });
37
+ },
39
38
  };
40
- /**
41
- * @inheritDoc
42
- */
43
- Router.id = "Router";
44
- return Router;
45
- }());
46
- exports.Router = Router;
39
+ });
40
+ /**
41
+ * Router integration - captures route information from the miniapp
42
+ */
43
+ exports.routerIntegration = (0, core_1.defineIntegration)(_routerIntegration);
47
44
  //# sourceMappingURL=router.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/integrations/router.ts"],"names":[],"mappings":";;;AAAA,qCAAsE;AAUtE,gBAAgB;AAChB;IAcE;;OAEG;IACH,gBAAmB,OAA4B;QAhB/C;;WAEG;QACI,SAAI,GAAW,MAAM,CAAC,EAAE,CAAC;QAc9B,IAAI,CAAC,QAAQ,sBACX,MAAM,EAAE,IAAI,IACT,OAAO,CACX,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,0BAAS,GAAhB;QAAA,iBA2BC;QA1BC,8BAAuB,CAAC,UAAC,KAAY;YACnC,IAAI,oBAAa,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,6CACK,KAAK,KACR,KAAK,wCACA,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;AAvDY,wBAAM","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,uCAAiD;AAKjD,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAMlC,MAAM,kBAAkB,GAAG,CAAC,CAAC,UAAyB,EAAE,EAAE,EAAE;IAC1D,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,KAAK,KAAK,CAAC;IAExC,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,SAAS;YACP,kBAAkB;QACpB,CAAC;QACD,YAAY,CAAC,KAAY,EAAE,KAAc,EAAE,OAAe;YACxD,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,KAAK,CAAC;YACf,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC,GAAG,CAAC,CAAC,KAAyC,EAAE,EAAE,CAAC,CAAC;oBACpF,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,OAAO,EAAE,KAAK,CAAC,OAAO;iBACvB,CAAC,CAAC,CAAC;gBAEJ,OAAO;oBACL,GAAG,KAAK;oBACR,QAAQ,EAAE;wBACR,GAAG,KAAK,CAAC,QAAQ;wBACjB,MAAM,EAAE;4BACN,MAAM,EAAE,OAAO;4BACf,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;yBACrC;qBACF;iBACF,CAAC;YACJ,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,oDAAoD;YACtD,CAAC;YAED,OAAO,KAAK,CAAC;QACf,CAAC;KACoB,CAAC;AAC1B,CAAC,CAAyB,CAAC;AAE3B;;GAEG;AACU,QAAA,iBAAiB,GAAG,IAAA,wBAAiB,EAAC,kBAAkB,CAAC,CAAC"}