@posthog/core 1.0.2 → 1.2.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/dist/error-tracking/chunk-ids.d.ts +5 -0
- package/dist/error-tracking/chunk-ids.d.ts.map +1 -0
- package/dist/error-tracking/chunk-ids.js +68 -0
- package/dist/error-tracking/chunk-ids.mjs +34 -0
- package/dist/error-tracking/coercers/dom-exception-coercer.d.ts +10 -0
- package/dist/error-tracking/coercers/dom-exception-coercer.d.ts.map +1 -0
- package/dist/error-tracking/coercers/dom-exception-coercer.js +65 -0
- package/dist/error-tracking/coercers/dom-exception-coercer.mjs +31 -0
- package/dist/error-tracking/coercers/error-coercer.d.ts +9 -0
- package/dist/error-tracking/coercers/error-coercer.d.ts.map +1 -0
- package/dist/error-tracking/coercers/error-coercer.js +61 -0
- package/dist/error-tracking/coercers/error-coercer.mjs +27 -0
- package/dist/error-tracking/coercers/error-event-coercer.d.ts +7 -0
- package/dist/error-tracking/coercers/error-event-coercer.d.ts.map +1 -0
- package/dist/error-tracking/coercers/error-event-coercer.js +52 -0
- package/dist/error-tracking/coercers/error-event-coercer.mjs +18 -0
- package/dist/error-tracking/coercers/event-coercer.d.ts +6 -0
- package/dist/error-tracking/coercers/event-coercer.d.ts.map +1 -0
- package/dist/error-tracking/coercers/event-coercer.js +51 -0
- package/dist/error-tracking/coercers/event-coercer.mjs +17 -0
- package/dist/error-tracking/coercers/index.d.ts +9 -0
- package/dist/error-tracking/coercers/index.d.ts.map +1 -0
- package/dist/error-tracking/coercers/index.js +123 -0
- package/dist/error-tracking/coercers/index.mjs +8 -0
- package/dist/error-tracking/coercers/object-coercer.d.ts +14 -0
- package/dist/error-tracking/coercers/object-coercer.d.ts.map +1 -0
- package/dist/error-tracking/coercers/object-coercer.js +85 -0
- package/dist/error-tracking/coercers/object-coercer.mjs +51 -0
- package/dist/error-tracking/coercers/primitive-coercer.d.ts +7 -0
- package/dist/error-tracking/coercers/primitive-coercer.d.ts.map +1 -0
- package/dist/error-tracking/coercers/primitive-coercer.js +49 -0
- package/dist/error-tracking/coercers/primitive-coercer.mjs +15 -0
- package/dist/error-tracking/coercers/promise-rejection-event.d.ts +7 -0
- package/dist/error-tracking/coercers/promise-rejection-event.d.ts.map +1 -0
- package/dist/error-tracking/coercers/promise-rejection-event.js +59 -0
- package/dist/error-tracking/coercers/promise-rejection-event.mjs +25 -0
- package/dist/error-tracking/coercers/string-coercer.d.ts +7 -0
- package/dist/error-tracking/coercers/string-coercer.d.ts.map +1 -0
- package/dist/error-tracking/coercers/string-coercer.js +63 -0
- package/dist/error-tracking/coercers/string-coercer.mjs +29 -0
- package/dist/error-tracking/coercers/utils.d.ts +8 -0
- package/dist/error-tracking/coercers/utils.d.ts.map +1 -0
- package/dist/error-tracking/coercers/utils.js +55 -0
- package/dist/error-tracking/coercers/utils.mjs +18 -0
- package/dist/error-tracking/error-properties-builder.d.ts +18 -0
- package/dist/error-tracking/error-properties-builder.d.ts.map +1 -0
- package/dist/error-tracking/error-properties-builder.js +152 -0
- package/dist/error-tracking/error-properties-builder.mjs +118 -0
- package/dist/error-tracking/index.d.ts +6 -0
- package/dist/error-tracking/index.d.ts.map +1 -0
- package/dist/error-tracking/index.js +87 -0
- package/dist/error-tracking/index.mjs +4 -0
- package/dist/error-tracking/parsers/base.d.ts +9 -0
- package/dist/error-tracking/parsers/base.d.ts.map +1 -0
- package/dist/error-tracking/parsers/base.js +71 -0
- package/dist/error-tracking/parsers/base.mjs +19 -0
- package/dist/error-tracking/parsers/chrome.d.ts +3 -0
- package/dist/error-tracking/parsers/chrome.d.ts.map +1 -0
- package/dist/error-tracking/parsers/chrome.js +61 -0
- package/dist/error-tracking/parsers/chrome.mjs +27 -0
- package/dist/error-tracking/parsers/gecko.d.ts +3 -0
- package/dist/error-tracking/parsers/gecko.d.ts.map +1 -0
- package/dist/error-tracking/parsers/gecko.js +58 -0
- package/dist/error-tracking/parsers/gecko.mjs +24 -0
- package/dist/error-tracking/parsers/index.d.ts +9 -0
- package/dist/error-tracking/parsers/index.d.ts.map +1 -0
- package/dist/error-tracking/parsers/index.js +99 -0
- package/dist/error-tracking/parsers/index.mjs +44 -0
- package/dist/error-tracking/parsers/node.d.ts +3 -0
- package/dist/error-tracking/parsers/node.d.ts.map +1 -0
- package/dist/error-tracking/parsers/node.js +99 -0
- package/dist/error-tracking/parsers/node.mjs +65 -0
- package/dist/error-tracking/parsers/opera.d.ts +4 -0
- package/dist/error-tracking/parsers/opera.d.ts.map +1 -0
- package/dist/error-tracking/parsers/opera.js +49 -0
- package/dist/error-tracking/parsers/opera.mjs +12 -0
- package/dist/error-tracking/parsers/react-native.d.ts +1 -0
- package/dist/error-tracking/parsers/react-native.d.ts.map +1 -0
- package/dist/error-tracking/parsers/react-native.js +5 -0
- package/dist/error-tracking/parsers/react-native.mjs +0 -0
- package/dist/error-tracking/parsers/safari.d.ts +22 -0
- package/dist/error-tracking/parsers/safari.d.ts.map +1 -0
- package/dist/error-tracking/parsers/safari.js +47 -0
- package/dist/error-tracking/parsers/safari.mjs +13 -0
- package/dist/error-tracking/parsers/winjs.d.ts +3 -0
- package/dist/error-tracking/parsers/winjs.d.ts.map +1 -0
- package/dist/error-tracking/parsers/winjs.js +41 -0
- package/dist/error-tracking/parsers/winjs.mjs +7 -0
- package/dist/error-tracking/types.d.ts +87 -0
- package/dist/error-tracking/types.d.ts.map +1 -0
- package/dist/error-tracking/types.js +43 -0
- package/dist/error-tracking/types.mjs +9 -0
- package/dist/error-tracking/utils.d.ts +13 -0
- package/dist/error-tracking/utils.d.ts.map +1 -0
- package/dist/error-tracking/utils.js +57 -0
- package/dist/error-tracking/utils.mjs +23 -0
- package/dist/eventemitter.js +4 -4
- package/dist/eventemitter.mjs +4 -4
- package/dist/featureFlagUtils.js +20 -45
- package/dist/featureFlagUtils.mjs +20 -45
- package/dist/gzip.js +1 -2
- package/dist/gzip.mjs +1 -2
- package/dist/index.d.ts +5 -255
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -1223
- package/dist/index.mjs +6 -1190
- package/dist/posthog-core-stateless.d.ts +204 -0
- package/dist/posthog-core-stateless.d.ts.map +1 -0
- package/dist/posthog-core-stateless.js +675 -0
- package/dist/posthog-core-stateless.mjs +632 -0
- package/dist/posthog-core.d.ts +171 -0
- package/dist/posthog-core.d.ts.map +1 -0
- package/dist/posthog-core.js +554 -0
- package/dist/posthog-core.mjs +520 -0
- package/dist/testing/PostHogCoreTestClient.d.ts +2 -1
- package/dist/testing/PostHogCoreTestClient.d.ts.map +1 -1
- package/dist/testing/PostHogCoreTestClient.js +9 -11
- package/dist/testing/PostHogCoreTestClient.mjs +8 -10
- package/dist/testing/test-utils.d.ts +2 -0
- package/dist/testing/test-utils.d.ts.map +1 -1
- package/dist/testing/test-utils.js +13 -1
- package/dist/testing/test-utils.mjs +11 -2
- package/dist/utils/bucketed-rate-limiter.d.ts.map +1 -1
- package/dist/utils/bucketed-rate-limiter.js +8 -12
- package/dist/utils/bucketed-rate-limiter.mjs +8 -12
- package/dist/utils/index.js +3 -3
- package/dist/utils/index.mjs +3 -3
- package/dist/utils/number-utils.d.ts.map +1 -1
- package/dist/utils/type-utils.d.ts +8 -1
- package/dist/utils/type-utils.d.ts.map +1 -1
- package/dist/utils/type-utils.js +61 -6
- package/dist/utils/type-utils.mjs +36 -2
- package/dist/vendor/uuidv7.js +12 -16
- package/dist/vendor/uuidv7.mjs +12 -16
- package/package.json +10 -4
- package/src/__tests__/featureFlagUtils.spec.ts +427 -0
- package/src/__tests__/gzip.spec.ts +69 -0
- package/src/__tests__/posthog.ai.spec.ts +110 -0
- package/src/__tests__/posthog.capture.spec.ts +91 -0
- package/src/__tests__/posthog.core.spec.ts +135 -0
- package/src/__tests__/posthog.debug.spec.ts +36 -0
- package/src/__tests__/posthog.enqueue.spec.ts +93 -0
- package/src/__tests__/posthog.featureflags.spec.ts +1106 -0
- package/src/__tests__/posthog.featureflags.v1.spec.ts +922 -0
- package/src/__tests__/posthog.flush.spec.ts +237 -0
- package/src/__tests__/posthog.gdpr.spec.ts +50 -0
- package/src/__tests__/posthog.groups.spec.ts +96 -0
- package/src/__tests__/posthog.identify.spec.ts +194 -0
- package/src/__tests__/posthog.init.spec.ts +110 -0
- package/src/__tests__/posthog.listeners.spec.ts +51 -0
- package/src/__tests__/posthog.register.spec.ts +47 -0
- package/src/__tests__/posthog.reset.spec.ts +76 -0
- package/src/__tests__/posthog.sessions.spec.ts +63 -0
- package/src/__tests__/posthog.setProperties.spec.ts +102 -0
- package/src/__tests__/posthog.shutdown.spec.ts +88 -0
- package/src/__tests__/utils.spec.ts +36 -0
- package/src/error-tracking/chunk-ids.ts +58 -0
- package/src/error-tracking/coercers/dom-exception-coercer.ts +38 -0
- package/src/error-tracking/coercers/error-coercer.ts +36 -0
- package/src/error-tracking/coercers/error-event-coercer.ts +24 -0
- package/src/error-tracking/coercers/event-coercer.ts +19 -0
- package/src/error-tracking/coercers/index.ts +8 -0
- package/src/error-tracking/coercers/object-coercer.ts +76 -0
- package/src/error-tracking/coercers/primitive-coercer.ts +19 -0
- package/src/error-tracking/coercers/promise-rejection-event.spec.ts +77 -0
- package/src/error-tracking/coercers/promise-rejection-event.ts +53 -0
- package/src/error-tracking/coercers/string-coercer.spec.ts +26 -0
- package/src/error-tracking/coercers/string-coercer.ts +31 -0
- package/src/error-tracking/coercers/utils.ts +33 -0
- package/src/error-tracking/error-properties-builder.coerce.spec.ts +202 -0
- package/src/error-tracking/error-properties-builder.parse.spec.ts +30 -0
- package/src/error-tracking/error-properties-builder.ts +169 -0
- package/src/error-tracking/index.ts +5 -0
- package/src/error-tracking/parsers/base.ts +29 -0
- package/src/error-tracking/parsers/chrome.ts +53 -0
- package/src/error-tracking/parsers/gecko.ts +38 -0
- package/src/error-tracking/parsers/index.ts +104 -0
- package/src/error-tracking/parsers/node.ts +111 -0
- package/src/error-tracking/parsers/opera.ts +18 -0
- package/src/error-tracking/parsers/react-native.ts +0 -0
- package/src/error-tracking/parsers/safari.ts +33 -0
- package/src/error-tracking/parsers/winjs.ts +12 -0
- package/src/error-tracking/types.ts +107 -0
- package/src/error-tracking/utils.ts +39 -0
- package/src/eventemitter.ts +27 -0
- package/src/featureFlagUtils.ts +192 -0
- package/src/gzip.ts +29 -0
- package/src/index.ts +8 -0
- package/src/posthog-core-stateless.ts +1226 -0
- package/src/posthog-core.ts +958 -0
- package/src/testing/PostHogCoreTestClient.ts +91 -0
- package/src/testing/index.ts +2 -0
- package/src/testing/test-utils.ts +47 -0
- package/src/types.ts +544 -0
- package/src/utils/bucketed-rate-limiter.spec.ts +33 -0
- package/src/utils/bucketed-rate-limiter.ts +85 -0
- package/src/utils/index.ts +98 -0
- package/src/utils/number-utils.spec.ts +89 -0
- package/src/utils/number-utils.ts +30 -0
- package/src/utils/promise-queue.spec.ts +55 -0
- package/src/utils/promise-queue.ts +30 -0
- package/src/utils/string-utils.ts +23 -0
- package/src/utils/type-utils.ts +134 -0
- package/src/vendor/uuidv7.ts +479 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
ErrorPropertiesBuilder: ()=>ErrorPropertiesBuilder
|
|
28
|
+
});
|
|
29
|
+
const external_chunk_ids_js_namespaceObject = require("./chunk-ids.js");
|
|
30
|
+
const index_js_namespaceObject = require("./parsers/index.js");
|
|
31
|
+
const MAX_CAUSE_RECURSION = 4;
|
|
32
|
+
class ErrorPropertiesBuilder {
|
|
33
|
+
constructor(coercers = [], parsers = [], modifiers = []){
|
|
34
|
+
this.coercers = coercers;
|
|
35
|
+
this.modifiers = modifiers;
|
|
36
|
+
this.stackParser = (0, index_js_namespaceObject.createStackParser)(...parsers);
|
|
37
|
+
}
|
|
38
|
+
buildFromUnknown(input, hint = {}) {
|
|
39
|
+
const providedMechanism = hint && hint.mechanism;
|
|
40
|
+
const mechanism = providedMechanism || {
|
|
41
|
+
handled: true,
|
|
42
|
+
type: 'generic'
|
|
43
|
+
};
|
|
44
|
+
const coercingContext = this.buildCoercingContext(mechanism, hint, 0);
|
|
45
|
+
const exceptionWithCause = coercingContext.apply(input);
|
|
46
|
+
const parsingContext = this.buildParsingContext();
|
|
47
|
+
const exceptionWithStack = this.parseStacktrace(exceptionWithCause, parsingContext);
|
|
48
|
+
const exceptionList = this.convertToExceptionList(exceptionWithStack, mechanism);
|
|
49
|
+
return {
|
|
50
|
+
$exception_list: exceptionList,
|
|
51
|
+
$exception_level: 'error'
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
coerceFallback(ctx) {
|
|
55
|
+
return {
|
|
56
|
+
type: 'Error',
|
|
57
|
+
value: 'Unknown error',
|
|
58
|
+
stack: ctx.syntheticException?.stack,
|
|
59
|
+
synthetic: true
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
parseStacktrace(err, ctx) {
|
|
63
|
+
let cause;
|
|
64
|
+
if (null != err.cause) cause = this.parseStacktrace(err.cause, ctx);
|
|
65
|
+
let stack;
|
|
66
|
+
if ('' != err.stack && null != err.stack) stack = this.applyChunkIds(this.stackParser(err.stack, err.synthetic ? 1 : 0), ctx.chunkIdMap);
|
|
67
|
+
return {
|
|
68
|
+
...err,
|
|
69
|
+
cause,
|
|
70
|
+
stack
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
applyChunkIds(frames, chunkIdMap) {
|
|
74
|
+
return frames.map((frame)=>{
|
|
75
|
+
if (frame.filename && chunkIdMap) frame.chunk_id = chunkIdMap[frame.filename];
|
|
76
|
+
return frame;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
applyCoercers(input, ctx) {
|
|
80
|
+
for (const adapter of this.coercers)if (adapter.match(input)) return adapter.coerce(input, ctx);
|
|
81
|
+
return this.coerceFallback(ctx);
|
|
82
|
+
}
|
|
83
|
+
async applyModifiers(frames) {
|
|
84
|
+
let newFrames = frames;
|
|
85
|
+
for (const modifier of this.modifiers)newFrames = await modifier(newFrames);
|
|
86
|
+
return newFrames;
|
|
87
|
+
}
|
|
88
|
+
async modifyFrames(exceptionWithStack) {
|
|
89
|
+
let cause;
|
|
90
|
+
if (null != exceptionWithStack.cause) cause = await this.modifyFrames(exceptionWithStack.cause);
|
|
91
|
+
let stack = [];
|
|
92
|
+
if (null != exceptionWithStack.stack) stack = await this.applyModifiers(exceptionWithStack.stack);
|
|
93
|
+
return {
|
|
94
|
+
...exceptionWithStack,
|
|
95
|
+
cause,
|
|
96
|
+
stack
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
convertToExceptionList(exceptionWithStack, mechanism) {
|
|
100
|
+
const currentException = {
|
|
101
|
+
type: exceptionWithStack.type,
|
|
102
|
+
value: exceptionWithStack.value,
|
|
103
|
+
mechanism: {
|
|
104
|
+
type: mechanism.type ?? 'generic',
|
|
105
|
+
handled: mechanism.handled ?? true,
|
|
106
|
+
synthetic: exceptionWithStack.synthetic ?? false
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
if (exceptionWithStack.stack) currentException.stacktrace = {
|
|
110
|
+
type: 'raw',
|
|
111
|
+
frames: exceptionWithStack.stack
|
|
112
|
+
};
|
|
113
|
+
const exceptionList = [
|
|
114
|
+
currentException
|
|
115
|
+
];
|
|
116
|
+
if (null != exceptionWithStack.cause) exceptionList.push(...this.convertToExceptionList(exceptionWithStack.cause, {
|
|
117
|
+
...mechanism,
|
|
118
|
+
handled: true
|
|
119
|
+
}));
|
|
120
|
+
return exceptionList;
|
|
121
|
+
}
|
|
122
|
+
buildParsingContext() {
|
|
123
|
+
const context = {
|
|
124
|
+
chunkIdMap: (0, external_chunk_ids_js_namespaceObject.getFilenameToChunkIdMap)(this.stackParser)
|
|
125
|
+
};
|
|
126
|
+
return context;
|
|
127
|
+
}
|
|
128
|
+
buildCoercingContext(mechanism, hint, depth = 0) {
|
|
129
|
+
const coerce = (input, depth)=>{
|
|
130
|
+
if (!(depth <= MAX_CAUSE_RECURSION)) return;
|
|
131
|
+
{
|
|
132
|
+
const ctx = this.buildCoercingContext(mechanism, hint, depth);
|
|
133
|
+
return this.applyCoercers(input, ctx);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const context = {
|
|
137
|
+
...hint,
|
|
138
|
+
syntheticException: 0 == depth ? hint.syntheticException : void 0,
|
|
139
|
+
mechanism,
|
|
140
|
+
apply: (input)=>coerce(input, depth),
|
|
141
|
+
next: (input)=>coerce(input, depth + 1)
|
|
142
|
+
};
|
|
143
|
+
return context;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.ErrorPropertiesBuilder = __webpack_exports__.ErrorPropertiesBuilder;
|
|
147
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
148
|
+
"ErrorPropertiesBuilder"
|
|
149
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
150
|
+
Object.defineProperty(exports, '__esModule', {
|
|
151
|
+
value: true
|
|
152
|
+
});
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { getFilenameToChunkIdMap } from "./chunk-ids.mjs";
|
|
2
|
+
import { createStackParser } from "./parsers/index.mjs";
|
|
3
|
+
const MAX_CAUSE_RECURSION = 4;
|
|
4
|
+
class ErrorPropertiesBuilder {
|
|
5
|
+
constructor(coercers = [], parsers = [], modifiers = []){
|
|
6
|
+
this.coercers = coercers;
|
|
7
|
+
this.modifiers = modifiers;
|
|
8
|
+
this.stackParser = createStackParser(...parsers);
|
|
9
|
+
}
|
|
10
|
+
buildFromUnknown(input, hint = {}) {
|
|
11
|
+
const providedMechanism = hint && hint.mechanism;
|
|
12
|
+
const mechanism = providedMechanism || {
|
|
13
|
+
handled: true,
|
|
14
|
+
type: 'generic'
|
|
15
|
+
};
|
|
16
|
+
const coercingContext = this.buildCoercingContext(mechanism, hint, 0);
|
|
17
|
+
const exceptionWithCause = coercingContext.apply(input);
|
|
18
|
+
const parsingContext = this.buildParsingContext();
|
|
19
|
+
const exceptionWithStack = this.parseStacktrace(exceptionWithCause, parsingContext);
|
|
20
|
+
const exceptionList = this.convertToExceptionList(exceptionWithStack, mechanism);
|
|
21
|
+
return {
|
|
22
|
+
$exception_list: exceptionList,
|
|
23
|
+
$exception_level: 'error'
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
coerceFallback(ctx) {
|
|
27
|
+
return {
|
|
28
|
+
type: 'Error',
|
|
29
|
+
value: 'Unknown error',
|
|
30
|
+
stack: ctx.syntheticException?.stack,
|
|
31
|
+
synthetic: true
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
parseStacktrace(err, ctx) {
|
|
35
|
+
let cause;
|
|
36
|
+
if (null != err.cause) cause = this.parseStacktrace(err.cause, ctx);
|
|
37
|
+
let stack;
|
|
38
|
+
if ('' != err.stack && null != err.stack) stack = this.applyChunkIds(this.stackParser(err.stack, err.synthetic ? 1 : 0), ctx.chunkIdMap);
|
|
39
|
+
return {
|
|
40
|
+
...err,
|
|
41
|
+
cause,
|
|
42
|
+
stack
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
applyChunkIds(frames, chunkIdMap) {
|
|
46
|
+
return frames.map((frame)=>{
|
|
47
|
+
if (frame.filename && chunkIdMap) frame.chunk_id = chunkIdMap[frame.filename];
|
|
48
|
+
return frame;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
applyCoercers(input, ctx) {
|
|
52
|
+
for (const adapter of this.coercers)if (adapter.match(input)) return adapter.coerce(input, ctx);
|
|
53
|
+
return this.coerceFallback(ctx);
|
|
54
|
+
}
|
|
55
|
+
async applyModifiers(frames) {
|
|
56
|
+
let newFrames = frames;
|
|
57
|
+
for (const modifier of this.modifiers)newFrames = await modifier(newFrames);
|
|
58
|
+
return newFrames;
|
|
59
|
+
}
|
|
60
|
+
async modifyFrames(exceptionWithStack) {
|
|
61
|
+
let cause;
|
|
62
|
+
if (null != exceptionWithStack.cause) cause = await this.modifyFrames(exceptionWithStack.cause);
|
|
63
|
+
let stack = [];
|
|
64
|
+
if (null != exceptionWithStack.stack) stack = await this.applyModifiers(exceptionWithStack.stack);
|
|
65
|
+
return {
|
|
66
|
+
...exceptionWithStack,
|
|
67
|
+
cause,
|
|
68
|
+
stack
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
convertToExceptionList(exceptionWithStack, mechanism) {
|
|
72
|
+
const currentException = {
|
|
73
|
+
type: exceptionWithStack.type,
|
|
74
|
+
value: exceptionWithStack.value,
|
|
75
|
+
mechanism: {
|
|
76
|
+
type: mechanism.type ?? 'generic',
|
|
77
|
+
handled: mechanism.handled ?? true,
|
|
78
|
+
synthetic: exceptionWithStack.synthetic ?? false
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
if (exceptionWithStack.stack) currentException.stacktrace = {
|
|
82
|
+
type: 'raw',
|
|
83
|
+
frames: exceptionWithStack.stack
|
|
84
|
+
};
|
|
85
|
+
const exceptionList = [
|
|
86
|
+
currentException
|
|
87
|
+
];
|
|
88
|
+
if (null != exceptionWithStack.cause) exceptionList.push(...this.convertToExceptionList(exceptionWithStack.cause, {
|
|
89
|
+
...mechanism,
|
|
90
|
+
handled: true
|
|
91
|
+
}));
|
|
92
|
+
return exceptionList;
|
|
93
|
+
}
|
|
94
|
+
buildParsingContext() {
|
|
95
|
+
const context = {
|
|
96
|
+
chunkIdMap: getFilenameToChunkIdMap(this.stackParser)
|
|
97
|
+
};
|
|
98
|
+
return context;
|
|
99
|
+
}
|
|
100
|
+
buildCoercingContext(mechanism, hint, depth = 0) {
|
|
101
|
+
const coerce = (input, depth)=>{
|
|
102
|
+
if (!(depth <= MAX_CAUSE_RECURSION)) return;
|
|
103
|
+
{
|
|
104
|
+
const ctx = this.buildCoercingContext(mechanism, hint, depth);
|
|
105
|
+
return this.applyCoercers(input, ctx);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const context = {
|
|
109
|
+
...hint,
|
|
110
|
+
syntheticException: 0 == depth ? hint.syntheticException : void 0,
|
|
111
|
+
mechanism,
|
|
112
|
+
apply: (input)=>coerce(input, depth),
|
|
113
|
+
next: (input)=>coerce(input, depth + 1)
|
|
114
|
+
};
|
|
115
|
+
return context;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
export { ErrorPropertiesBuilder };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/error-tracking/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,mBAAmB,SAAS,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"./coercers": function(module) {
|
|
4
|
+
module.exports = require("./coercers/index.js");
|
|
5
|
+
},
|
|
6
|
+
"./error-properties-builder": function(module) {
|
|
7
|
+
module.exports = require("./error-properties-builder.js");
|
|
8
|
+
},
|
|
9
|
+
"./parsers": function(module) {
|
|
10
|
+
module.exports = require("./parsers/index.js");
|
|
11
|
+
},
|
|
12
|
+
"./utils?198b": function(module) {
|
|
13
|
+
module.exports = require("./utils.js");
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var __webpack_module_cache__ = {};
|
|
17
|
+
function __webpack_require__(moduleId) {
|
|
18
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
19
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
20
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
21
|
+
exports: {}
|
|
22
|
+
};
|
|
23
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
24
|
+
return module.exports;
|
|
25
|
+
}
|
|
26
|
+
(()=>{
|
|
27
|
+
__webpack_require__.n = (module)=>{
|
|
28
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
29
|
+
__webpack_require__.d(getter, {
|
|
30
|
+
a: getter
|
|
31
|
+
});
|
|
32
|
+
return getter;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
(()=>{
|
|
36
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
37
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: definition[key]
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
})();
|
|
43
|
+
(()=>{
|
|
44
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
45
|
+
})();
|
|
46
|
+
(()=>{
|
|
47
|
+
__webpack_require__.r = (exports1)=>{
|
|
48
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
49
|
+
value: 'Module'
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
52
|
+
value: true
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
})();
|
|
56
|
+
var __webpack_exports__ = {};
|
|
57
|
+
(()=>{
|
|
58
|
+
__webpack_require__.r(__webpack_exports__);
|
|
59
|
+
var _error_properties_builder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./error-properties-builder");
|
|
60
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
61
|
+
for(var __WEBPACK_IMPORT_KEY__ in _error_properties_builder__WEBPACK_IMPORTED_MODULE_0__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
62
|
+
return _error_properties_builder__WEBPACK_IMPORTED_MODULE_0__[key];
|
|
63
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
64
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
65
|
+
var _parsers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./parsers");
|
|
66
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
67
|
+
for(var __WEBPACK_IMPORT_KEY__ in _parsers__WEBPACK_IMPORTED_MODULE_1__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
68
|
+
return _parsers__WEBPACK_IMPORTED_MODULE_1__[key];
|
|
69
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
70
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
71
|
+
var _coercers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./coercers");
|
|
72
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
73
|
+
for(var __WEBPACK_IMPORT_KEY__ in _coercers__WEBPACK_IMPORTED_MODULE_2__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
74
|
+
return _coercers__WEBPACK_IMPORTED_MODULE_2__[key];
|
|
75
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
76
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
77
|
+
var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./utils?198b");
|
|
78
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
79
|
+
for(var __WEBPACK_IMPORT_KEY__ in _utils__WEBPACK_IMPORTED_MODULE_3__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
80
|
+
return _utils__WEBPACK_IMPORTED_MODULE_3__[key];
|
|
81
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
82
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
83
|
+
})();
|
|
84
|
+
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
85
|
+
Object.defineProperty(exports, '__esModule', {
|
|
86
|
+
value: true
|
|
87
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StackFrame } from '../types';
|
|
2
|
+
export declare const UNKNOWN_FUNCTION = "?";
|
|
3
|
+
export declare const OPERA10_PRIORITY = 10;
|
|
4
|
+
export declare const OPERA11_PRIORITY = 20;
|
|
5
|
+
export declare const CHROME_PRIORITY = 30;
|
|
6
|
+
export declare const WINJS_PRIORITY = 40;
|
|
7
|
+
export declare const GECKO_PRIORITY = 50;
|
|
8
|
+
export declare function createFrame(filename: string, func: string, lineno?: number, colno?: number): StackFrame;
|
|
9
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/error-tracking/parsers/base.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC,eAAO,MAAM,gBAAgB,MAAM,CAAA;AACnC,eAAO,MAAM,gBAAgB,KAAK,CAAA;AAClC,eAAO,MAAM,gBAAgB,KAAK,CAAA;AAClC,eAAO,MAAM,eAAe,KAAK,CAAA;AACjC,eAAO,MAAM,cAAc,KAAK,CAAA;AAChC,eAAO,MAAM,cAAc,KAAK,CAAA;AAEhC,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,CAkBvG"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
OPERA10_PRIORITY: ()=>OPERA10_PRIORITY,
|
|
28
|
+
CHROME_PRIORITY: ()=>CHROME_PRIORITY,
|
|
29
|
+
UNKNOWN_FUNCTION: ()=>UNKNOWN_FUNCTION,
|
|
30
|
+
WINJS_PRIORITY: ()=>WINJS_PRIORITY,
|
|
31
|
+
createFrame: ()=>createFrame,
|
|
32
|
+
OPERA11_PRIORITY: ()=>OPERA11_PRIORITY,
|
|
33
|
+
GECKO_PRIORITY: ()=>GECKO_PRIORITY
|
|
34
|
+
});
|
|
35
|
+
const index_js_namespaceObject = require("../../utils/index.js");
|
|
36
|
+
const UNKNOWN_FUNCTION = '?';
|
|
37
|
+
const OPERA10_PRIORITY = 10;
|
|
38
|
+
const OPERA11_PRIORITY = 20;
|
|
39
|
+
const CHROME_PRIORITY = 30;
|
|
40
|
+
const WINJS_PRIORITY = 40;
|
|
41
|
+
const GECKO_PRIORITY = 50;
|
|
42
|
+
function createFrame(filename, func, lineno, colno) {
|
|
43
|
+
const frame = {
|
|
44
|
+
platform: "web:javascript",
|
|
45
|
+
filename,
|
|
46
|
+
function: '<anonymous>' === func ? UNKNOWN_FUNCTION : func,
|
|
47
|
+
in_app: true
|
|
48
|
+
};
|
|
49
|
+
if (!(0, index_js_namespaceObject.isUndefined)(lineno)) frame.lineno = lineno;
|
|
50
|
+
if (!(0, index_js_namespaceObject.isUndefined)(colno)) frame.colno = colno;
|
|
51
|
+
return frame;
|
|
52
|
+
}
|
|
53
|
+
exports.CHROME_PRIORITY = __webpack_exports__.CHROME_PRIORITY;
|
|
54
|
+
exports.GECKO_PRIORITY = __webpack_exports__.GECKO_PRIORITY;
|
|
55
|
+
exports.OPERA10_PRIORITY = __webpack_exports__.OPERA10_PRIORITY;
|
|
56
|
+
exports.OPERA11_PRIORITY = __webpack_exports__.OPERA11_PRIORITY;
|
|
57
|
+
exports.UNKNOWN_FUNCTION = __webpack_exports__.UNKNOWN_FUNCTION;
|
|
58
|
+
exports.WINJS_PRIORITY = __webpack_exports__.WINJS_PRIORITY;
|
|
59
|
+
exports.createFrame = __webpack_exports__.createFrame;
|
|
60
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
61
|
+
"CHROME_PRIORITY",
|
|
62
|
+
"GECKO_PRIORITY",
|
|
63
|
+
"OPERA10_PRIORITY",
|
|
64
|
+
"OPERA11_PRIORITY",
|
|
65
|
+
"UNKNOWN_FUNCTION",
|
|
66
|
+
"WINJS_PRIORITY",
|
|
67
|
+
"createFrame"
|
|
68
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
69
|
+
Object.defineProperty(exports, '__esModule', {
|
|
70
|
+
value: true
|
|
71
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { isUndefined } from "../../utils/index.mjs";
|
|
2
|
+
const UNKNOWN_FUNCTION = '?';
|
|
3
|
+
const OPERA10_PRIORITY = 10;
|
|
4
|
+
const OPERA11_PRIORITY = 20;
|
|
5
|
+
const CHROME_PRIORITY = 30;
|
|
6
|
+
const WINJS_PRIORITY = 40;
|
|
7
|
+
const GECKO_PRIORITY = 50;
|
|
8
|
+
function createFrame(filename, func, lineno, colno) {
|
|
9
|
+
const frame = {
|
|
10
|
+
platform: "web:javascript",
|
|
11
|
+
filename,
|
|
12
|
+
function: '<anonymous>' === func ? UNKNOWN_FUNCTION : func,
|
|
13
|
+
in_app: true
|
|
14
|
+
};
|
|
15
|
+
if (!isUndefined(lineno)) frame.lineno = lineno;
|
|
16
|
+
if (!isUndefined(colno)) frame.colno = colno;
|
|
17
|
+
return frame;
|
|
18
|
+
}
|
|
19
|
+
export { CHROME_PRIORITY, GECKO_PRIORITY, OPERA10_PRIORITY, OPERA11_PRIORITY, UNKNOWN_FUNCTION, WINJS_PRIORITY, createFrame };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chrome.d.ts","sourceRoot":"","sources":["../../../src/error-tracking/parsers/chrome.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAgB1C,eAAO,MAAM,qBAAqB,EAAE,eAiCnC,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
chromeStackLineParser: ()=>chromeStackLineParser
|
|
28
|
+
});
|
|
29
|
+
const external_base_js_namespaceObject = require("./base.js");
|
|
30
|
+
const external_safari_js_namespaceObject = require("./safari.js");
|
|
31
|
+
const chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i;
|
|
32
|
+
const chromeRegex = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
|
|
33
|
+
const chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/;
|
|
34
|
+
const chromeStackLineParser = (line)=>{
|
|
35
|
+
const noFnParts = chromeRegexNoFnName.exec(line);
|
|
36
|
+
if (noFnParts) {
|
|
37
|
+
const [, filename, line, col] = noFnParts;
|
|
38
|
+
return (0, external_base_js_namespaceObject.createFrame)(filename, external_base_js_namespaceObject.UNKNOWN_FUNCTION, +line, +col);
|
|
39
|
+
}
|
|
40
|
+
const parts = chromeRegex.exec(line);
|
|
41
|
+
if (parts) {
|
|
42
|
+
const isEval = parts[2] && 0 === parts[2].indexOf('eval');
|
|
43
|
+
if (isEval) {
|
|
44
|
+
const subMatch = chromeEvalRegex.exec(parts[2]);
|
|
45
|
+
if (subMatch) {
|
|
46
|
+
parts[2] = subMatch[1];
|
|
47
|
+
parts[3] = subMatch[2];
|
|
48
|
+
parts[4] = subMatch[3];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const [func, filename] = (0, external_safari_js_namespaceObject.extractSafariExtensionDetails)(parts[1] || external_base_js_namespaceObject.UNKNOWN_FUNCTION, parts[2]);
|
|
52
|
+
return (0, external_base_js_namespaceObject.createFrame)(filename, func, parts[3] ? +parts[3] : void 0, parts[4] ? +parts[4] : void 0);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
exports.chromeStackLineParser = __webpack_exports__.chromeStackLineParser;
|
|
56
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
57
|
+
"chromeStackLineParser"
|
|
58
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
59
|
+
Object.defineProperty(exports, '__esModule', {
|
|
60
|
+
value: true
|
|
61
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { UNKNOWN_FUNCTION, createFrame } from "./base.mjs";
|
|
2
|
+
import { extractSafariExtensionDetails } from "./safari.mjs";
|
|
3
|
+
const chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i;
|
|
4
|
+
const chromeRegex = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
|
|
5
|
+
const chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/;
|
|
6
|
+
const chromeStackLineParser = (line)=>{
|
|
7
|
+
const noFnParts = chromeRegexNoFnName.exec(line);
|
|
8
|
+
if (noFnParts) {
|
|
9
|
+
const [, filename, line, col] = noFnParts;
|
|
10
|
+
return createFrame(filename, UNKNOWN_FUNCTION, +line, +col);
|
|
11
|
+
}
|
|
12
|
+
const parts = chromeRegex.exec(line);
|
|
13
|
+
if (parts) {
|
|
14
|
+
const isEval = parts[2] && 0 === parts[2].indexOf('eval');
|
|
15
|
+
if (isEval) {
|
|
16
|
+
const subMatch = chromeEvalRegex.exec(parts[2]);
|
|
17
|
+
if (subMatch) {
|
|
18
|
+
parts[2] = subMatch[1];
|
|
19
|
+
parts[3] = subMatch[2];
|
|
20
|
+
parts[4] = subMatch[3];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const [func, filename] = extractSafariExtensionDetails(parts[1] || UNKNOWN_FUNCTION, parts[2]);
|
|
24
|
+
return createFrame(filename, func, parts[3] ? +parts[3] : void 0, parts[4] ? +parts[4] : void 0);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export { chromeStackLineParser };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gecko.d.ts","sourceRoot":"","sources":["../../../src/error-tracking/parsers/gecko.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAS1C,eAAO,MAAM,oBAAoB,EAAE,eAyBlC,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
geckoStackLineParser: ()=>geckoStackLineParser
|
|
28
|
+
});
|
|
29
|
+
const external_base_js_namespaceObject = require("./base.js");
|
|
30
|
+
const external_safari_js_namespaceObject = require("./safari.js");
|
|
31
|
+
const geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
|
|
32
|
+
const geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
|
|
33
|
+
const geckoStackLineParser = (line)=>{
|
|
34
|
+
const parts = geckoREgex.exec(line);
|
|
35
|
+
if (parts) {
|
|
36
|
+
const isEval = parts[3] && parts[3].indexOf(' > eval') > -1;
|
|
37
|
+
if (isEval) {
|
|
38
|
+
const subMatch = geckoEvalRegex.exec(parts[3]);
|
|
39
|
+
if (subMatch) {
|
|
40
|
+
parts[1] = parts[1] || 'eval';
|
|
41
|
+
parts[3] = subMatch[1];
|
|
42
|
+
parts[4] = subMatch[2];
|
|
43
|
+
parts[5] = '';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
let filename = parts[3];
|
|
47
|
+
let func = parts[1] || external_base_js_namespaceObject.UNKNOWN_FUNCTION;
|
|
48
|
+
[func, filename] = (0, external_safari_js_namespaceObject.extractSafariExtensionDetails)(func, filename);
|
|
49
|
+
return (0, external_base_js_namespaceObject.createFrame)(filename, func, parts[4] ? +parts[4] : void 0, parts[5] ? +parts[5] : void 0);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
exports.geckoStackLineParser = __webpack_exports__.geckoStackLineParser;
|
|
53
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
54
|
+
"geckoStackLineParser"
|
|
55
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
56
|
+
Object.defineProperty(exports, '__esModule', {
|
|
57
|
+
value: true
|
|
58
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { UNKNOWN_FUNCTION, createFrame } from "./base.mjs";
|
|
2
|
+
import { extractSafariExtensionDetails } from "./safari.mjs";
|
|
3
|
+
const geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
|
|
4
|
+
const geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
|
|
5
|
+
const geckoStackLineParser = (line)=>{
|
|
6
|
+
const parts = geckoREgex.exec(line);
|
|
7
|
+
if (parts) {
|
|
8
|
+
const isEval = parts[3] && parts[3].indexOf(' > eval') > -1;
|
|
9
|
+
if (isEval) {
|
|
10
|
+
const subMatch = geckoEvalRegex.exec(parts[3]);
|
|
11
|
+
if (subMatch) {
|
|
12
|
+
parts[1] = parts[1] || 'eval';
|
|
13
|
+
parts[3] = subMatch[1];
|
|
14
|
+
parts[4] = subMatch[2];
|
|
15
|
+
parts[5] = '';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
let filename = parts[3];
|
|
19
|
+
let func = parts[1] || UNKNOWN_FUNCTION;
|
|
20
|
+
[func, filename] = extractSafariExtensionDetails(func, filename);
|
|
21
|
+
return createFrame(filename, func, parts[4] ? +parts[4] : void 0, parts[5] ? +parts[5] : void 0);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export { geckoStackLineParser };
|