@posthog/core 1.45.0 → 1.45.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/error-tracking/parsers/node.ts"],"names":[],"mappings":"AAIA,OAAO,EAAY,eAAe,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/error-tracking/parsers/node.ts"],"names":[],"mappings":"AAIA,OAAO,EAAY,eAAe,EAAE,MAAM,UAAU,CAAA;AAUpD,eAAO,MAAM,mBAAmB,EAAE,eAiFjC,CAAA"}
|
|
@@ -29,6 +29,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
const external_base_js_namespaceObject = require("./base.js");
|
|
30
30
|
const FILENAME_MATCH = /^\s*[-]{4,}$/;
|
|
31
31
|
const FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
|
|
32
|
+
const PROMISE_COMBINATOR = /^Promise\.(?:all|any)$/;
|
|
33
|
+
const PROMISE_INDEX = /^index \d+$/;
|
|
34
|
+
const PROMISE_FRAME_FILENAME = 'node:internal/promise';
|
|
32
35
|
const nodeStackLineParser = (line, platform)=>{
|
|
33
36
|
const lineMatch = line.match(FULL_MATCH);
|
|
34
37
|
if (lineMatch) {
|
|
@@ -68,6 +71,7 @@ const nodeStackLineParser = (line, platform)=>{
|
|
|
68
71
|
const isNative = 'native' === lineMatch[5];
|
|
69
72
|
if (filename?.match(/\/[A-Z]:/)) filename = filename.slice(1);
|
|
70
73
|
if (!filename && lineMatch[5] && !isNative) filename = lineMatch[5];
|
|
74
|
+
if (PROMISE_COMBINATOR.test(functionName) && PROMISE_INDEX.test(filename || '')) filename = PROMISE_FRAME_FILENAME;
|
|
71
75
|
return {
|
|
72
76
|
filename: filename ? decodeURI(filename) : void 0,
|
|
73
77
|
module: void 0,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { UNKNOWN_FUNCTION } from "./base.mjs";
|
|
2
2
|
const FILENAME_MATCH = /^\s*[-]{4,}$/;
|
|
3
3
|
const FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
|
|
4
|
+
const PROMISE_COMBINATOR = /^Promise\.(?:all|any)$/;
|
|
5
|
+
const PROMISE_INDEX = /^index \d+$/;
|
|
6
|
+
const PROMISE_FRAME_FILENAME = 'node:internal/promise';
|
|
4
7
|
const nodeStackLineParser = (line, platform)=>{
|
|
5
8
|
const lineMatch = line.match(FULL_MATCH);
|
|
6
9
|
if (lineMatch) {
|
|
@@ -40,6 +43,7 @@ const nodeStackLineParser = (line, platform)=>{
|
|
|
40
43
|
const isNative = 'native' === lineMatch[5];
|
|
41
44
|
if (filename?.match(/\/[A-Z]:/)) filename = filename.slice(1);
|
|
42
45
|
if (!filename && lineMatch[5] && !isNative) filename = lineMatch[5];
|
|
46
|
+
if (PROMISE_COMBINATOR.test(functionName) && PROMISE_INDEX.test(filename || '')) filename = PROMISE_FRAME_FILENAME;
|
|
43
47
|
return {
|
|
44
48
|
filename: filename ? decodeURI(filename) : void 0,
|
|
45
49
|
module: void 0,
|
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { nodeStackLineParser } from './node'
|
|
2
|
+
|
|
3
|
+
describe('nodeStackLineParser', () => {
|
|
4
|
+
it.each([
|
|
5
|
+
['at async Promise.all (index 3)', 'Promise.all'],
|
|
6
|
+
['at async Promise.all (index 472)', 'Promise.all'],
|
|
7
|
+
['at async Promise.any (index 11)', 'Promise.any'],
|
|
8
|
+
])('canonicalizes the V8 Promise index in %s', (line, functionName) => {
|
|
9
|
+
expect(nodeStackLineParser(line, 'node:javascript')).toEqual({
|
|
10
|
+
filename: 'node:internal/promise',
|
|
11
|
+
module: undefined,
|
|
12
|
+
function: functionName,
|
|
13
|
+
lineno: undefined,
|
|
14
|
+
colno: undefined,
|
|
15
|
+
in_app: false,
|
|
16
|
+
platform: 'node:javascript',
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
})
|
|
@@ -8,6 +8,9 @@ import { UNKNOWN_FUNCTION } from './base'
|
|
|
8
8
|
/** Node Stack line parser */
|
|
9
9
|
const FILENAME_MATCH = /^\s*[-]{4,}$/
|
|
10
10
|
const FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/
|
|
11
|
+
const PROMISE_COMBINATOR = /^Promise\.(?:all|any)$/
|
|
12
|
+
const PROMISE_INDEX = /^index \d+$/
|
|
13
|
+
const PROMISE_FRAME_FILENAME = 'node:internal/promise'
|
|
11
14
|
|
|
12
15
|
export const nodeStackLineParser: StackLineParser = (line: string, platform: Platform) => {
|
|
13
16
|
const lineMatch = line.match(FULL_MATCH)
|
|
@@ -66,6 +69,11 @@ export const nodeStackLineParser: StackLineParser = (line: string, platform: Pla
|
|
|
66
69
|
filename = lineMatch[5]
|
|
67
70
|
}
|
|
68
71
|
|
|
72
|
+
// V8's Promise index identifies the input promise rather than a source file.
|
|
73
|
+
if (PROMISE_COMBINATOR.test(functionName) && PROMISE_INDEX.test(filename || '')) {
|
|
74
|
+
filename = PROMISE_FRAME_FILENAME
|
|
75
|
+
}
|
|
76
|
+
|
|
69
77
|
return {
|
|
70
78
|
filename: filename ? decodeURI(filename) : undefined,
|
|
71
79
|
module: undefined,
|