@@ -32,33 +32,35 @@ export let rewriteFrameIntegration: {
3232 */
3333export function getDefaultIntegrations ( options : NativescriptClientOptions & NativescriptOptions ) : Integration [ ] {
3434 const integrations : Integration [ ] = [ ] ;
35+ const iteratee = ( frame : StackFrame ) => {
36+ if ( frame . platform === 'javascript' && frame . filename ) {
37+ let filename = frame . filename
38+ . replace ( / ^ f i l e \: \/ \/ / , '' )
39+ . replace ( / ^ a d d r e s s a t / , '' )
40+ . replace ( / ^ .* \/ [ ^ \. ] + ( \. a p p | C o d e P u s h | .* (? = \/ ) ) / , '' ) ;
3541
36- rewriteFrameIntegration = new RewriteFrames ( {
37- iteratee : ( frame : StackFrame ) => {
38- if ( frame . platform === 'javascript' && frame . filename ) {
39- let filename = frame . filename
40- . replace ( / ^ f i l e \: \/ \/ / , '' )
41- . replace ( / ^ a d d r e s s a t / , '' )
42- . replace ( / ^ .* \/ [ ^ \. ] + ( \. a p p | C o d e P u s h | .* (? = \/ ) ) / , '' ) ;
43-
44- if ( frame . filename . indexOf ( '[native code]' ) === - 1 ) {
45- const appPrefix = options . appPrefix ?? '~/' ;
46- if ( appPrefix . endsWith ( '//' ) && ! appPrefix . endsWith ( '///' ) ) {
47- filename = filename . indexOf ( '/' ) === 0 ? `${ appPrefix } ${ filename } ` : `${ appPrefix } /${ filename } ` ;
48- } else {
49- filename = filename . indexOf ( '/' ) === 0 ? `${ appPrefix } ${ filename . slice ( 1 ) } ` : `${ appPrefix } ${ filename } ` ;
50- }
42+ if ( frame . filename . indexOf ( '[native code]' ) === - 1 ) {
43+ const appPrefix = options . appPrefix ?? '~/' ;
44+ if ( appPrefix . endsWith ( '//' ) && ! appPrefix . endsWith ( '///' ) ) {
45+ filename = filename . indexOf ( '/' ) === 0 ? `${ appPrefix } ${ filename } ` : `${ appPrefix } /${ filename } ` ;
46+ } else {
47+ filename = filename . indexOf ( '/' ) === 0 ? `${ appPrefix } ${ filename . slice ( 1 ) } ` : `${ appPrefix } ${ filename } ` ;
5148 }
49+ }
5250
53- frame . filename = filename ;
54- if ( options . colnoOffset ) {
55- frame . colno += options . colnoOffset ;
56- }
57- // We always want to have a tripple slash
51+ frame . filename = filename ;
52+ if ( options . colnoOffset ) {
53+ frame . colno += options . colnoOffset ;
5854 }
59- return frame ;
55+ // We always want to have a tripple slash
6056 }
57+ return frame ;
58+ } ;
59+
60+ rewriteFrameIntegration = new RewriteFrames ( {
61+
6162 } ) as any ;
63+ rewriteFrameIntegration . _iteratee = iteratee ;
6264
6365 // if (notWeb()) {
6466 integrations . push (
0 commit comments