1
- import { convertIntegrationFnToClass } from '@sentry/core' ;
1
+ import { convertIntegrationFnToClass , defineIntegration } from '@sentry/core' ;
2
2
import type { Event , Integration , IntegrationClass , IntegrationFn , StackFrame } from '@sentry/types' ;
3
3
import { LRUMap , addContextToFrame } from '@sentry/utils' ;
4
4
@@ -47,7 +47,7 @@ interface ContextLinesOptions {
47
47
frameContextLines ?: number ;
48
48
}
49
49
50
- const denoContextLinesIntegration = ( ( options : ContextLinesOptions = { } ) => {
50
+ const _contextLinesIntegration = ( ( options : ContextLinesOptions = { } ) => {
51
51
const contextLines = options . frameContextLines !== undefined ? options . frameContextLines : DEFAULT_LINES_OF_CONTEXT ;
52
52
53
53
return {
@@ -60,12 +60,19 @@ const denoContextLinesIntegration = ((options: ContextLinesOptions = {}) => {
60
60
} ;
61
61
} ) satisfies IntegrationFn ;
62
62
63
- /** Add node modules / packages to the event */
63
+ export const contextLinesIntegration = defineIntegration ( _contextLinesIntegration ) ;
64
+
65
+ /**
66
+ * Add node modules / packages to the event.
67
+ * @deprecated Use `contextLinesIntegration()` instead.
68
+ */
69
+ // eslint-disable-next-line deprecation/deprecation
70
+ export const ContextLines = convertIntegrationFnToClass ( INTEGRATION_NAME , contextLinesIntegration ) as IntegrationClass <
71
+ Integration & { processEvent : ( event : Event ) => Promise < Event > }
72
+ > ;
73
+
64
74
// eslint-disable-next-line deprecation/deprecation
65
- export const ContextLines = convertIntegrationFnToClass (
66
- INTEGRATION_NAME ,
67
- denoContextLinesIntegration ,
68
- ) as IntegrationClass < Integration & { processEvent : ( event : Event ) => Promise < Event > } > ;
75
+ export type ContextLines = typeof ContextLines ;
69
76
70
77
/** Processes an event and adds context lines */
71
78
async function addSourceContext ( event : Event , contextLines : number ) : Promise < Event > {
0 commit comments