🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@posthog/core

Package Overview
Dependencies
Maintainers
22
Versions
153
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@posthog/core - npm Package Compare versions

Comparing version
1.45.0
to
1.45.1
+19
src/error-tracking/parsers/node.spec.ts
import { nodeStackLineParser } from './node'
describe('nodeStackLineParser', () => {
it.each([
['at async Promise.all (index 3)', 'Promise.all'],
['at async Promise.all (index 472)', 'Promise.all'],
['at async Promise.any (index 11)', 'Promise.any'],
])('canonicalizes the V8 Promise index in %s', (line, functionName) => {
expect(nodeStackLineParser(line, 'node:javascript')).toEqual({
filename: 'node:internal/promise',
module: undefined,
function: functionName,
lineno: undefined,
colno: undefined,
in_app: false,
platform: 'node:javascript',
})
})
})
+1
-1

@@ -1,1 +0,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;AAOpD,eAAO,MAAM,mBAAmB,EAAE,eA4EjC,CAAA"}
{"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"}

@@ -32,2 +32,5 @@ "use strict";

const FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
const PROMISE_COMBINATOR = /^Promise\.(?:all|any)$/;
const PROMISE_INDEX = /^index \d+$/;
const PROMISE_FRAME_FILENAME = 'node:internal/promise';
const nodeStackLineParser = (line, platform)=>{

@@ -72,2 +75,3 @@ const lineMatch = line.match(FULL_MATCH);

if (!filename && lineMatch[5] && !isNative) filename = lineMatch[5];
if (PROMISE_COMBINATOR.test(functionName) && PROMISE_INDEX.test(filename || '')) filename = PROMISE_FRAME_FILENAME;
return {

@@ -74,0 +78,0 @@ filename: filename ? decodeURI(filename) : void 0,

import { UNKNOWN_FUNCTION } from "./base.mjs";
const FILENAME_MATCH = /^\s*[-]{4,}$/;
const FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
const PROMISE_COMBINATOR = /^Promise\.(?:all|any)$/;
const PROMISE_INDEX = /^index \d+$/;
const PROMISE_FRAME_FILENAME = 'node:internal/promise';
const nodeStackLineParser = (line, platform)=>{

@@ -43,2 +46,3 @@ const lineMatch = line.match(FULL_MATCH);

if (!filename && lineMatch[5] && !isNative) filename = lineMatch[5];
if (PROMISE_COMBINATOR.test(functionName) && PROMISE_INDEX.test(filename || '')) filename = PROMISE_FRAME_FILENAME;
return {

@@ -45,0 +49,0 @@ filename: filename ? decodeURI(filename) : void 0,

{
"name": "@posthog/core",
"version": "1.45.0",
"version": "1.45.1",
"bugs": {

@@ -5,0 +5,0 @@ "url": "https://github.com/PostHog/posthog-js/issues"

@@ -11,2 +11,5 @@ // Portions of this file are derived from getsentry/sentry-javascript

const FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/
const PROMISE_COMBINATOR = /^Promise\.(?:all|any)$/
const PROMISE_INDEX = /^index \d+$/
const PROMISE_FRAME_FILENAME = 'node:internal/promise'

@@ -70,2 +73,7 @@ export const nodeStackLineParser: StackLineParser = (line: string, platform: Platform) => {

// V8's Promise index identifies the input promise rather than a source file.
if (PROMISE_COMBINATOR.test(functionName) && PROMISE_INDEX.test(filename || '')) {
filename = PROMISE_FRAME_FILENAME
}
return {

@@ -72,0 +80,0 @@ filename: filename ? decodeURI(filename) : undefined,