sentry-uniapp 1.0.12 → 2.8.1
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 +11 -9
- package/dist/client.d.ts +42 -40
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +62 -41
- package/dist/client.js.map +1 -1
- package/dist/crossPlatform.d.ts +1 -1
- package/dist/crossPlatform.d.ts.map +1 -1
- package/dist/crossPlatform.js +26 -10
- package/dist/crossPlatform.js.map +1 -1
- package/dist/debug.d.ts +4 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +23 -0
- package/dist/debug.js.map +1 -0
- package/dist/eventbuilder.d.ts +9 -10
- package/dist/eventbuilder.d.ts.map +1 -1
- package/dist/eventbuilder.js +131 -58
- package/dist/eventbuilder.js.map +1 -1
- package/dist/flags.js +1 -0
- package/dist/flags.js.map +1 -1
- package/dist/index.d.ts +10 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +84 -21
- package/dist/index.js.map +1 -1
- package/dist/integrations/globalhandlers.d.ts +10 -44
- package/dist/integrations/globalhandlers.d.ts.map +1 -1
- package/dist/integrations/globalhandlers.js +101 -134
- package/dist/integrations/globalhandlers.js.map +1 -1
- package/dist/integrations/ignoreMpcrawlerErrors.d.ts +3 -18
- package/dist/integrations/ignoreMpcrawlerErrors.d.ts.map +1 -1
- package/dist/integrations/ignoreMpcrawlerErrors.js +28 -28
- package/dist/integrations/ignoreMpcrawlerErrors.js.map +1 -1
- package/dist/integrations/index.d.ts +4 -6
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +12 -10
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/router.d.ts +6 -24
- package/dist/integrations/router.d.ts.map +1 -1
- package/dist/integrations/router.js +39 -42
- package/dist/integrations/router.js.map +1 -1
- package/dist/integrations/system.d.ts +5 -16
- package/dist/integrations/system.d.ts.map +1 -1
- package/dist/integrations/system.js +62 -60
- package/dist/integrations/system.js.map +1 -1
- package/dist/parsers.d.ts +2 -2
- package/dist/parsers.d.ts.map +1 -1
- package/dist/parsers.js +27 -26
- package/dist/parsers.js.map +1 -1
- package/dist/polyfills.d.ts +5 -0
- package/dist/polyfills.d.ts.map +1 -0
- package/dist/polyfills.js +100 -0
- package/dist/polyfills.js.map +1 -0
- package/dist/sdk.d.ts +10 -85
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +69 -127
- package/dist/sdk.js.map +1 -1
- package/dist/tracekit.js +35 -33
- package/dist/tracekit.js.map +1 -1
- package/dist/transport.d.ts +7 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +75 -0
- package/dist/transport.js.map +1 -0
- package/dist/transports/index.d.ts +1 -2
- package/dist/transports/index.d.ts.map +1 -1
- package/dist/transports/index.js +4 -4
- package/dist/transports/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +2 -2
- package/dist/version.js.map +1 -1
- package/esm/client.d.ts +42 -40
- package/esm/client.d.ts.map +1 -1
- package/esm/client.js +59 -40
- package/esm/client.js.map +1 -1
- package/esm/crossPlatform.d.ts +1 -1
- package/esm/crossPlatform.d.ts.map +1 -1
- package/esm/crossPlatform.js +25 -10
- package/esm/crossPlatform.js.map +1 -1
- package/esm/debug.d.ts +4 -0
- package/esm/debug.d.ts.map +1 -0
- package/esm/debug.js +18 -0
- package/esm/debug.js.map +1 -0
- package/esm/eventbuilder.d.ts +9 -10
- package/esm/eventbuilder.d.ts.map +1 -1
- package/esm/eventbuilder.js +125 -52
- package/esm/eventbuilder.js.map +1 -1
- package/esm/flags.js +1 -1
- package/esm/flags.js.map +1 -1
- package/esm/index.d.ts +10 -9
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +13 -8
- package/esm/index.js.map +1 -1
- package/esm/integrations/globalhandlers.d.ts +10 -44
- package/esm/integrations/globalhandlers.d.ts.map +1 -1
- package/esm/integrations/globalhandlers.js +99 -133
- package/esm/integrations/globalhandlers.js.map +1 -1
- package/esm/integrations/ignoreMpcrawlerErrors.d.ts +3 -18
- package/esm/integrations/ignoreMpcrawlerErrors.d.ts.map +1 -1
- package/esm/integrations/ignoreMpcrawlerErrors.js +25 -26
- package/esm/integrations/ignoreMpcrawlerErrors.js.map +1 -1
- package/esm/integrations/index.d.ts +4 -6
- package/esm/integrations/index.d.ts.map +1 -1
- package/esm/integrations/index.js +5 -6
- package/esm/integrations/index.js.map +1 -1
- package/esm/integrations/router.d.ts +6 -24
- package/esm/integrations/router.d.ts.map +1 -1
- package/esm/integrations/router.js +37 -41
- package/esm/integrations/router.js.map +1 -1
- package/esm/integrations/system.d.ts +5 -16
- package/esm/integrations/system.d.ts.map +1 -1
- package/esm/integrations/system.js +60 -59
- package/esm/integrations/system.js.map +1 -1
- package/esm/parsers.d.ts +2 -2
- package/esm/parsers.d.ts.map +1 -1
- package/esm/parsers.js +20 -19
- package/esm/parsers.js.map +1 -1
- package/esm/polyfills.d.ts +5 -0
- package/esm/polyfills.d.ts.map +1 -0
- package/esm/polyfills.js +100 -0
- package/esm/polyfills.js.map +1 -0
- package/esm/sdk.d.ts +10 -85
- package/esm/sdk.d.ts.map +1 -1
- package/esm/sdk.js +63 -120
- package/esm/sdk.js.map +1 -1
- package/esm/tracekit.js +33 -31
- package/esm/tracekit.js.map +1 -1
- package/esm/transport.d.ts +7 -0
- package/esm/transport.d.ts.map +1 -0
- package/esm/transport.js +71 -0
- package/esm/transport.js.map +1 -0
- package/esm/transports/index.d.ts +1 -2
- package/esm/transports/index.d.ts.map +1 -1
- package/esm/transports/index.js +1 -2
- package/esm/transports/index.js.map +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.d.ts.map +1 -1
- package/esm/version.js +2 -3
- package/esm/version.js.map +1 -1
- package/package.json +23 -27
- package/dist/backend.d.ts +0 -41
- package/dist/backend.d.ts.map +0 -1
- package/dist/backend.js +0 -68
- package/dist/backend.js.map +0 -1
- package/dist/helpers.d.ts +0 -35
- package/dist/helpers.d.ts.map +0 -1
- package/dist/helpers.js +0 -236
- package/dist/helpers.js.map +0 -1
- package/dist/integrations/linkederrors.d.ts +0 -40
- package/dist/integrations/linkederrors.d.ts.map +0 -1
- package/dist/integrations/linkederrors.js +0 -65
- package/dist/integrations/linkederrors.js.map +0 -1
- package/dist/integrations/trycatch.d.ts +0 -26
- package/dist/integrations/trycatch.d.ts.map +0 -1
- package/dist/integrations/trycatch.js +0 -166
- package/dist/integrations/trycatch.js.map +0 -1
- package/dist/package.json +0 -52
- package/dist/sentry-uniapp.min.js +0 -3
- package/dist/sentry-uniapp.min.js.LICENSE.txt +0 -14
- package/dist/sentry-uniapp.min.js.map +0 -1
- package/dist/src/backend.d.ts +0 -41
- package/dist/src/backend.d.ts.map +0 -1
- package/dist/src/backend.js +0 -68
- package/dist/src/backend.js.map +0 -1
- package/dist/src/client.d.ts +0 -55
- package/dist/src/client.d.ts.map +0 -1
- package/dist/src/client.js +0 -51
- package/dist/src/client.js.map +0 -1
- package/dist/src/crossPlatform.d.ts +0 -18
- package/dist/src/crossPlatform.d.ts.map +0 -1
- package/dist/src/crossPlatform.js +0 -80
- package/dist/src/crossPlatform.js.map +0 -1
- package/dist/src/eventbuilder.d.ts +0 -11
- package/dist/src/eventbuilder.d.ts.map +0 -1
- package/dist/src/eventbuilder.js +0 -79
- package/dist/src/eventbuilder.js.map +0 -1
- package/dist/src/flags.d.ts +0 -3
- package/dist/src/flags.d.ts.map +0 -1
- package/dist/src/flags.js +0 -18
- package/dist/src/flags.js.map +0 -1
- package/dist/src/helpers.d.ts +0 -35
- package/dist/src/helpers.d.ts.map +0 -1
- package/dist/src/helpers.js +0 -236
- package/dist/src/helpers.js.map +0 -1
- package/dist/src/index.d.ts +0 -10
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -40
- package/dist/src/index.js.map +0 -1
- package/dist/src/integrations/globalhandlers.d.ts +0 -47
- package/dist/src/integrations/globalhandlers.d.ts.map +0 -1
- package/dist/src/integrations/globalhandlers.js +0 -153
- package/dist/src/integrations/globalhandlers.js.map +0 -1
- package/dist/src/integrations/ignoreMpcrawlerErrors.d.ts +0 -21
- package/dist/src/integrations/ignoreMpcrawlerErrors.d.ts.map +0 -1
- package/dist/src/integrations/ignoreMpcrawlerErrors.js +0 -40
- package/dist/src/integrations/ignoreMpcrawlerErrors.js.map +0 -1
- package/dist/src/integrations/index.d.ts +0 -7
- package/dist/src/integrations/index.d.ts.map +0 -1
- package/dist/src/integrations/index.js +0 -14
- package/dist/src/integrations/index.js.map +0 -1
- package/dist/src/integrations/linkederrors.d.ts +0 -40
- package/dist/src/integrations/linkederrors.d.ts.map +0 -1
- package/dist/src/integrations/linkederrors.js +0 -65
- package/dist/src/integrations/linkederrors.js.map +0 -1
- package/dist/src/integrations/router.d.ts +0 -28
- package/dist/src/integrations/router.d.ts.map +0 -1
- package/dist/src/integrations/router.js +0 -47
- package/dist/src/integrations/router.js.map +0 -1
- package/dist/src/integrations/system.d.ts +0 -17
- package/dist/src/integrations/system.d.ts.map +0 -1
- package/dist/src/integrations/system.js +0 -65
- package/dist/src/integrations/system.js.map +0 -1
- package/dist/src/integrations/trycatch.d.ts +0 -26
- package/dist/src/integrations/trycatch.d.ts.map +0 -1
- package/dist/src/integrations/trycatch.js +0 -166
- package/dist/src/integrations/trycatch.js.map +0 -1
- package/dist/src/parsers.d.ts +0 -21
- package/dist/src/parsers.d.ts.map +0 -1
- package/dist/src/parsers.js +0 -97
- package/dist/src/parsers.js.map +0 -1
- package/dist/src/sdk.d.ts +0 -99
- package/dist/src/sdk.d.ts.map +0 -1
- package/dist/src/sdk.js +0 -155
- package/dist/src/sdk.js.map +0 -1
- package/dist/src/tracekit.d.ts +0 -38
- package/dist/src/tracekit.d.ts.map +0 -1
- package/dist/src/tracekit.js +0 -222
- package/dist/src/tracekit.js.map +0 -1
- package/dist/src/transports/base.d.ts +0 -22
- package/dist/src/transports/base.d.ts.map +0 -1
- package/dist/src/transports/base.js +0 -28
- package/dist/src/transports/base.js.map +0 -1
- package/dist/src/transports/index.d.ts +0 -3
- package/dist/src/transports/index.d.ts.map +0 -1
- package/dist/src/transports/index.js +0 -6
- package/dist/src/transports/index.js.map +0 -1
- package/dist/src/transports/xhr.d.ts +0 -10
- package/dist/src/transports/xhr.d.ts.map +0 -1
- package/dist/src/transports/xhr.js +0 -42
- package/dist/src/transports/xhr.js.map +0 -1
- package/dist/src/version.d.ts +0 -3
- package/dist/src/version.d.ts.map +0 -1
- package/dist/src/version.js +0 -6
- package/dist/src/version.js.map +0 -1
- package/dist/transports/base.d.ts +0 -22
- package/dist/transports/base.d.ts.map +0 -1
- package/dist/transports/base.js +0 -28
- package/dist/transports/base.js.map +0 -1
- package/dist/transports/xhr.d.ts +0 -10
- package/dist/transports/xhr.d.ts.map +0 -1
- package/dist/transports/xhr.js +0 -42
- package/dist/transports/xhr.js.map +0 -1
- package/dist/utils/debug-build.d.ts +0 -7
- package/dist/utils/debug-build.d.ts.map +0 -1
- package/dist/utils/debug-build.js +0 -9
- package/dist/utils/debug-build.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -16
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -50
- package/dist/utils/logger.js.map +0 -1
- package/esm/backend.d.ts +0 -41
- package/esm/backend.d.ts.map +0 -1
- package/esm/backend.js +0 -66
- package/esm/backend.js.map +0 -1
- package/esm/helpers.d.ts +0 -35
- package/esm/helpers.d.ts.map +0 -1
- package/esm/helpers.js +0 -229
- package/esm/helpers.js.map +0 -1
- package/esm/integrations/linkederrors.d.ts +0 -40
- package/esm/integrations/linkederrors.d.ts.map +0 -1
- package/esm/integrations/linkederrors.js +0 -63
- package/esm/integrations/linkederrors.js.map +0 -1
- package/esm/integrations/trycatch.d.ts +0 -26
- package/esm/integrations/trycatch.d.ts.map +0 -1
- package/esm/integrations/trycatch.js +0 -164
- package/esm/integrations/trycatch.js.map +0 -1
- package/esm/package.json +0 -52
- package/esm/src/backend.d.ts +0 -41
- package/esm/src/backend.d.ts.map +0 -1
- package/esm/src/backend.js +0 -66
- package/esm/src/backend.js.map +0 -1
- package/esm/src/client.d.ts +0 -55
- package/esm/src/client.d.ts.map +0 -1
- package/esm/src/client.js +0 -49
- package/esm/src/client.js.map +0 -1
- package/esm/src/crossPlatform.d.ts +0 -18
- package/esm/src/crossPlatform.d.ts.map +0 -1
- package/esm/src/crossPlatform.js +0 -77
- package/esm/src/crossPlatform.js.map +0 -1
- package/esm/src/eventbuilder.d.ts +0 -11
- package/esm/src/eventbuilder.d.ts.map +0 -1
- package/esm/src/eventbuilder.js +0 -75
- package/esm/src/eventbuilder.js.map +0 -1
- package/esm/src/flags.d.ts +0 -3
- package/esm/src/flags.d.ts.map +0 -1
- package/esm/src/flags.js +0 -16
- package/esm/src/flags.js.map +0 -1
- package/esm/src/helpers.d.ts +0 -35
- package/esm/src/helpers.d.ts.map +0 -1
- package/esm/src/helpers.js +0 -229
- package/esm/src/helpers.js.map +0 -1
- package/esm/src/index.d.ts +0 -10
- package/esm/src/index.d.ts.map +0 -1
- package/esm/src/index.js +0 -9
- package/esm/src/index.js.map +0 -1
- package/esm/src/integrations/globalhandlers.d.ts +0 -47
- package/esm/src/integrations/globalhandlers.d.ts.map +0 -1
- package/esm/src/integrations/globalhandlers.js +0 -151
- package/esm/src/integrations/globalhandlers.js.map +0 -1
- package/esm/src/integrations/ignoreMpcrawlerErrors.d.ts +0 -21
- package/esm/src/integrations/ignoreMpcrawlerErrors.d.ts.map +0 -1
- package/esm/src/integrations/ignoreMpcrawlerErrors.js +0 -38
- package/esm/src/integrations/ignoreMpcrawlerErrors.js.map +0 -1
- package/esm/src/integrations/index.d.ts +0 -7
- package/esm/src/integrations/index.d.ts.map +0 -1
- package/esm/src/integrations/index.js +0 -7
- package/esm/src/integrations/index.js.map +0 -1
- package/esm/src/integrations/linkederrors.d.ts +0 -40
- package/esm/src/integrations/linkederrors.d.ts.map +0 -1
- package/esm/src/integrations/linkederrors.js +0 -63
- package/esm/src/integrations/linkederrors.js.map +0 -1
- package/esm/src/integrations/router.d.ts +0 -28
- package/esm/src/integrations/router.d.ts.map +0 -1
- package/esm/src/integrations/router.js +0 -45
- package/esm/src/integrations/router.js.map +0 -1
- package/esm/src/integrations/system.d.ts +0 -17
- package/esm/src/integrations/system.d.ts.map +0 -1
- package/esm/src/integrations/system.js +0 -63
- package/esm/src/integrations/system.js.map +0 -1
- package/esm/src/integrations/trycatch.d.ts +0 -26
- package/esm/src/integrations/trycatch.d.ts.map +0 -1
- package/esm/src/integrations/trycatch.js +0 -164
- package/esm/src/integrations/trycatch.js.map +0 -1
- package/esm/src/parsers.d.ts +0 -21
- package/esm/src/parsers.d.ts.map +0 -1
- package/esm/src/parsers.js +0 -91
- package/esm/src/parsers.js.map +0 -1
- package/esm/src/sdk.d.ts +0 -99
- package/esm/src/sdk.d.ts.map +0 -1
- package/esm/src/sdk.js +0 -147
- package/esm/src/sdk.js.map +0 -1
- package/esm/src/tracekit.d.ts +0 -38
- package/esm/src/tracekit.d.ts.map +0 -1
- package/esm/src/tracekit.js +0 -219
- package/esm/src/tracekit.js.map +0 -1
- package/esm/src/transports/base.d.ts +0 -22
- package/esm/src/transports/base.d.ts.map +0 -1
- package/esm/src/transports/base.js +0 -26
- package/esm/src/transports/base.js.map +0 -1
- package/esm/src/transports/index.d.ts +0 -3
- package/esm/src/transports/index.d.ts.map +0 -1
- package/esm/src/transports/index.js +0 -3
- package/esm/src/transports/index.js.map +0 -1
- package/esm/src/transports/xhr.d.ts +0 -10
- package/esm/src/transports/xhr.d.ts.map +0 -1
- package/esm/src/transports/xhr.js +0 -40
- package/esm/src/transports/xhr.js.map +0 -1
- package/esm/src/version.d.ts +0 -3
- package/esm/src/version.d.ts.map +0 -1
- package/esm/src/version.js +0 -4
- package/esm/src/version.js.map +0 -1
- package/esm/transports/base.d.ts +0 -22
- package/esm/transports/base.d.ts.map +0 -1
- package/esm/transports/base.js +0 -26
- package/esm/transports/base.js.map +0 -1
- package/esm/transports/xhr.d.ts +0 -10
- package/esm/transports/xhr.d.ts.map +0 -1
- package/esm/transports/xhr.js +0 -40
- package/esm/transports/xhr.js.map +0 -1
- package/esm/utils/debug-build.d.ts +0 -7
- package/esm/utils/debug-build.d.ts.map +0 -1
- package/esm/utils/debug-build.js +0 -7
- package/esm/utils/debug-build.js.map +0 -1
- package/esm/utils/logger.d.ts +0 -25
- package/esm/utils/logger.d.ts.map +0 -1
- package/esm/utils/logger.js +0 -42
- package/esm/utils/logger.js.map +0 -1
package/esm/src/helpers.js
DELETED
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
|
-
import { captureException, getCurrentHub, withScope } from '@sentry/core';
|
|
3
|
-
import { addExceptionMechanism, addExceptionTypeValue, htmlTreeAsString, normalize } from '@sentry/utils';
|
|
4
|
-
var debounceDuration = 1000;
|
|
5
|
-
var keypressTimeout;
|
|
6
|
-
var lastCapturedEvent;
|
|
7
|
-
var ignoreOnError = 0;
|
|
8
|
-
/**
|
|
9
|
-
* @hidden
|
|
10
|
-
*/
|
|
11
|
-
export function shouldIgnoreOnError() {
|
|
12
|
-
return ignoreOnError > 0;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* @hidden
|
|
16
|
-
*/
|
|
17
|
-
export function ignoreNextOnError() {
|
|
18
|
-
// onerror should trigger before setTimeout
|
|
19
|
-
ignoreOnError += 1;
|
|
20
|
-
setTimeout(function () {
|
|
21
|
-
ignoreOnError -= 1;
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Instruments the given function and sends an event to Sentry every time the
|
|
26
|
-
* function throws an exception.
|
|
27
|
-
*
|
|
28
|
-
* @param fn A function to wrap.
|
|
29
|
-
* @returns The wrapped function.
|
|
30
|
-
* @hidden
|
|
31
|
-
*/
|
|
32
|
-
export function wrap(fn, options, before) {
|
|
33
|
-
if (options === void 0) { options = {}; }
|
|
34
|
-
// tslint:disable-next-line:strict-type-predicates
|
|
35
|
-
if (typeof fn !== 'function') {
|
|
36
|
-
return fn;
|
|
37
|
-
}
|
|
38
|
-
try {
|
|
39
|
-
// We don't wanna wrap it twice
|
|
40
|
-
if (fn.__sentry__) {
|
|
41
|
-
return fn;
|
|
42
|
-
}
|
|
43
|
-
// If this has already been wrapped in the past, return that wrapped function
|
|
44
|
-
if (fn.__sentry_wrapped__) {
|
|
45
|
-
return fn.__sentry_wrapped__;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
catch (e) {
|
|
49
|
-
// Just accessing custom props in some Selenium environments
|
|
50
|
-
// can cause a "Permission denied" exception (see raven-js#495).
|
|
51
|
-
// Bail on wrapping and return the function as-is (defers to window.onerror).
|
|
52
|
-
return fn;
|
|
53
|
-
}
|
|
54
|
-
var sentryWrapped = function () {
|
|
55
|
-
// tslint:disable-next-line:strict-type-predicates
|
|
56
|
-
if (before && typeof before === 'function') {
|
|
57
|
-
before.apply(this, arguments);
|
|
58
|
-
}
|
|
59
|
-
var args = Array.prototype.slice.call(arguments);
|
|
60
|
-
// tslint:disable:no-unsafe-any
|
|
61
|
-
try {
|
|
62
|
-
var wrappedArguments = args.map(function (arg) { return wrap(arg, options); });
|
|
63
|
-
if (fn.handleEvent) {
|
|
64
|
-
// Attempt to invoke user-land function
|
|
65
|
-
// NOTE: If you are a Sentry user, and you are seeing this stack frame, it
|
|
66
|
-
// means the sentry.javascript SDK caught an error invoking your application code. This
|
|
67
|
-
// is expected behavior and NOT indicative of a bug with sentry.javascript.
|
|
68
|
-
return fn.handleEvent.apply(this, wrappedArguments);
|
|
69
|
-
}
|
|
70
|
-
// Attempt to invoke user-land function
|
|
71
|
-
// NOTE: If you are a Sentry user, and you are seeing this stack frame, it
|
|
72
|
-
// means the sentry.javascript SDK caught an error invoking your application code. This
|
|
73
|
-
// is expected behavior and NOT indicative of a bug with sentry.javascript.
|
|
74
|
-
return fn.apply(this, wrappedArguments);
|
|
75
|
-
// tslint:enable:no-unsafe-any
|
|
76
|
-
}
|
|
77
|
-
catch (ex) {
|
|
78
|
-
ignoreNextOnError();
|
|
79
|
-
withScope(function (scope) {
|
|
80
|
-
scope.addEventProcessor(function (event) {
|
|
81
|
-
var processedEvent = __assign({}, event);
|
|
82
|
-
if (options.mechanism) {
|
|
83
|
-
addExceptionTypeValue(processedEvent, undefined, undefined);
|
|
84
|
-
addExceptionMechanism(processedEvent, options.mechanism);
|
|
85
|
-
}
|
|
86
|
-
processedEvent.extra = __assign(__assign({}, processedEvent.extra), { arguments: normalize(args, 3) });
|
|
87
|
-
return processedEvent;
|
|
88
|
-
});
|
|
89
|
-
captureException(ex);
|
|
90
|
-
});
|
|
91
|
-
throw ex;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
// Accessing some objects may throw
|
|
95
|
-
// ref: https://github.com/getsentry/sentry-javascript/issues/1168
|
|
96
|
-
try {
|
|
97
|
-
// tslint:disable-next-line: no-for-in
|
|
98
|
-
for (var property in fn) {
|
|
99
|
-
if (Object.prototype.hasOwnProperty.call(fn, property)) {
|
|
100
|
-
sentryWrapped[property] = fn[property];
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
catch (_oO) { } // tslint:disable-line:no-empty
|
|
105
|
-
fn.prototype = fn.prototype || {};
|
|
106
|
-
sentryWrapped.prototype = fn.prototype;
|
|
107
|
-
Object.defineProperty(fn, '__sentry_wrapped__', {
|
|
108
|
-
enumerable: false,
|
|
109
|
-
value: sentryWrapped,
|
|
110
|
-
});
|
|
111
|
-
// Signal that this function has been wrapped/filled already
|
|
112
|
-
// for both debugging and to prevent it to being wrapped/filled twice
|
|
113
|
-
Object.defineProperties(sentryWrapped, {
|
|
114
|
-
__sentry__: {
|
|
115
|
-
enumerable: false,
|
|
116
|
-
value: true,
|
|
117
|
-
},
|
|
118
|
-
__sentry_original__: {
|
|
119
|
-
enumerable: false,
|
|
120
|
-
value: fn,
|
|
121
|
-
},
|
|
122
|
-
});
|
|
123
|
-
// Restore original function name (not all browsers allow that)
|
|
124
|
-
try {
|
|
125
|
-
var descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, 'name');
|
|
126
|
-
if (descriptor.configurable) {
|
|
127
|
-
Object.defineProperty(sentryWrapped, 'name', {
|
|
128
|
-
get: function () {
|
|
129
|
-
return fn.name;
|
|
130
|
-
},
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
catch (_oO) {
|
|
135
|
-
/*no-empty*/
|
|
136
|
-
}
|
|
137
|
-
return sentryWrapped;
|
|
138
|
-
}
|
|
139
|
-
var debounceTimer = 0;
|
|
140
|
-
/**
|
|
141
|
-
* Wraps addEventListener to capture UI breadcrumbs
|
|
142
|
-
* @param eventName the event name (e.g. "click")
|
|
143
|
-
* @returns wrapped breadcrumb events handler
|
|
144
|
-
* @hidden
|
|
145
|
-
*/
|
|
146
|
-
export function breadcrumbEventHandler(eventName, debounce) {
|
|
147
|
-
if (debounce === void 0) { debounce = false; }
|
|
148
|
-
return function (event) {
|
|
149
|
-
// reset keypress timeout; e.g. triggering a 'click' after
|
|
150
|
-
// a 'keypress' will reset the keypress debounce so that a new
|
|
151
|
-
// set of keypresses can be recorded
|
|
152
|
-
keypressTimeout = undefined;
|
|
153
|
-
// It's possible this handler might trigger multiple times for the same
|
|
154
|
-
// event (e.g. event propagation through node ancestors). Ignore if we've
|
|
155
|
-
// already captured the event.
|
|
156
|
-
// tslint:disable-next-line: strict-comparisons
|
|
157
|
-
if (!event || lastCapturedEvent === event) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
lastCapturedEvent = event;
|
|
161
|
-
var captureBreadcrumb = function () {
|
|
162
|
-
var target;
|
|
163
|
-
// Accessing event.target can throw (see getsentry/raven-js#838, #768)
|
|
164
|
-
try {
|
|
165
|
-
target = event.target ? htmlTreeAsString(event.target) : htmlTreeAsString(event);
|
|
166
|
-
}
|
|
167
|
-
catch (e) {
|
|
168
|
-
target = '<unknown>';
|
|
169
|
-
}
|
|
170
|
-
if (target.length === 0) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
getCurrentHub().addBreadcrumb({
|
|
174
|
-
category: "ui." + eventName,
|
|
175
|
-
message: target,
|
|
176
|
-
}, {
|
|
177
|
-
event: event,
|
|
178
|
-
name: eventName,
|
|
179
|
-
});
|
|
180
|
-
};
|
|
181
|
-
if (debounceTimer) {
|
|
182
|
-
clearTimeout(debounceTimer);
|
|
183
|
-
}
|
|
184
|
-
if (debounce) {
|
|
185
|
-
debounceTimer = setTimeout(captureBreadcrumb);
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
captureBreadcrumb();
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Wraps addEventListener to capture keypress UI events
|
|
194
|
-
* @returns wrapped keypress events handler
|
|
195
|
-
* @hidden
|
|
196
|
-
*/
|
|
197
|
-
export function keypressEventHandler() {
|
|
198
|
-
// TODO: if somehow user switches keypress target before
|
|
199
|
-
// debounce timeout is triggered, we will only capture
|
|
200
|
-
// a single breadcrumb from the FIRST target (acceptable?)
|
|
201
|
-
return function (event) {
|
|
202
|
-
var target;
|
|
203
|
-
try {
|
|
204
|
-
target = event.target;
|
|
205
|
-
}
|
|
206
|
-
catch (e) {
|
|
207
|
-
// just accessing event properties can throw an exception in some rare circumstances
|
|
208
|
-
// see: https://github.com/getsentry/raven-js/issues/838
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
var tagName = target && target.tagName;
|
|
212
|
-
// only consider keypress events on actual input elements
|
|
213
|
-
// this will disregard keypresses targeting body (e.g. tabbing
|
|
214
|
-
// through elements, hotkeys, etc)
|
|
215
|
-
if (!tagName || (tagName !== 'INPUT' && tagName !== 'TEXTAREA' && !target.isContentEditable)) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
// record first keypress in a series, but ignore subsequent
|
|
219
|
-
// keypresses until debounce clears
|
|
220
|
-
if (!keypressTimeout) {
|
|
221
|
-
breadcrumbEventHandler('input')(event);
|
|
222
|
-
}
|
|
223
|
-
clearTimeout(keypressTimeout);
|
|
224
|
-
keypressTimeout = setTimeout(function () {
|
|
225
|
-
keypressTimeout = undefined;
|
|
226
|
-
}, debounceDuration);
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
//# sourceMappingURL=helpers.js.map
|
package/esm/src/helpers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1G,IAAM,gBAAgB,GAAW,IAAI,CAAC;AACtC,IAAI,eAAmC,CAAC;AACxC,IAAI,iBAAoC,CAAC;AACzC,IAAI,aAAa,GAAW,CAAC,CAAC;AAE9B;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,aAAa,GAAG,CAAC,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,2CAA2C;IAC3C,aAAa,IAAI,CAAC,CAAC;IACnB,UAAU,CAAC;QACT,aAAa,IAAI,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,IAAI,CAClB,EAAmB,EACnB,OAGM,EACN,MAAwB;IAJxB,wBAAA,EAAA,YAGM;IAGN,kDAAkD;IAClD,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE;QAC5B,OAAO,EAAE,CAAC;KACX;IAED,IAAI;QACF,+BAA+B;QAC/B,IAAI,EAAE,CAAC,UAAU,EAAE;YACjB,OAAO,EAAE,CAAC;SACX;QAED,6EAA6E;QAC7E,IAAI,EAAE,CAAC,k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a,CAAC,CAAC;SAC7B;QAED,IAAI,QAAQ,EAAE;YACZ,aAAa,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;SAC/C;aAAM;YACL,iBAAiB,EAAE,CAAC;SACrB;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAClC,wDAAwD;IACxD,4DAA4D;IAC5D,gEAAgE;IAChE,OAAO,UAAC,KAAY;QAClB,IAAI,MAAM,CAAC;QAEX,IAAI;YACF,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;SACvB;QAAC,OAAO,CAAC,EAAE;YACV,oFAAoF;YACpF,wDAAwD;YACxD,OAAO;SACR;QAED,IAAM,OAAO,GAAG,MAAM,IAAK,MAAsB,CAAC,OAAO,CAAC;QAE1D,yDAAyD;QACzD,8DAA8D;QAC9D,kCAAkC;QAClC,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,KAAK,OAAO,IAAI,OAAO,KAAK,UAAU,IAAI,CAAE,MAAsB,CAAC,iBAAiB,CAAC,EAAE;YAC7G,OAAO;SACR;QAED,2DAA2D;QAC3D,mCAAmC;QACnC,IAAI,CAAC,eAAe,EAAE;YACpB,sBAAsB,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC;SACxC;QACD,YAAY,CAAC,eAAe,CAAC,CAAC;QAE9B,eAAe,GAAI,UAAU,CAAC;YAC5B,eAAe,GAAG,SAAS,CAAC;QAC9B,CAAC,EAAE,gBAAgB,CAAmB,CAAC;IACzC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { captureException, getCurrentHub, withScope } from '@sentry/core';\nimport { Event as SentryEvent, Mechanism, Scope, WrappedFunction } from '@sentry/types';\nimport { addExceptionMechanism, addExceptionTypeValue, htmlTreeAsString, normalize } from '@sentry/utils';\n\nconst debounceDuration: number = 1000;\nlet keypressTimeout: number | undefined;\nlet lastCapturedEvent: Event | undefined;\nlet ignoreOnError: number = 0;\n\n/**\n * @hidden\n */\nexport function shouldIgnoreOnError(): boolean {\n return ignoreOnError > 0;\n}\n\n/**\n * @hidden\n */\nexport function ignoreNextOnError(): void {\n // onerror should trigger before setTimeout\n ignoreOnError += 1;\n setTimeout(() => {\n ignoreOnError -= 1;\n });\n}\n\n/**\n * Instruments the given function and sends an event to Sentry every time the\n * function throws an exception.\n *\n * @param fn A function to wrap.\n * @returns The wrapped function.\n * @hidden\n */\nexport function wrap(\n fn: WrappedFunction,\n options: {\n mechanism?: Mechanism;\n capture?: boolean;\n } = {},\n before?: WrappedFunction,\n): any {\n // tslint:disable-next-line:strict-type-predicates\n if (typeof fn !== 'function') {\n return fn;\n }\n\n try {\n // We don't wanna wrap it twice\n if (fn.__sentry__) {\n return fn;\n }\n\n // If this has already been wrapped in the past, return that wrapped function\n if (fn.__sentry_wrapped__) {\n return fn.__sentry_wrapped__;\n }\n } catch (e) {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n // Bail on wrapping and return the function as-is (defers to window.onerror).\n return fn;\n }\n\n const sentryWrapped: WrappedFunction = function (this: any): void {\n // tslint:disable-next-line:strict-type-predicates\n if (before && typeof before === 'function') {\n before.apply(this, arguments);\n }\n\n const args = Array.prototype.slice.call(arguments);\n\n // tslint:disable:no-unsafe-any\n try {\n const wrappedArguments = args.map((arg: any) => wrap(arg, options));\n\n if (fn.handleEvent) {\n // Attempt to invoke user-land function\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it\n // means the sentry.javascript SDK caught an error invoking your application code. This\n // is expected behavior and NOT indicative of a bug with sentry.javascript.\n return fn.handleEvent.apply(this, wrappedArguments);\n }\n\n // Attempt to invoke user-land function\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it\n // means the sentry.javascript SDK caught an error invoking your application code. This\n // is expected behavior and NOT indicative of a bug with sentry.javascript.\n return fn.apply(this, wrappedArguments);\n // tslint:enable:no-unsafe-any\n } catch (ex) {\n ignoreNextOnError();\n\n withScope((scope: Scope) => {\n scope.addEventProcessor((event: SentryEvent) => {\n const processedEvent = { ...event };\n\n if (options.mechanism) {\n addExceptionTypeValue(processedEvent, undefined, undefined);\n addExceptionMechanism(processedEvent, options.mechanism);\n }\n\n processedEvent.extra = {\n ...processedEvent.extra,\n arguments: normalize(args, 3),\n };\n\n return processedEvent;\n });\n\n captureException(ex);\n });\n\n throw ex;\n }\n };\n\n // Accessing some objects may throw\n // ref: https://github.com/getsentry/sentry-javascript/issues/1168\n try {\n // tslint:disable-next-line: no-for-in\n for (const property in fn) {\n if (Object.prototype.hasOwnProperty.call(fn, property)) {\n sentryWrapped[property] = fn[property];\n }\n }\n } catch (_oO) { } // tslint:disable-line:no-empty\n\n fn.prototype = fn.prototype || {};\n sentryWrapped.prototype = fn.prototype;\n\n Object.defineProperty(fn, '__sentry_wrapped__', {\n enumerable: false,\n value: sentryWrapped,\n });\n\n // Signal that this function has been wrapped/filled already\n // for both debugging and to prevent it to being wrapped/filled twice\n Object.defineProperties(sentryWrapped, {\n __sentry__: {\n enumerable: false,\n value: true,\n },\n __sentry_original__: {\n enumerable: false,\n value: fn,\n },\n });\n\n // Restore original function name (not all browsers allow that)\n try {\n const descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, 'name') as PropertyDescriptor;\n if (descriptor.configurable) {\n Object.defineProperty(sentryWrapped, 'name', {\n get(): string {\n return fn.name;\n },\n });\n }\n } catch (_oO) {\n /*no-empty*/\n }\n\n return sentryWrapped;\n}\n\nlet debounceTimer: number = 0;\n\n/**\n * Wraps addEventListener to capture UI breadcrumbs\n * @param eventName the event name (e.g. \"click\")\n * @returns wrapped breadcrumb events handler\n * @hidden\n */\nexport function breadcrumbEventHandler(eventName: string, debounce: boolean = false): (event: Event) => void {\n return (event: Event) => {\n // reset keypress timeout; e.g. triggering a 'click' after\n // a 'keypress' will reset the keypress debounce so that a new\n // set of keypresses can be recorded\n keypressTimeout = undefined;\n // It's possible this handler might trigger multiple times for the same\n // event (e.g. event propagation through node ancestors). Ignore if we've\n // already captured the event.\n // tslint:disable-next-line: strict-comparisons\n if (!event || lastCapturedEvent === event) {\n return;\n }\n\n lastCapturedEvent = event;\n\n const captureBreadcrumb = () => {\n let target;\n\n // Accessing event.target can throw (see getsentry/raven-js#838, #768)\n try {\n target = event.target ? htmlTreeAsString(event.target as Node) : htmlTreeAsString((event as unknown) as Node);\n } catch (e) {\n target = '<unknown>';\n }\n\n if (target.length === 0) {\n return;\n }\n\n getCurrentHub().addBreadcrumb(\n {\n category: `ui.${eventName}`, // e.g. ui.click, ui.input\n message: target,\n },\n {\n event,\n name: eventName,\n },\n );\n };\n\n if (debounceTimer) {\n clearTimeout(debounceTimer);\n }\n\n if (debounce) {\n debounceTimer = setTimeout(captureBreadcrumb);\n } else {\n captureBreadcrumb();\n }\n };\n}\n\n/**\n * Wraps addEventListener to capture keypress UI events\n * @returns wrapped keypress events handler\n * @hidden\n */\nexport function keypressEventHandler(): (event: Event) => void {\n // TODO: if somehow user switches keypress target before\n // debounce timeout is triggered, we will only capture\n // a single breadcrumb from the FIRST target (acceptable?)\n return (event: Event) => {\n let target;\n\n try {\n target = event.target;\n } catch (e) {\n // just accessing event properties can throw an exception in some rare circumstances\n // see: https://github.com/getsentry/raven-js/issues/838\n return;\n }\n\n const tagName = target && (target as HTMLElement).tagName;\n\n // only consider keypress events on actual input elements\n // this will disregard keypresses targeting body (e.g. tabbing\n // through elements, hotkeys, etc)\n if (!tagName || (tagName !== 'INPUT' && tagName !== 'TEXTAREA' && !(target as HTMLElement).isContentEditable)) {\n return;\n }\n\n // record first keypress in a series, but ignore subsequent\n // keypresses until debounce clears\n if (!keypressTimeout) {\n breadcrumbEventHandler('input')(event);\n }\n clearTimeout(keypressTimeout);\n\n keypressTimeout = (setTimeout(() => {\n keypressTimeout = undefined;\n }, debounceDuration) as any) as number;\n };\n}\n"]}
|
package/esm/src/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { Breadcrumb, BreadcrumbHint, Request, SdkInfo, Event, EventHint, EventStatus, Exception, Response, Severity, StackFrame, Stacktrace, Thread, User, } from "@sentry/types";
|
|
2
|
-
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, configureScope, getHubFromCarrier, getCurrentHub, Hub, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, withScope } from "@sentry/core";
|
|
3
|
-
export { SDK_NAME, SDK_VERSION } from "./version";
|
|
4
|
-
export { defaultIntegrations, init, lastEventId, showReportDialog, flush, close, wrap } from "./sdk";
|
|
5
|
-
export { MiniappOptions } from "./backend";
|
|
6
|
-
export { MiniappClient, ReportDialogOptions } from "./client";
|
|
7
|
-
import * as Integrations from "./integrations/index";
|
|
8
|
-
import * as Transports from "./transports/index";
|
|
9
|
-
export { Integrations, Transports };
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
package/esm/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,cAAc,EACd,OAAO,EACP,OAAO,EACP,KAAK,EACL,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,GACL,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,KAAK,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EACL,mBAAmB,EACnB,IAAI,EACJ,WAAW,EACX,gBAAgB,EAChB,KAAK,EACL,KAAK,EACL,IAAI,EACL,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE9D,OAAO,KAAK,YAAY,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC"}
|
package/esm/src/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { Severity, } from "@sentry/types";
|
|
2
|
-
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, configureScope, getHubFromCarrier, getCurrentHub, Hub, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, withScope } from "@sentry/core";
|
|
3
|
-
export { SDK_NAME, SDK_VERSION } from "./version";
|
|
4
|
-
export { defaultIntegrations, init, lastEventId, showReportDialog, flush, close, wrap } from "./sdk";
|
|
5
|
-
export { MiniappClient } from "./client";
|
|
6
|
-
import * as Integrations from "./integrations/index";
|
|
7
|
-
import * as Transports from "./transports/index";
|
|
8
|
-
export { Integrations, Transports };
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
package/esm/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAUL,QAAQ,GAKT,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,KAAK,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EACL,mBAAmB,EACnB,IAAI,EACJ,WAAW,EACX,gBAAgB,EAChB,KAAK,EACL,KAAK,EACL,IAAI,EACL,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,aAAa,EAAuB,MAAM,UAAU,CAAC;AAE9D,OAAO,KAAK,YAAY,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC","sourcesContent":["export {\n Breadcrumb,\n BreadcrumbHint,\n Request,\n SdkInfo,\n Event,\n EventHint,\n EventStatus,\n Exception,\n Response,\n Severity,\n StackFrame,\n Stacktrace,\n Thread,\n User,\n} from \"@sentry/types\";\n\nexport {\n addGlobalEventProcessor,\n addBreadcrumb,\n captureException,\n captureEvent,\n captureMessage,\n configureScope,\n getHubFromCarrier,\n getCurrentHub,\n Hub,\n Scope,\n setContext,\n setExtra,\n setExtras,\n setTag,\n setTags,\n setUser,\n withScope\n} from \"@sentry/core\";\n\nexport { SDK_NAME, SDK_VERSION } from \"./version\";\nexport {\n defaultIntegrations,\n init,\n lastEventId,\n showReportDialog,\n flush,\n close,\n wrap\n} from \"./sdk\";\nexport { MiniappOptions } from \"./backend\";\nexport { MiniappClient, ReportDialogOptions } from \"./client\";\n\nimport * as Integrations from \"./integrations/index\";\nimport * as Transports from \"./transports/index\";\n\nexport { Integrations, Transports };\n"]}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Integration } from "@sentry/types";
|
|
2
|
-
/** JSDoc */
|
|
3
|
-
interface GlobalHandlersIntegrations {
|
|
4
|
-
onerror: boolean;
|
|
5
|
-
onunhandledrejection: boolean;
|
|
6
|
-
onpagenotfound: boolean;
|
|
7
|
-
onmemorywarning: boolean;
|
|
8
|
-
}
|
|
9
|
-
/** Global handlers */
|
|
10
|
-
export declare class GlobalHandlers implements Integration {
|
|
11
|
-
/**
|
|
12
|
-
* @inheritDoc
|
|
13
|
-
*/
|
|
14
|
-
name: string;
|
|
15
|
-
/**
|
|
16
|
-
* @inheritDoc
|
|
17
|
-
*/
|
|
18
|
-
static id: string;
|
|
19
|
-
/** JSDoc */
|
|
20
|
-
private readonly _options;
|
|
21
|
-
/** JSDoc */
|
|
22
|
-
private _onErrorHandlerInstalled;
|
|
23
|
-
/** JSDoc */
|
|
24
|
-
private _onUnhandledRejectionHandlerInstalled;
|
|
25
|
-
/** JSDoc */
|
|
26
|
-
private _onPageNotFoundHandlerInstalled;
|
|
27
|
-
/** JSDoc */
|
|
28
|
-
private _onMemoryWarningHandlerInstalled;
|
|
29
|
-
/** JSDoc */
|
|
30
|
-
constructor(options?: GlobalHandlersIntegrations);
|
|
31
|
-
/** JSDoc */
|
|
32
|
-
setExtraOptions(extraOptions?: any): void;
|
|
33
|
-
/**
|
|
34
|
-
* @inheritDoc
|
|
35
|
-
*/
|
|
36
|
-
setupOnce(): void;
|
|
37
|
-
/** JSDoc */
|
|
38
|
-
private _installGlobalOnErrorHandler;
|
|
39
|
-
/** JSDoc */
|
|
40
|
-
private _installGlobalOnUnhandledRejectionHandler;
|
|
41
|
-
/** JSDoc */
|
|
42
|
-
private _installGlobalOnPageNotFoundHandler;
|
|
43
|
-
/** JSDoc */
|
|
44
|
-
private _installGlobalOnMemoryWarningHandler;
|
|
45
|
-
}
|
|
46
|
-
export {};
|
|
47
|
-
//# sourceMappingURL=globalhandlers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"globalhandlers.d.ts","sourceRoot":"","sources":["../../../src/integrations/globalhandlers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5C,YAAY;AACZ,UAAU,0BAA0B;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,sBAAsB;AACtB,qBAAa,cAAe,YAAW,WAAW;IAChD;;OAEG;IACI,IAAI,EAAE,MAAM,CAAqB;IAExC;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAoB;IAE5C,YAAY;IACZ,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;IAEtD,YAAY;IACZ,OAAO,CAAC,wBAAwB,CAAkB;IAElD,YAAY;IACZ,OAAO,CAAC,qCAAqC,CAAkB;IAE/D,YAAY;IACZ,OAAO,CAAC,+BAA+B,CAAkB;IAEzD,YAAY;IACZ,OAAO,CAAC,gCAAgC,CAAkB;IAE1D,YAAY;gBACO,OAAO,CAAC,EAAE,0BAA0B;IAUvD,YAAY;IACL,eAAe,CAAC,YAAY,CAAC,EAAE,GAAG,GAAG,IAAI;IAoBhD;;OAEG;IACI,SAAS,IAAI,IAAI;IAwBxB,YAAY;IACZ,OAAO,CAAC,4BAA4B;IAmBpC,YAAY;IACZ,OAAO,CAAC,yCAAyC;IA6BjD,YAAY;IACZ,OAAO,CAAC,mCAAmC;IAoB3C,YAAY;IACZ,OAAO,CAAC,oCAAoC;CAiC7C"}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
|
-
import { getCurrentHub } from "@sentry/core";
|
|
3
|
-
import { logger } from "@sentry/utils";
|
|
4
|
-
import { sdk } from "../crossPlatform";
|
|
5
|
-
/** Global handlers */
|
|
6
|
-
var GlobalHandlers = /** @class */ (function () {
|
|
7
|
-
/** JSDoc */
|
|
8
|
-
function GlobalHandlers(options) {
|
|
9
|
-
/**
|
|
10
|
-
* @inheritDoc
|
|
11
|
-
*/
|
|
12
|
-
this.name = GlobalHandlers.id;
|
|
13
|
-
/** JSDoc */
|
|
14
|
-
this._onErrorHandlerInstalled = false;
|
|
15
|
-
/** JSDoc */
|
|
16
|
-
this._onUnhandledRejectionHandlerInstalled = false;
|
|
17
|
-
/** JSDoc */
|
|
18
|
-
this._onPageNotFoundHandlerInstalled = false;
|
|
19
|
-
/** JSDoc */
|
|
20
|
-
this._onMemoryWarningHandlerInstalled = false;
|
|
21
|
-
this._options = __assign({ onerror: true, onunhandledrejection: true, onpagenotfound: true, onmemorywarning: true }, options);
|
|
22
|
-
}
|
|
23
|
-
/** JSDoc */
|
|
24
|
-
GlobalHandlers.prototype.setExtraOptions = function (extraOptions) {
|
|
25
|
-
if (extraOptions) {
|
|
26
|
-
if (extraOptions.onerror !== undefined) {
|
|
27
|
-
this._options.onerror = !!extraOptions.onerror;
|
|
28
|
-
}
|
|
29
|
-
if (extraOptions.onunhandledrejection !== undefined) {
|
|
30
|
-
this._options.onunhandledrejection = !!extraOptions.onunhandledrejection;
|
|
31
|
-
}
|
|
32
|
-
if (extraOptions.onpagenotfound !== undefined) {
|
|
33
|
-
this._options.onpagenotfound = !!extraOptions.onpagenotfound;
|
|
34
|
-
}
|
|
35
|
-
if (extraOptions.onmemorywarning !== undefined) {
|
|
36
|
-
this._options.onmemorywarning = !!extraOptions.onmemorywarning;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* @inheritDoc
|
|
42
|
-
*/
|
|
43
|
-
GlobalHandlers.prototype.setupOnce = function () {
|
|
44
|
-
Error.stackTraceLimit = 50;
|
|
45
|
-
if (this._options.onerror) {
|
|
46
|
-
logger.log("Global Handler attached: onError");
|
|
47
|
-
this._installGlobalOnErrorHandler();
|
|
48
|
-
}
|
|
49
|
-
if (this._options.onunhandledrejection) {
|
|
50
|
-
logger.log("Global Handler attached: onunhandledrejection");
|
|
51
|
-
this._installGlobalOnUnhandledRejectionHandler();
|
|
52
|
-
}
|
|
53
|
-
if (this._options.onpagenotfound) {
|
|
54
|
-
logger.log("Global Handler attached: onPageNotFound");
|
|
55
|
-
this._installGlobalOnPageNotFoundHandler();
|
|
56
|
-
}
|
|
57
|
-
if (this._options.onmemorywarning) {
|
|
58
|
-
logger.log("Global Handler attached: onMemoryWarning");
|
|
59
|
-
this._installGlobalOnMemoryWarningHandler();
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
/** JSDoc */
|
|
63
|
-
GlobalHandlers.prototype._installGlobalOnErrorHandler = function () {
|
|
64
|
-
if (this._onErrorHandlerInstalled) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
if (!!sdk.onError) {
|
|
68
|
-
var currentHub_1 = getCurrentHub();
|
|
69
|
-
// https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html
|
|
70
|
-
sdk.onError(function (err) {
|
|
71
|
-
// console.info("sentry-uniapp", err);
|
|
72
|
-
var error = typeof err === 'string' ? new Error(err) : err;
|
|
73
|
-
currentHub_1.captureException(error);
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
this._onErrorHandlerInstalled = true;
|
|
77
|
-
};
|
|
78
|
-
/** JSDoc */
|
|
79
|
-
GlobalHandlers.prototype._installGlobalOnUnhandledRejectionHandler = function () {
|
|
80
|
-
if (this._onUnhandledRejectionHandlerInstalled) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
if (!!sdk.onUnhandledRejection) {
|
|
84
|
-
var currentHub_2 = getCurrentHub();
|
|
85
|
-
// https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html
|
|
86
|
-
sdk.onUnhandledRejection(function (_a) {
|
|
87
|
-
var reason = _a.reason, promise = _a.promise;
|
|
88
|
-
// console.log(reason, typeof reason, promise)
|
|
89
|
-
// 为什么官方文档上说 reason 是 string 类型,但是实际返回的确实 object 类型
|
|
90
|
-
var error = typeof reason === 'string' ? new Error(reason) : reason;
|
|
91
|
-
currentHub_2.captureException(error, {
|
|
92
|
-
data: promise,
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
this._onUnhandledRejectionHandlerInstalled = true;
|
|
97
|
-
};
|
|
98
|
-
/** JSDoc */
|
|
99
|
-
GlobalHandlers.prototype._installGlobalOnPageNotFoundHandler = function () {
|
|
100
|
-
if (this._onPageNotFoundHandlerInstalled) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (!!sdk.onPageNotFound) {
|
|
104
|
-
var currentHub_3 = getCurrentHub();
|
|
105
|
-
sdk.onPageNotFound(function (res) {
|
|
106
|
-
var url = res.path.split("?")[0];
|
|
107
|
-
currentHub_3.setTag("pagenotfound", url);
|
|
108
|
-
currentHub_3.setExtra("message", JSON.stringify(res));
|
|
109
|
-
currentHub_3.captureMessage("\u9875\u9762\u65E0\u6CD5\u627E\u5230: " + url);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
this._onPageNotFoundHandlerInstalled = true;
|
|
113
|
-
};
|
|
114
|
-
/** JSDoc */
|
|
115
|
-
GlobalHandlers.prototype._installGlobalOnMemoryWarningHandler = function () {
|
|
116
|
-
if (this._onMemoryWarningHandlerInstalled) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
if (!!sdk.onMemoryWarning) {
|
|
120
|
-
var currentHub_4 = getCurrentHub();
|
|
121
|
-
sdk.onMemoryWarning(function (_a) {
|
|
122
|
-
var _b = _a.level, level = _b === void 0 ? -1 : _b;
|
|
123
|
-
var levelMessage = "没有获取到告警级别信息";
|
|
124
|
-
switch (level) {
|
|
125
|
-
case 5:
|
|
126
|
-
levelMessage = "TRIM_MEMORY_RUNNING_MODERATE";
|
|
127
|
-
break;
|
|
128
|
-
case 10:
|
|
129
|
-
levelMessage = "TRIM_MEMORY_RUNNING_LOW";
|
|
130
|
-
break;
|
|
131
|
-
case 15:
|
|
132
|
-
levelMessage = "TRIM_MEMORY_RUNNING_CRITICAL";
|
|
133
|
-
break;
|
|
134
|
-
default:
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
currentHub_4.setTag("memory-warning", String(level));
|
|
138
|
-
currentHub_4.setExtra("message", levelMessage);
|
|
139
|
-
currentHub_4.captureMessage("\u5185\u5B58\u4E0D\u8DB3\u544A\u8B66");
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
this._onMemoryWarningHandlerInstalled = true;
|
|
143
|
-
};
|
|
144
|
-
/**
|
|
145
|
-
* @inheritDoc
|
|
146
|
-
*/
|
|
147
|
-
GlobalHandlers.id = "GlobalHandlers";
|
|
148
|
-
return GlobalHandlers;
|
|
149
|
-
}());
|
|
150
|
-
export { GlobalHandlers };
|
|
151
|
-
//# sourceMappingURL=globalhandlers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;IAED,YAAY;IACL,wCAAe,GAAtB,UAAuB,YAAkB;QACvC,IAAI,YAAY,EAAE;YAChB,IAAI,YAAY,CAAC,OAAO,KAAK,SAAS,EAAE;gBACtC,IAAI,CAAC,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC;aAChD;YAED,IAAI,YAAY,CAAC,oBAAoB,KAAK,SAAS,EAAE;gBACnD,IAAI,CAAC,QAAQ,CAAC,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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,21 +0,0 @@
|
|
|
1
|
-
import { Integration } from "@sentry/types";
|
|
2
|
-
/**
|
|
3
|
-
* IgnoreMpcrawlerErrors
|
|
4
|
-
*
|
|
5
|
-
* https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/sitemap.html
|
|
6
|
-
*/
|
|
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
|
-
}
|
|
21
|
-
//# sourceMappingURL=ignoreMpcrawlerErrors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,38 +0,0 @@
|
|
|
1
|
-
import { addGlobalEventProcessor, getCurrentHub } from "@sentry/core";
|
|
2
|
-
import { appName, sdk } from "../crossPlatform";
|
|
3
|
-
/**
|
|
4
|
-
* IgnoreMpcrawlerErrors
|
|
5
|
-
*
|
|
6
|
-
* https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/sitemap.html
|
|
7
|
-
*/
|
|
8
|
-
var IgnoreMpcrawlerErrors = /** @class */ (function () {
|
|
9
|
-
function IgnoreMpcrawlerErrors() {
|
|
10
|
-
/**
|
|
11
|
-
* @inheritDoc
|
|
12
|
-
*/
|
|
13
|
-
this.name = IgnoreMpcrawlerErrors.id;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* @inheritDoc
|
|
17
|
-
*/
|
|
18
|
-
IgnoreMpcrawlerErrors.prototype.setupOnce = function () {
|
|
19
|
-
addGlobalEventProcessor(function (event) {
|
|
20
|
-
if (getCurrentHub().getIntegration(IgnoreMpcrawlerErrors) &&
|
|
21
|
-
appName === "wechat" &&
|
|
22
|
-
sdk.getLaunchOptionsSync) {
|
|
23
|
-
var options = sdk.getLaunchOptionsSync();
|
|
24
|
-
if (options.scene === 1129) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return event;
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* @inheritDoc
|
|
33
|
-
*/
|
|
34
|
-
IgnoreMpcrawlerErrors.id = "IgnoreMpcrawlerErrors";
|
|
35
|
-
return IgnoreMpcrawlerErrors;
|
|
36
|
-
}());
|
|
37
|
-
export { IgnoreMpcrawlerErrors };
|
|
38
|
-
//# sourceMappingURL=ignoreMpcrawlerErrors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ignoreMpcrawlerErrors.js","sourceRoot":"","sources":["../../../src/integrations/ignoreMpcrawlerErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGtE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEhD;;;;GAIG;AACH;IAAA;QACE;;WAEG;QACI,SAAI,GAAW,qBAAqB,CAAC,EAAE,CAAC;IA2BjD,CAAC;IApBC;;OAEG;IACI,yCAAS,GAAhB;QACE,uBAAuB,CAAC,UAAC,KAAY;YACnC,IACE,aAAa,EAAE,CAAC,cAAc,CAAC,qBAAqB,CAAC;gBACrD,OAAO,KAAK,QAAQ;gBACpB,GAAG,CAAC,oBAAoB,EACxB;gBACA,IAAM,OAAO,GAAG,GAAG,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;SA/BY,qBAAqB","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,7 +0,0 @@
|
|
|
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";
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,7 +0,0 @@
|
|
|
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";
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","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","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"]}
|