sentry-uniapp 1.0.12 → 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.
- package/README.md +11 -9
- package/dist/client.d.ts +38 -40
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +46 -41
- package/dist/client.js.map +1 -1
- package/dist/crossPlatform.d.ts +1 -1
- package/dist/crossPlatform.js +11 -10
- package/dist/crossPlatform.js.map +1 -1
- 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/sdk.d.ts +9 -85
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +55 -128
- 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 +45 -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 +38 -40
- package/esm/client.d.ts.map +1 -1
- package/esm/client.js +43 -40
- package/esm/client.js.map +1 -1
- package/esm/crossPlatform.d.ts +1 -1
- package/esm/crossPlatform.js +10 -10
- package/esm/crossPlatform.js.map +1 -1
- 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/sdk.d.ts +9 -85
- package/esm/sdk.d.ts.map +1 -1
- package/esm/sdk.js +49 -121
- 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 +41 -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/dist/helpers.js
DELETED
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.keypressEventHandler = exports.breadcrumbEventHandler = exports.wrap = exports.ignoreNextOnError = exports.shouldIgnoreOnError = void 0;
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
|
-
var core_1 = require("@sentry/core");
|
|
5
|
-
var utils_1 = require("@sentry/utils");
|
|
6
|
-
var debounceDuration = 1000;
|
|
7
|
-
var keypressTimeout;
|
|
8
|
-
var lastCapturedEvent;
|
|
9
|
-
var ignoreOnError = 0;
|
|
10
|
-
/**
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
function shouldIgnoreOnError() {
|
|
14
|
-
return ignoreOnError > 0;
|
|
15
|
-
}
|
|
16
|
-
exports.shouldIgnoreOnError = shouldIgnoreOnError;
|
|
17
|
-
/**
|
|
18
|
-
* @hidden
|
|
19
|
-
*/
|
|
20
|
-
function ignoreNextOnError() {
|
|
21
|
-
// onerror should trigger before setTimeout
|
|
22
|
-
ignoreOnError += 1;
|
|
23
|
-
setTimeout(function () {
|
|
24
|
-
ignoreOnError -= 1;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
exports.ignoreNextOnError = ignoreNextOnError;
|
|
28
|
-
/**
|
|
29
|
-
* Instruments the given function and sends an event to Sentry every time the
|
|
30
|
-
* function throws an exception.
|
|
31
|
-
*
|
|
32
|
-
* @param fn A function to wrap.
|
|
33
|
-
* @returns The wrapped function.
|
|
34
|
-
* @hidden
|
|
35
|
-
*/
|
|
36
|
-
function wrap(fn, options, before) {
|
|
37
|
-
if (options === void 0) { options = {}; }
|
|
38
|
-
// tslint:disable-next-line:strict-type-predicates
|
|
39
|
-
if (typeof fn !== 'function') {
|
|
40
|
-
return fn;
|
|
41
|
-
}
|
|
42
|
-
try {
|
|
43
|
-
// We don't wanna wrap it twice
|
|
44
|
-
if (fn.__sentry__) {
|
|
45
|
-
return fn;
|
|
46
|
-
}
|
|
47
|
-
// If this has already been wrapped in the past, return that wrapped function
|
|
48
|
-
if (fn.__sentry_wrapped__) {
|
|
49
|
-
return fn.__sentry_wrapped__;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
catch (e) {
|
|
53
|
-
// Just accessing custom props in some Selenium environments
|
|
54
|
-
// can cause a "Permission denied" exception (see raven-js#495).
|
|
55
|
-
// Bail on wrapping and return the function as-is (defers to window.onerror).
|
|
56
|
-
return fn;
|
|
57
|
-
}
|
|
58
|
-
var sentryWrapped = function () {
|
|
59
|
-
// tslint:disable-next-line:strict-type-predicates
|
|
60
|
-
if (before && typeof before === 'function') {
|
|
61
|
-
before.apply(this, arguments);
|
|
62
|
-
}
|
|
63
|
-
var args = Array.prototype.slice.call(arguments);
|
|
64
|
-
// tslint:disable:no-unsafe-any
|
|
65
|
-
try {
|
|
66
|
-
var wrappedArguments = args.map(function (arg) { return wrap(arg, options); });
|
|
67
|
-
if (fn.handleEvent) {
|
|
68
|
-
// Attempt to invoke user-land function
|
|
69
|
-
// NOTE: If you are a Sentry user, and you are seeing this stack frame, it
|
|
70
|
-
// means the sentry.javascript SDK caught an error invoking your application code. This
|
|
71
|
-
// is expected behavior and NOT indicative of a bug with sentry.javascript.
|
|
72
|
-
return fn.handleEvent.apply(this, wrappedArguments);
|
|
73
|
-
}
|
|
74
|
-
// Attempt to invoke user-land function
|
|
75
|
-
// NOTE: If you are a Sentry user, and you are seeing this stack frame, it
|
|
76
|
-
// means the sentry.javascript SDK caught an error invoking your application code. This
|
|
77
|
-
// is expected behavior and NOT indicative of a bug with sentry.javascript.
|
|
78
|
-
return fn.apply(this, wrappedArguments);
|
|
79
|
-
// tslint:enable:no-unsafe-any
|
|
80
|
-
}
|
|
81
|
-
catch (ex) {
|
|
82
|
-
ignoreNextOnError();
|
|
83
|
-
core_1.withScope(function (scope) {
|
|
84
|
-
scope.addEventProcessor(function (event) {
|
|
85
|
-
var processedEvent = tslib_1.__assign({}, event);
|
|
86
|
-
if (options.mechanism) {
|
|
87
|
-
utils_1.addExceptionTypeValue(processedEvent, undefined, undefined);
|
|
88
|
-
utils_1.addExceptionMechanism(processedEvent, options.mechanism);
|
|
89
|
-
}
|
|
90
|
-
processedEvent.extra = tslib_1.__assign(tslib_1.__assign({}, processedEvent.extra), { arguments: utils_1.normalize(args, 3) });
|
|
91
|
-
return processedEvent;
|
|
92
|
-
});
|
|
93
|
-
core_1.captureException(ex);
|
|
94
|
-
});
|
|
95
|
-
throw ex;
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
// Accessing some objects may throw
|
|
99
|
-
// ref: https://github.com/getsentry/sentry-javascript/issues/1168
|
|
100
|
-
try {
|
|
101
|
-
// tslint:disable-next-line: no-for-in
|
|
102
|
-
for (var property in fn) {
|
|
103
|
-
if (Object.prototype.hasOwnProperty.call(fn, property)) {
|
|
104
|
-
sentryWrapped[property] = fn[property];
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
catch (_oO) { } // tslint:disable-line:no-empty
|
|
109
|
-
fn.prototype = fn.prototype || {};
|
|
110
|
-
sentryWrapped.prototype = fn.prototype;
|
|
111
|
-
Object.defineProperty(fn, '__sentry_wrapped__', {
|
|
112
|
-
enumerable: false,
|
|
113
|
-
value: sentryWrapped,
|
|
114
|
-
});
|
|
115
|
-
// Signal that this function has been wrapped/filled already
|
|
116
|
-
// for both debugging and to prevent it to being wrapped/filled twice
|
|
117
|
-
Object.defineProperties(sentryWrapped, {
|
|
118
|
-
__sentry__: {
|
|
119
|
-
enumerable: false,
|
|
120
|
-
value: true,
|
|
121
|
-
},
|
|
122
|
-
__sentry_original__: {
|
|
123
|
-
enumerable: false,
|
|
124
|
-
value: fn,
|
|
125
|
-
},
|
|
126
|
-
});
|
|
127
|
-
// Restore original function name (not all browsers allow that)
|
|
128
|
-
try {
|
|
129
|
-
var descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, 'name');
|
|
130
|
-
if (descriptor.configurable) {
|
|
131
|
-
Object.defineProperty(sentryWrapped, 'name', {
|
|
132
|
-
get: function () {
|
|
133
|
-
return fn.name;
|
|
134
|
-
},
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
catch (_oO) {
|
|
139
|
-
/*no-empty*/
|
|
140
|
-
}
|
|
141
|
-
return sentryWrapped;
|
|
142
|
-
}
|
|
143
|
-
exports.wrap = wrap;
|
|
144
|
-
var debounceTimer = 0;
|
|
145
|
-
/**
|
|
146
|
-
* Wraps addEventListener to capture UI breadcrumbs
|
|
147
|
-
* @param eventName the event name (e.g. "click")
|
|
148
|
-
* @returns wrapped breadcrumb events handler
|
|
149
|
-
* @hidden
|
|
150
|
-
*/
|
|
151
|
-
function breadcrumbEventHandler(eventName, debounce) {
|
|
152
|
-
if (debounce === void 0) { debounce = false; }
|
|
153
|
-
return function (event) {
|
|
154
|
-
// reset keypress timeout; e.g. triggering a 'click' after
|
|
155
|
-
// a 'keypress' will reset the keypress debounce so that a new
|
|
156
|
-
// set of keypresses can be recorded
|
|
157
|
-
keypressTimeout = undefined;
|
|
158
|
-
// It's possible this handler might trigger multiple times for the same
|
|
159
|
-
// event (e.g. event propagation through node ancestors). Ignore if we've
|
|
160
|
-
// already captured the event.
|
|
161
|
-
// tslint:disable-next-line: strict-comparisons
|
|
162
|
-
if (!event || lastCapturedEvent === event) {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
lastCapturedEvent = event;
|
|
166
|
-
var captureBreadcrumb = function () {
|
|
167
|
-
var target;
|
|
168
|
-
// Accessing event.target can throw (see getsentry/raven-js#838, #768)
|
|
169
|
-
try {
|
|
170
|
-
target = event.target ? utils_1.htmlTreeAsString(event.target) : utils_1.htmlTreeAsString(event);
|
|
171
|
-
}
|
|
172
|
-
catch (e) {
|
|
173
|
-
target = '<unknown>';
|
|
174
|
-
}
|
|
175
|
-
if (target.length === 0) {
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
core_1.getCurrentHub().addBreadcrumb({
|
|
179
|
-
category: "ui." + eventName,
|
|
180
|
-
message: target,
|
|
181
|
-
}, {
|
|
182
|
-
event: event,
|
|
183
|
-
name: eventName,
|
|
184
|
-
});
|
|
185
|
-
};
|
|
186
|
-
if (debounceTimer) {
|
|
187
|
-
clearTimeout(debounceTimer);
|
|
188
|
-
}
|
|
189
|
-
if (debounce) {
|
|
190
|
-
debounceTimer = setTimeout(captureBreadcrumb);
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
captureBreadcrumb();
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
exports.breadcrumbEventHandler = breadcrumbEventHandler;
|
|
198
|
-
/**
|
|
199
|
-
* Wraps addEventListener to capture keypress UI events
|
|
200
|
-
* @returns wrapped keypress events handler
|
|
201
|
-
* @hidden
|
|
202
|
-
*/
|
|
203
|
-
function keypressEventHandler() {
|
|
204
|
-
// TODO: if somehow user switches keypress target before
|
|
205
|
-
// debounce timeout is triggered, we will only capture
|
|
206
|
-
// a single breadcrumb from the FIRST target (acceptable?)
|
|
207
|
-
return function (event) {
|
|
208
|
-
var target;
|
|
209
|
-
try {
|
|
210
|
-
target = event.target;
|
|
211
|
-
}
|
|
212
|
-
catch (e) {
|
|
213
|
-
// just accessing event properties can throw an exception in some rare circumstances
|
|
214
|
-
// see: https://github.com/getsentry/raven-js/issues/838
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
var tagName = target && target.tagName;
|
|
218
|
-
// only consider keypress events on actual input elements
|
|
219
|
-
// this will disregard keypresses targeting body (e.g. tabbing
|
|
220
|
-
// through elements, hotkeys, etc)
|
|
221
|
-
if (!tagName || (tagName !== 'INPUT' && tagName !== 'TEXTAREA' && !target.isContentEditable)) {
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
// record first keypress in a series, but ignore subsequent
|
|
225
|
-
// keypresses until debounce clears
|
|
226
|
-
if (!keypressTimeout) {
|
|
227
|
-
breadcrumbEventHandler('input')(event);
|
|
228
|
-
}
|
|
229
|
-
clearTimeout(keypressTimeout);
|
|
230
|
-
keypressTimeout = setTimeout(function () {
|
|
231
|
-
keypressTimeout = undefined;
|
|
232
|
-
}, debounceDuration);
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
exports.keypressEventHandler = keypressEventHandler;
|
|
236
|
-
//# sourceMappingURL=helpers.js.map
|
package/dist/helpers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;AAAA,qCAA0E;AAE1E,uCAA0G;AAE1G,IAAM,gBAAgB,GAAW,IAAI,CAAC;AACtC,IAAI,eAAmC,CAAC;AACxC,IAAI,iBAAoC,CAAC;AACzC,IAAI,aAAa,GAAW,CAAC,CAAC;AAE9B;;GAEG;AACH,SAAgB,mBAAmB;IACjC,OAAO,aAAa,GAAG,CAAC,CAAC;AAC3B,CAAC;AAFD,kDAEC;AAED;;GAEG;AACH,SAAgB,iBAAiB;IAC/B,2CAA2C;IAC3C,aAAa,IAAI,CAAC,CAAC;IACnB,UAAU,CAAC;QACT,aAAa,IAAI,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC;AAND,8CAMC;AAED;;;;;;;GAOG;AACH,SAAgB,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,kBAAkB,EAAE;YACzB,OAAO,EAAE,CAAC,kBAAkB,CAAC;SAC9B;KACF;IAAC,OAAO,CAAC,EAAE;QACV,4DAA4D;QAC5D,gEAAgE;QAChE,6EAA6E;QAC7E,OAAO,EAAE,CAAC;KACX;IAED,IAAM,aAAa,GAAoB;QACrC,kDAAkD;QAClD,IAAI,MAAM,IAAI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,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;AAnCD,oDAmCC","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"]}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Integration } from '@sentry/types';
|
|
2
|
-
/** Adds SDK info to an event. */
|
|
3
|
-
export declare class LinkedErrors implements Integration {
|
|
4
|
-
/**
|
|
5
|
-
* @inheritDoc
|
|
6
|
-
*/
|
|
7
|
-
readonly name: string;
|
|
8
|
-
/**
|
|
9
|
-
* @inheritDoc
|
|
10
|
-
*/
|
|
11
|
-
static id: string;
|
|
12
|
-
/**
|
|
13
|
-
* @inheritDoc
|
|
14
|
-
*/
|
|
15
|
-
private readonly _key;
|
|
16
|
-
/**
|
|
17
|
-
* @inheritDoc
|
|
18
|
-
*/
|
|
19
|
-
private readonly _limit;
|
|
20
|
-
/**
|
|
21
|
-
* @inheritDoc
|
|
22
|
-
*/
|
|
23
|
-
constructor(options?: {
|
|
24
|
-
key?: string;
|
|
25
|
-
limit?: number;
|
|
26
|
-
});
|
|
27
|
-
/**
|
|
28
|
-
* @inheritDoc
|
|
29
|
-
*/
|
|
30
|
-
setupOnce(): void;
|
|
31
|
-
/**
|
|
32
|
-
* @inheritDoc
|
|
33
|
-
*/
|
|
34
|
-
private _handler;
|
|
35
|
-
/**
|
|
36
|
-
* @inheritDoc
|
|
37
|
-
*/
|
|
38
|
-
private _walkErrorTree;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=linkederrors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"linkederrors.d.ts","sourceRoot":"","sources":["../../src/integrations/linkederrors.ts"],"names":[],"mappings":"AACA,OAAO,EAA8C,WAAW,EAAE,MAAM,eAAe,CAAC;AAQxF,iCAAiC;AACjC,qBAAa,YAAa,YAAW,WAAW;IAC9C;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAmB;IAE/C;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAkB;IAE1C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAE9B;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC;;OAEG;gBACgB,OAAO,GAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO;IAKjE;;OAEG;IACI,SAAS,IAAI,IAAI;IAUxB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAShB;;OAEG;IACH,OAAO,CAAC,cAAc;CAQvB"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.LinkedErrors = void 0;
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
|
-
var core_1 = require("@sentry/core");
|
|
5
|
-
var parsers_1 = require("../parsers");
|
|
6
|
-
var tracekit_1 = require("../tracekit");
|
|
7
|
-
var DEFAULT_KEY = 'cause';
|
|
8
|
-
var DEFAULT_LIMIT = 5;
|
|
9
|
-
/** Adds SDK info to an event. */
|
|
10
|
-
var LinkedErrors = /** @class */ (function () {
|
|
11
|
-
/**
|
|
12
|
-
* @inheritDoc
|
|
13
|
-
*/
|
|
14
|
-
function LinkedErrors(options) {
|
|
15
|
-
if (options === void 0) { options = {}; }
|
|
16
|
-
/**
|
|
17
|
-
* @inheritDoc
|
|
18
|
-
*/
|
|
19
|
-
this.name = LinkedErrors.id;
|
|
20
|
-
this._key = options.key || DEFAULT_KEY;
|
|
21
|
-
this._limit = options.limit || DEFAULT_LIMIT;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* @inheritDoc
|
|
25
|
-
*/
|
|
26
|
-
LinkedErrors.prototype.setupOnce = function () {
|
|
27
|
-
core_1.addGlobalEventProcessor(function (event, hint) {
|
|
28
|
-
var self = core_1.getCurrentHub().getIntegration(LinkedErrors);
|
|
29
|
-
if (self) {
|
|
30
|
-
return self._handler(event, hint);
|
|
31
|
-
}
|
|
32
|
-
return event;
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* @inheritDoc
|
|
37
|
-
*/
|
|
38
|
-
LinkedErrors.prototype._handler = function (event, hint) {
|
|
39
|
-
if (!event.exception || !event.exception.values || !hint || !(hint.originalException instanceof Error)) {
|
|
40
|
-
return event;
|
|
41
|
-
}
|
|
42
|
-
var linkedErrors = this._walkErrorTree(hint.originalException, this._key);
|
|
43
|
-
event.exception.values = tslib_1.__spread(linkedErrors, event.exception.values);
|
|
44
|
-
return event;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* @inheritDoc
|
|
48
|
-
*/
|
|
49
|
-
LinkedErrors.prototype._walkErrorTree = function (error, key, stack) {
|
|
50
|
-
if (stack === void 0) { stack = []; }
|
|
51
|
-
if (!(error[key] instanceof Error) || stack.length + 1 >= this._limit) {
|
|
52
|
-
return stack;
|
|
53
|
-
}
|
|
54
|
-
var stacktrace = tracekit_1.computeStackTrace(error[key]);
|
|
55
|
-
var exception = parsers_1.exceptionFromStacktrace(stacktrace);
|
|
56
|
-
return this._walkErrorTree(error[key], key, tslib_1.__spread([exception], stack));
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* @inheritDoc
|
|
60
|
-
*/
|
|
61
|
-
LinkedErrors.id = 'LinkedErrors';
|
|
62
|
-
return LinkedErrors;
|
|
63
|
-
}());
|
|
64
|
-
exports.LinkedErrors = LinkedErrors;
|
|
65
|
-
//# sourceMappingURL=linkederrors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"linkederrors.js","sourceRoot":"","sources":["../../src/integrations/linkederrors.ts"],"names":[],"mappings":";;;AAAA,qCAAsE;AAGtE,sCAAqD;AACrD,wCAAgD;AAEhD,IAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,IAAM,aAAa,GAAG,CAAC,CAAC;AAExB,iCAAiC;AACjC;IAqBE;;OAEG;IACH,sBAAmB,OAA8C;QAA9C,wBAAA,EAAA,YAA8C;QAvBjE;;WAEG;QACa,SAAI,GAAW,YAAY,CAAC,EAAE,CAAC;QAqB7C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,IAAI,WAAW,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,aAAa,CAAC;IAC/C,CAAC;IAED;;OAEG;IACI,gCAAS,GAAhB;QACE,8BAAuB,CAAC,UAAC,KAAY,EAAE,IAAgB;YACrD,IAAM,IAAI,GAAG,oBAAa,EAAE,CAAC,cAAc,CAAC,YAAY,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jED,IAiEC;AAjEY,oCAAY","sourcesContent":["import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core';\nimport { Event, EventHint, Exception, ExtendedError, Integration } from '@sentry/types';\n\nimport { exceptionFromStacktrace } from '../parsers';\nimport { computeStackTrace } from '../tracekit';\n\nconst DEFAULT_KEY = 'cause';\nconst DEFAULT_LIMIT = 5;\n\n/** Adds SDK info to an event. */\nexport class LinkedErrors implements Integration {\n /**\n * @inheritDoc\n */\n public readonly name: string = LinkedErrors.id;\n\n /**\n * @inheritDoc\n */\n public static id: string = 'LinkedErrors';\n\n /**\n * @inheritDoc\n */\n private readonly _key: string;\n\n /**\n * @inheritDoc\n */\n private readonly _limit: number;\n\n /**\n * @inheritDoc\n */\n public constructor(options: { key?: string; limit?: number } = {}) {\n this._key = options.key || DEFAULT_KEY;\n this._limit = options.limit || DEFAULT_LIMIT;\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor((event: Event, hint?: EventHint) => {\n const self = getCurrentHub().getIntegration(LinkedErrors);\n if (self) {\n return self._handler(event, hint);\n }\n return event;\n });\n }\n\n /**\n * @inheritDoc\n */\n private _handler(event: Event, hint?: EventHint): Event | null {\n if (!event.exception || !event.exception.values || !hint || !(hint.originalException instanceof Error)) {\n return event;\n }\n const linkedErrors = this._walkErrorTree(hint.originalException, this._key);\n event.exception.values = [...linkedErrors, ...event.exception.values];\n return event;\n }\n\n /**\n * @inheritDoc\n */\n private _walkErrorTree(error: ExtendedError, key: string, stack: Exception[] = []): Exception[] {\n if (!(error[key] instanceof Error) || stack.length + 1 >= this._limit) {\n return stack;\n }\n const stacktrace = computeStackTrace(error[key]);\n const exception = exceptionFromStacktrace(stacktrace);\n return this._walkErrorTree(error[key], key, [exception, ...stack]);\n }\n}\n"]}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Integration } from "@sentry/types";
|
|
2
|
-
/** Wrap timer functions and event targets to catch errors and provide better meta data */
|
|
3
|
-
export declare class TryCatch implements Integration {
|
|
4
|
-
/** JSDoc */
|
|
5
|
-
private _ignoreOnError;
|
|
6
|
-
/**
|
|
7
|
-
* @inheritDoc
|
|
8
|
-
*/
|
|
9
|
-
name: string;
|
|
10
|
-
/**
|
|
11
|
-
* @inheritDoc
|
|
12
|
-
*/
|
|
13
|
-
static id: string;
|
|
14
|
-
/** JSDoc */
|
|
15
|
-
private _wrapTimeFunction;
|
|
16
|
-
/** JSDoc */
|
|
17
|
-
private _wrapRAF;
|
|
18
|
-
/** JSDoc */
|
|
19
|
-
private _wrapEventTarget;
|
|
20
|
-
/**
|
|
21
|
-
* Wrap timer functions and event targets to catch errors
|
|
22
|
-
* and provide better metadata.
|
|
23
|
-
*/
|
|
24
|
-
setupOnce(): void;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=trycatch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trycatch.d.ts","sourceRoot":"","sources":["../../src/integrations/trycatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAmB,MAAM,eAAe,CAAC;AAK7D,0FAA0F;AAC1F,qBAAa,QAAS,YAAW,WAAW;IAC1C,YAAY;IACZ,OAAO,CAAC,cAAc,CAAa;IAEnC;;OAEG;IACI,IAAI,EAAE,MAAM,CAAe;IAElC;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAc;IAEtC,YAAY;IACZ,OAAO,CAAC,iBAAiB;IAczB,YAAY;IACZ,OAAO,CAAC,QAAQ;IAiBhB,YAAY;IACZ,OAAO,CAAC,gBAAgB;IA6FxB;;;OAGG;IACI,SAAS,IAAI,IAAI;CAyCzB"}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.TryCatch = void 0;
|
|
3
|
-
var utils_1 = require("@sentry/utils");
|
|
4
|
-
var helpers_1 = require("../helpers");
|
|
5
|
-
/** Wrap timer functions and event targets to catch errors and provide better meta data */
|
|
6
|
-
var TryCatch = /** @class */ (function () {
|
|
7
|
-
function TryCatch() {
|
|
8
|
-
/** JSDoc */
|
|
9
|
-
this._ignoreOnError = 0;
|
|
10
|
-
/**
|
|
11
|
-
* @inheritDoc
|
|
12
|
-
*/
|
|
13
|
-
this.name = TryCatch.id;
|
|
14
|
-
}
|
|
15
|
-
/** JSDoc */
|
|
16
|
-
TryCatch.prototype._wrapTimeFunction = function (original) {
|
|
17
|
-
return function () {
|
|
18
|
-
var args = [];
|
|
19
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
20
|
-
args[_i] = arguments[_i];
|
|
21
|
-
}
|
|
22
|
-
var originalCallback = args[0];
|
|
23
|
-
args[0] = helpers_1.wrap(originalCallback, {
|
|
24
|
-
mechanism: {
|
|
25
|
-
data: { function: getFunctionName(original) },
|
|
26
|
-
handled: true,
|
|
27
|
-
type: "instrument"
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
return original.apply(this, args);
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
/** JSDoc */
|
|
34
|
-
TryCatch.prototype._wrapRAF = function (original) {
|
|
35
|
-
return function (callback) {
|
|
36
|
-
return original(helpers_1.wrap(callback, {
|
|
37
|
-
mechanism: {
|
|
38
|
-
data: {
|
|
39
|
-
function: "requestAnimationFrame",
|
|
40
|
-
handler: getFunctionName(original)
|
|
41
|
-
},
|
|
42
|
-
handled: true,
|
|
43
|
-
type: "instrument"
|
|
44
|
-
}
|
|
45
|
-
}));
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
/** JSDoc */
|
|
49
|
-
TryCatch.prototype._wrapEventTarget = function (target) {
|
|
50
|
-
var global = utils_1.getGlobalObject();
|
|
51
|
-
var proto = global[target] && global[target].prototype;
|
|
52
|
-
if (!proto ||
|
|
53
|
-
!proto.hasOwnProperty ||
|
|
54
|
-
!proto.hasOwnProperty("addEventListener")) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
utils_1.fill(proto, "addEventListener", function (original) {
|
|
58
|
-
return function (eventName, fn, options) {
|
|
59
|
-
try {
|
|
60
|
-
// tslint:disable-next-line:no-unbound-method strict-type-predicates
|
|
61
|
-
if (typeof fn.handleEvent === "function") {
|
|
62
|
-
fn.handleEvent = helpers_1.wrap(fn.handleEvent.bind(fn), {
|
|
63
|
-
mechanism: {
|
|
64
|
-
data: {
|
|
65
|
-
function: "handleEvent",
|
|
66
|
-
handler: getFunctionName(fn),
|
|
67
|
-
target: target
|
|
68
|
-
},
|
|
69
|
-
handled: true,
|
|
70
|
-
type: "instrument"
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
catch (err) {
|
|
76
|
-
// can sometimes get 'Permission denied to access property "handle Event'
|
|
77
|
-
}
|
|
78
|
-
return original.call(this, eventName, helpers_1.wrap(fn, {
|
|
79
|
-
mechanism: {
|
|
80
|
-
data: {
|
|
81
|
-
function: "addEventListener",
|
|
82
|
-
handler: getFunctionName(fn),
|
|
83
|
-
target: target
|
|
84
|
-
},
|
|
85
|
-
handled: true,
|
|
86
|
-
type: "instrument"
|
|
87
|
-
}
|
|
88
|
-
}), options);
|
|
89
|
-
};
|
|
90
|
-
});
|
|
91
|
-
utils_1.fill(proto, "removeEventListener", function (original) {
|
|
92
|
-
return function (eventName, fn, options) {
|
|
93
|
-
var callback = fn;
|
|
94
|
-
try {
|
|
95
|
-
callback = callback && (callback.__sentry_wrapped__ || callback);
|
|
96
|
-
}
|
|
97
|
-
catch (e) {
|
|
98
|
-
// ignore, accessing __sentry_wrapped__ will throw in some Selenium environments
|
|
99
|
-
}
|
|
100
|
-
return original.call(this, eventName, callback, options);
|
|
101
|
-
};
|
|
102
|
-
});
|
|
103
|
-
};
|
|
104
|
-
/**
|
|
105
|
-
* Wrap timer functions and event targets to catch errors
|
|
106
|
-
* and provide better metadata.
|
|
107
|
-
*/
|
|
108
|
-
TryCatch.prototype.setupOnce = function () {
|
|
109
|
-
this._ignoreOnError = this._ignoreOnError;
|
|
110
|
-
var global = utils_1.getGlobalObject();
|
|
111
|
-
utils_1.fill(global, "setTimeout", this._wrapTimeFunction.bind(this));
|
|
112
|
-
utils_1.fill(global, "setInterval", this._wrapTimeFunction.bind(this));
|
|
113
|
-
utils_1.fill(global, "requestAnimationFrame", this._wrapRAF.bind(this));
|
|
114
|
-
[
|
|
115
|
-
"EventTarget",
|
|
116
|
-
"Window",
|
|
117
|
-
"Node",
|
|
118
|
-
"ApplicationCache",
|
|
119
|
-
"AudioTrackList",
|
|
120
|
-
"ChannelMergerNode",
|
|
121
|
-
"CryptoOperation",
|
|
122
|
-
"EventSource",
|
|
123
|
-
"FileReader",
|
|
124
|
-
"HTMLUnknownElement",
|
|
125
|
-
"IDBDatabase",
|
|
126
|
-
"IDBRequest",
|
|
127
|
-
"IDBTransaction",
|
|
128
|
-
"KeyOperation",
|
|
129
|
-
"MediaController",
|
|
130
|
-
"MessagePort",
|
|
131
|
-
"ModalWindow",
|
|
132
|
-
"Notification",
|
|
133
|
-
"SVGElementInstance",
|
|
134
|
-
"Screen",
|
|
135
|
-
"TextTrack",
|
|
136
|
-
"TextTrackCue",
|
|
137
|
-
"TextTrackList",
|
|
138
|
-
"WebSocket",
|
|
139
|
-
"WebSocketWorker",
|
|
140
|
-
"Worker",
|
|
141
|
-
"XMLHttpRequest",
|
|
142
|
-
"XMLHttpRequestEventTarget",
|
|
143
|
-
"XMLHttpRequestUpload"
|
|
144
|
-
].forEach(this._wrapEventTarget.bind(this));
|
|
145
|
-
};
|
|
146
|
-
/**
|
|
147
|
-
* @inheritDoc
|
|
148
|
-
*/
|
|
149
|
-
TryCatch.id = "TryCatch";
|
|
150
|
-
return TryCatch;
|
|
151
|
-
}());
|
|
152
|
-
exports.TryCatch = TryCatch;
|
|
153
|
-
/**
|
|
154
|
-
* Safely extract function name from itself
|
|
155
|
-
*/
|
|
156
|
-
function getFunctionName(fn) {
|
|
157
|
-
try {
|
|
158
|
-
return (fn && fn.name) || "<anonymous>";
|
|
159
|
-
}
|
|
160
|
-
catch (e) {
|
|
161
|
-
// Just accessing custom props in some Selenium environments
|
|
162
|
-
// can cause a "Permission denied" exception (see raven-js#495).
|
|
163
|
-
return "<anonymous>";
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
//# sourceMappingURL=trycatch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trycatch.js","sourceRoot":"","sources":["../../src/integrations/trycatch.ts"],"names":[],"mappings":";;AACA,uCAAsD;AAEtD,sCAAkC;AAElC,0FAA0F;AAC1F;IAAA;QACE,YAAY;QACJ,mBAAc,GAAW,CAAC,CAAC;QAEnC;;WAEG;QACI,SAAI,GAAW,QAAQ,CAAC,EAAE,CAAC;IAmLpC,CAAC;IA5KC,YAAY;IACJ,oCAAiB,GAAzB,UAA0B,QAAoB;QAC5C,OAAO;YAAoB,cAAc;iBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;gBAAd,yBAAc;;YACvC,IAAM,gBAAgB,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACjC,IAAI,CAAC,CAAC,CAAC,GAAG,cAAI,CAAC,gBAAgB,EAAE;gBAC/B,SAAS,EAAE;oBACT,IAAI,EAAE,EAAE,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC,EAAE;oBAC7C,OAAO,EAAE,IAAI;oBACb,IAAI,EAAE,YAAY;iBACnB;aACF,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACpC,CAAC,CAAC;IACJ,CAAC;IAED,YAAY;IACJ,2BAAQ,GAAhB,UAAiB,QAAa;QAC5B,OAAO,UAAoB,QAAoB;YAC7C,OAAO,QAAQ,CACb,cAAI,CAAC,QAAQ,EAAE;gBACb,SAAS,EAAE;oBACT,IAAI,EAAE;wBACJ,QAAQ,EAAE,uBAAuB;wBACjC,OAAO,EAAE,eAAe,CAAC,QAAQ,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aAAa;YACb,cAAc;YACd,oBAAoB;YACpB,QAAQ;YACR,WAAW;YACX,cAAc;YACd,eAAe;YACf,WAAW;YACX,iBAAiB;YACjB,QAAQ;YACR,gBAAgB;YAChB,2BAA2B;YAC3B,sBAAsB;SACvB,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;IAhLD;;OAEG;IACW,WAAE,GAAW,UAAU,CAAC;IA8KxC,eAAC;CAAA,AA1LD,IA0LC;AA1LY,4BAAQ;AA4LrB;;GAEG;AACH,SAAS,eAAe,CAAC,EAAO;IAC9B,IAAI;QACF,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC;KACzC;IAAC,OAAO,CAAC,EAAE;QACV,4DAA4D;QAC5D,gEAAgE;QAChE,OAAO,aAAa,CAAC;KACtB;AACH,CAAC","sourcesContent":["import { Integration, WrappedFunction } from \"@sentry/types\";\nimport { fill, getGlobalObject } from \"@sentry/utils\";\n\nimport { wrap } from \"../helpers\";\n\n/** Wrap timer functions and event targets to catch errors and provide better meta data */\nexport class TryCatch implements Integration {\n /** JSDoc */\n private _ignoreOnError: number = 0;\n\n /**\n * @inheritDoc\n */\n public name: string = TryCatch.id;\n\n /**\n * @inheritDoc\n */\n public static id: string = \"TryCatch\";\n\n /** JSDoc */\n private _wrapTimeFunction(original: () => void): () => number {\n return function(this: any, ...args: any[]): number {\n const originalCallback = args[0];\n args[0] = wrap(originalCallback, {\n mechanism: {\n data: { function: getFunctionName(original) },\n handled: true,\n type: \"instrument\"\n }\n });\n return original.apply(this, args);\n };\n }\n\n /** JSDoc */\n private _wrapRAF(original: any): (callback: () => void) => any {\n return function(this: any, callback: () => void): () => void {\n return original(\n wrap(callback, {\n mechanism: {\n data: {\n function: \"requestAnimationFrame\",\n handler: getFunctionName(original)\n },\n handled: true,\n type: \"instrument\"\n }\n })\n );\n };\n }\n\n /** JSDoc */\n private _wrapEventTarget(target: string): void {\n const global = getGlobalObject() as { [key: string]: any };\n const proto = global[target] && global[target].prototype;\n\n if (\n !proto ||\n !proto.hasOwnProperty ||\n !proto.hasOwnProperty(\"addEventListener\")\n ) {\n return;\n }\n\n fill(proto, \"addEventListener\", function(\n original: () => void\n ): (\n eventName: string,\n fn: EventListenerObject,\n options?: boolean | AddEventListenerOptions\n ) => void {\n return function(\n this: any,\n eventName: string,\n fn: EventListenerObject,\n options?: boolean | AddEventListenerOptions\n ): (\n eventName: string,\n fn: EventListenerObject,\n capture?: boolean,\n secure?: boolean\n ) => void {\n try {\n // tslint:disable-next-line:no-unbound-method strict-type-predicates\n if (typeof fn.handleEvent === \"function\") {\n fn.handleEvent = wrap(fn.handleEvent.bind(fn), {\n mechanism: {\n data: {\n function: \"handleEvent\",\n handler: getFunctionName(fn),\n target\n },\n handled: true,\n type: \"instrument\"\n }\n });\n }\n } catch (err) {\n // can sometimes get 'Permission denied to access property \"handle Event'\n }\n\n return original.call(\n this,\n eventName,\n wrap((fn as any) as WrappedFunction, {\n mechanism: {\n data: {\n function: \"addEventListener\",\n handler: getFunctionName(fn),\n target\n },\n handled: true,\n type: \"instrument\"\n }\n }),\n options\n );\n };\n });\n\n fill(proto, \"removeEventListener\", function(\n original: () => void\n ): (\n this: any,\n eventName: string,\n fn: EventListenerObject,\n options?: boolean | EventListenerOptions\n ) => () => void {\n return function(\n this: any,\n eventName: string,\n fn: EventListenerObject,\n options?: boolean | EventListenerOptions\n ): () => void {\n let callback = (fn as any) as WrappedFunction;\n try {\n callback = callback && (callback.__sentry_wrapped__ || callback);\n } catch (e) {\n // ignore, accessing __sentry_wrapped__ will throw in some Selenium environments\n }\n return original.call(this, eventName, callback, options);\n };\n });\n }\n\n /**\n * Wrap timer functions and event targets to catch errors\n * and provide better metadata.\n */\n public setupOnce(): void {\n this._ignoreOnError = this._ignoreOnError;\n\n const global = getGlobalObject();\n\n fill(global, \"setTimeout\", this._wrapTimeFunction.bind(this));\n fill(global, \"setInterval\", this._wrapTimeFunction.bind(this));\n fill(global, \"requestAnimationFrame\", this._wrapRAF.bind(this));\n\n [\n \"EventTarget\",\n \"Window\",\n \"Node\",\n \"ApplicationCache\",\n \"AudioTrackList\",\n \"ChannelMergerNode\",\n \"CryptoOperation\",\n \"EventSource\",\n \"FileReader\",\n \"HTMLUnknownElement\",\n \"IDBDatabase\",\n \"IDBRequest\",\n \"IDBTransaction\",\n \"KeyOperation\",\n \"MediaController\",\n \"MessagePort\",\n \"ModalWindow\",\n \"Notification\",\n \"SVGElementInstance\",\n \"Screen\",\n \"TextTrack\",\n \"TextTrackCue\",\n \"TextTrackList\",\n \"WebSocket\",\n \"WebSocketWorker\",\n \"Worker\",\n \"XMLHttpRequest\",\n \"XMLHttpRequestEventTarget\",\n \"XMLHttpRequestUpload\"\n ].forEach(this._wrapEventTarget.bind(this));\n }\n}\n\n/**\n * Safely extract function name from itself\n */\nfunction getFunctionName(fn: any): string {\n try {\n return (fn && fn.name) || \"<anonymous>\";\n } catch (e) {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n return \"<anonymous>\";\n }\n}\n"]}
|
package/dist/package.json
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "sentry-uniapp",
|
|
3
|
-
"version": "1.0.12",
|
|
4
|
-
"description": "用于Uniapp/小程序/快应用等平台的 Sentry SDK",
|
|
5
|
-
"repository": "git://github.com/uappkit/sentry-uniapp.git",
|
|
6
|
-
"homepage": "https://github.com/uappkit/sentry-uniapp",
|
|
7
|
-
"miniprogram": "dist",
|
|
8
|
-
"main": "dist/index.js",
|
|
9
|
-
"module": "esm/index.js",
|
|
10
|
-
"types": "dist/index.d.ts",
|
|
11
|
-
"scripts": {
|
|
12
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
13
|
-
"build": "npm-run-all --parallel build:min build:esm build:ts version",
|
|
14
|
-
"build:dist": "npm-run-all --parallel build:min",
|
|
15
|
-
"build:min": "webpack --config ./webpack.config.min.js",
|
|
16
|
-
"build:watch": "webpack --watch --config ./webpack.config.min.js",
|
|
17
|
-
"build:ts": "tsc -p tsconfig.json",
|
|
18
|
-
"build:esm": "tsc -p tsconfig.esm.json",
|
|
19
|
-
"version": "node ./scripts/versionbump.js src/version.ts"
|
|
20
|
-
},
|
|
21
|
-
"keywords": [
|
|
22
|
-
"sentry",
|
|
23
|
-
"uniapp",
|
|
24
|
-
"uniapp sentry"
|
|
25
|
-
],
|
|
26
|
-
"author": "yinqisen@gmail.com",
|
|
27
|
-
"license": "BSD-3-Clause",
|
|
28
|
-
"engines": {
|
|
29
|
-
"node": ">=14"
|
|
30
|
-
},
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"@sentry/typescript": "^5.20.0",
|
|
33
|
-
"@types/node": "^12.7.1",
|
|
34
|
-
"install": "^0.13.0",
|
|
35
|
-
"miniprogram-api-typings": "^2.7.7-2",
|
|
36
|
-
"npm": "^6.11.1",
|
|
37
|
-
"npm-run-all": "^4.1.5",
|
|
38
|
-
"replace-in-file": "^4.1.3",
|
|
39
|
-
"ts-loader": "^6.0.4",
|
|
40
|
-
"tslint": "^5.16.0",
|
|
41
|
-
"typescript": "^3.5.3",
|
|
42
|
-
"webpack": "^5.90.3",
|
|
43
|
-
"webpack-cli": "^5.1.4",
|
|
44
|
-
"webpack-merge": "^4.2.1"
|
|
45
|
-
},
|
|
46
|
-
"dependencies": {
|
|
47
|
-
"@sentry/core": "6.19.7",
|
|
48
|
-
"@sentry/types": "6.19.7",
|
|
49
|
-
"@sentry/utils": "6.19.7",
|
|
50
|
-
"tslib": "^1.10.0"
|
|
51
|
-
}
|
|
52
|
-
}
|