@@ -9,7 +9,8 @@ interface IParsedMessage {
9
9
filePath ?: string ;
10
10
line ?: number ;
11
11
column ?: number ;
12
- message : string ;
12
+ messagePrefix : string ;
13
+ messageSuffix : string ;
13
14
}
14
15
15
16
interface IFileLocation {
@@ -46,7 +47,7 @@ export class LogSourceMapService implements Mobile.ILogSourceMapService {
46
47
47
48
if ( originalLocation && originalLocation . sourceFile ) {
48
49
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` ;
50
51
} else if ( rawLine !== "" ) {
51
52
outputData = `${ outputData } ${ rawLine } \n` ;
52
53
}
@@ -85,9 +86,9 @@ export class LogSourceMapService implements Mobile.ILogSourceMapService {
85
86
// "System.err: File: "file:///data/data/org.nativescript.sourceMap/files/app/bundle.js, line: 304, column: 8"
86
87
const fileIndex = rawMessage . lastIndexOf ( LogSourceMapService . FILE_PREFIX ) ;
87
88
const deviceProjectPath = util . format ( ANDROID_DEVICE_APP_ROOT_TEMPLATE , projectData . projectIdentifiers . android ) ;
88
- let message = rawMessage ;
89
89
let separator = "," ;
90
- let parts , filePath , line , column ;
90
+ let messageSuffix = "" ;
91
+ let parts , filePath , line , column , messagePrefix ;
91
92
92
93
if ( fileIndex >= 0 ) {
93
94
const fileSubstring = rawMessage . substring ( fileIndex + LogSourceMapService . FILE_PREFIX . length ) ;
@@ -113,24 +114,23 @@ export class LogSourceMapService implements Mobile.ILogSourceMapService {
113
114
filePath = path . relative ( devicePath , `${ "/" } ${ parts [ 0 ] } ` ) ;
114
115
line = parseInt ( parts [ 1 ] ) ;
115
116
column = parseInt ( parts [ 2 ] ) ;
116
- message = rawMessage . substring ( 0 , fileIndex ) ;
117
+ messagePrefix = rawMessage . substring ( 0 , fileIndex ) ;
117
118
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 } ` ;
119
120
}
120
121
// "JS: at module.exports.push../main-view-model.ts.HelloWorldModel.onTap ("
121
- message = _ . trimEnd ( message , "(" ) ;
122
- message = message . trim ( ) ;
122
+ messagePrefix = _ . trimEnd ( messagePrefix , "(" ) ;
123
123
}
124
124
}
125
125
126
- return { filePath, line, column, message } ;
126
+ return { filePath, line, column, messagePrefix , messageSuffix } ;
127
127
}
128
128
129
129
private parseIosLog ( rawMessage : string ) : IParsedMessage {
130
130
// "CONSOLE INFO file:///app/vendor.js:131:36: HMR: Hot Module Replacement Enabled. Waiting for signal."
131
131
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 ;
134
134
135
135
if ( fileIndex >= 0 ) {
136
136
// "app/vendor.js:131:36: HMR: Hot Module Replacement Enabled. Waiting for signal."
@@ -146,15 +146,14 @@ export class LogSourceMapService implements Mobile.ILogSourceMapService {
146
146
line = parseInt ( parts [ 1 ] ) ;
147
147
column = parseInt ( parts [ 2 ] ) ;
148
148
149
- message = rawMessage . substring ( 0 , fileIndex ) . trim ( ) ;
149
+ messagePrefix = rawMessage . substring ( 0 , fileIndex ) ;
150
150
for ( let i = 3 ; i < parts . length ; i ++ ) {
151
- message += `${ parts [ i ] } ${ i === ( parts . length - 1 ) ? "" : ":" } ` ;
151
+ messageSuffix += `${ parts [ i ] } ${ i === ( parts . length - 1 ) ? "" : ":" } ` ;
152
152
}
153
- message = message . trim ( ) ;
154
153
}
155
154
}
156
155
157
- return { filePath, line, column, message } ;
156
+ return { filePath, line, column, messagePrefix , messageSuffix } ;
158
157
}
159
158
160
159
private getFilesLocation ( platform : string , projectData : IProjectData ) : string {
0 commit comments