Skip to content

Commit ca50f74

Browse files
committed
fix(core): result of getCallerStack(), getCallerInfo() under nodejs v22.12
1 parent 8d0fb61 commit ca50f74

File tree

1 file changed

+3
-2
lines changed
  • packages/core/src/lib/callstack

1 file changed

+3
-2
lines changed

packages/core/src/lib/callstack/util.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const initInfo: CallerInfo = {
3535
const nodeVersion = semver.coerce(process.version)
3636
const isNodeGteV20 = nodeVersion ? semver.gte(nodeVersion, '20.0.0') : false
3737
const isNodeGteV22 = nodeVersion ? semver.gte(nodeVersion, '22.9.0') : false
38+
const isNodeGteV22_12 = nodeVersion ? semver.gte(nodeVersion, '22.12.0') : false
3839
const isNodeGteV23 = nodeVersion ? semver.gte(nodeVersion, '23.3.0') : false
3940

4041
/**
@@ -201,8 +202,8 @@ function getCallSiteNative(distance: number, sourceMap: boolean): CallerInfo {
201202
const ret: CallerInfo = {
202203
...initInfo,
203204
}
204-
const depth2 = isNodeGteV23 ? depth + 2 : depth + 1
205-
const depth3 = isNodeGteV23 ? depth + 1 : depth
205+
const depth2 = isNodeGteV23 || isNodeGteV22_12 ? depth + 2 : depth + 1
206+
const depth3 = isNodeGteV23 || isNodeGteV22_12 ? depth + 1 : depth
206207

207208
// @ts-ignore
208209
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call

0 commit comments

Comments
 (0)