@@ -9,7 +9,8 @@ interface IParsedMessage {
99 filePath ?: string ;
1010 line ?: number ;
1111 column ?: number ;
12- message : string ;
12+ messagePrefix : string ;
13+ messageSuffix : string ;
1314}
1415
1516interface IFileLocation {
@@ -46,7 +47,7 @@ export class LogSourceMapService implements Mobile.ILogSourceMapService {
4647
4748 if ( originalLocation && originalLocation . sourceFile ) {
4849 const { sourceFile, line, column} = originalLocation ;
49- outputData = `${ outputData } ${ parsedLine . message } ${ LogSourceMapService . FILE_PREFIX } ${ sourceFile } :${ line } :${ column } \n` ;
50+ outputData = `${ outputData } ${ parsedLine . messagePrefix } ${ LogSourceMapService . FILE_PREFIX } ${ sourceFile } :${ line } :${ column } ${ parsedLine . messageSuffix } \n` ;
5051 } else if ( rawLine !== "" ) {
5152 outputData = `${ outputData } ${ rawLine } \n` ;
5253 }
@@ -85,9 +86,9 @@ export class LogSourceMapService implements Mobile.ILogSourceMapService {
8586 // "System.err: File: "file:///data/data/org.nativescript.sourceMap/files/app/bundle.js, line: 304, column: 8"
8687 const fileIndex = rawMessage . lastIndexOf ( LogSourceMapService . FILE_PREFIX ) ;
8788 const deviceProjectPath = util . format ( ANDROID_DEVICE_APP_ROOT_TEMPLATE , projectData . projectIdentifiers . android ) ;
88- let message = rawMessage ;
8989 let separator = "," ;
90- let parts , filePath , line , column ;
90+ let messageSuffix = "" ;
91+ let parts , filePath , line , column , messagePrefix ;
9192
9293 if ( fileIndex >= 0 ) {
9394 const fileSubstring = rawMessage . substring ( fileIndex + LogSourceMapService . FILE_PREFIX . length ) ;
@@ -113,24 +114,23 @@ export class LogSourceMapService implements Mobile.ILogSourceMapService {
113114 filePath = path . relative ( devicePath , `${ "/" } ${ parts [ 0 ] } ` ) ;
114115 line = parseInt ( parts [ 1 ] ) ;
115116 column = parseInt ( parts [ 2 ] ) ;
116- message = rawMessage . substring ( 0 , fileIndex ) ;
117+ messagePrefix = rawMessage . substring ( 0 , fileIndex ) ;
117118 for ( let i = 3 ; i < parts . length ; i ++ ) {
118- message += `${ parts [ i ] } ${ i === ( parts . length - 1 ) ? "" : separator } ` ;
119+ messageSuffix += `${ parts [ i ] } ${ i === ( parts . length - 1 ) ? "" : separator } ` ;
119120 }
120121 // "JS: at module.exports.push../main-view-model.ts.HelloWorldModel.onTap ("
121- message = _ . trimEnd ( message , "(" ) ;
122- message = message . trim ( ) ;
122+ messagePrefix = _ . trimEnd ( messagePrefix , "(" ) ;
123123 }
124124 }
125125
126- return { filePath, line, column, message } ;
126+ return { filePath, line, column, messagePrefix , messageSuffix } ;
127127 }
128128
129129 private parseIosLog ( rawMessage : string ) : IParsedMessage {
130130 // "CONSOLE INFO file:///app/vendor.js:131:36: HMR: Hot Module Replacement Enabled. Waiting for signal."
131131 const fileIndex = rawMessage . lastIndexOf ( LogSourceMapService . FILE_PREFIX ) ;
132- let message = rawMessage ;
133- let parts , filePath , line , column ;
132+ let messageSuffix = "" ;
133+ let parts , filePath , line , column , messagePrefix ;
134134
135135 if ( fileIndex >= 0 ) {
136136 // "app/vendor.js:131:36: HMR: Hot Module Replacement Enabled. Waiting for signal."
@@ -146,15 +146,14 @@ export class LogSourceMapService implements Mobile.ILogSourceMapService {
146146 line = parseInt ( parts [ 1 ] ) ;
147147 column = parseInt ( parts [ 2 ] ) ;
148148
149- message = rawMessage . substring ( 0 , fileIndex ) . trim ( ) ;
149+ messagePrefix = rawMessage . substring ( 0 , fileIndex ) ;
150150 for ( let i = 3 ; i < parts . length ; i ++ ) {
151- message += `${ parts [ i ] } ${ i === ( parts . length - 1 ) ? "" : ":" } ` ;
151+ messageSuffix += `${ parts [ i ] } ${ i === ( parts . length - 1 ) ? "" : ":" } ` ;
152152 }
153- message = message . trim ( ) ;
154153 }
155154 }
156155
157- return { filePath, line, column, message } ;
156+ return { filePath, line, column, messagePrefix , messageSuffix } ;
158157 }
159158
160159 private getFilesLocation ( platform : string , projectData : IProjectData ) : string {
0 commit comments