@@ -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,13 +86,14 @@ 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
- let parts , filePath , line , column ;
89
+ let separator = "," ;
90
+ let messageSuffix = "" ;
91
+ let parts , filePath , line , column , messagePrefix ;
90
92
91
93
if ( fileIndex >= 0 ) {
92
94
const fileSubstring = rawMessage . substring ( fileIndex + LogSourceMapService . FILE_PREFIX . length ) ;
93
95
//"data/data/org.nativescript.sourceMap/files/app/bundle.js, line: 304, column: 8"
94
- parts = fileSubstring . split ( "," ) ;
96
+ parts = fileSubstring . split ( separator ) ;
95
97
if ( parts . length >= 3 ) {
96
98
// "data/data/org.nativescript.sourceMap/files/app/bundle.js"
97
99
parts [ 0 ] = parts [ 0 ] . replace ( "'" , "" ) ;
@@ -101,7 +103,8 @@ export class LogSourceMapService implements Mobile.ILogSourceMapService {
101
103
parts [ 2 ] = parts [ 2 ] . replace ( " column: " , "" ) ;
102
104
} else {
103
105
// "data/data/org.nativescript.sourceMap/files/app/bundle.js:303:17)"
104
- parts = fileSubstring . split ( ":" ) ;
106
+ separator = ":" ;
107
+ parts = fileSubstring . split ( separator ) ;
105
108
}
106
109
107
110
if ( parts . length >= 3 ) {
@@ -111,24 +114,23 @@ export class LogSourceMapService implements Mobile.ILogSourceMapService {
111
114
filePath = path . relative ( devicePath , `${ "/" } ${ parts [ 0 ] } ` ) ;
112
115
line = parseInt ( parts [ 1 ] ) ;
113
116
column = parseInt ( parts [ 2 ] ) ;
114
- message = rawMessage . substring ( 0 , fileIndex ) ;
117
+ messagePrefix = rawMessage . substring ( 0 , fileIndex ) ;
115
118
for ( let i = 3 ; i < parts . length ; i ++ ) {
116
- message += parts [ i ] ;
119
+ messageSuffix += ` ${ parts [ i ] } ${ i === ( parts . length - 1 ) ? "" : separator } ` ;
117
120
}
118
121
// "JS: at module.exports.push../main-view-model.ts.HelloWorldModel.onTap ("
119
- message = _ . trimEnd ( message , "(" ) ;
120
- message = message . trim ( ) ;
122
+ messagePrefix = _ . trimEnd ( messagePrefix , "(" ) ;
121
123
}
122
124
}
123
125
124
- return { filePath, line, column, message } ;
126
+ return { filePath, line, column, messagePrefix , messageSuffix } ;
125
127
}
126
128
127
129
private parseIosLog ( rawMessage : string ) : IParsedMessage {
128
130
// "CONSOLE INFO file:///app/vendor.js:131:36: HMR: Hot Module Replacement Enabled. Waiting for signal."
129
131
const fileIndex = rawMessage . lastIndexOf ( LogSourceMapService . FILE_PREFIX ) ;
130
- let message = rawMessage ;
131
- let parts , filePath , line , column ;
132
+ let messageSuffix = "" ;
133
+ let parts , filePath , line , column , messagePrefix ;
132
134
133
135
if ( fileIndex >= 0 ) {
134
136
// "app/vendor.js:131:36: HMR: Hot Module Replacement Enabled. Waiting for signal."
@@ -144,15 +146,14 @@ export class LogSourceMapService implements Mobile.ILogSourceMapService {
144
146
line = parseInt ( parts [ 1 ] ) ;
145
147
column = parseInt ( parts [ 2 ] ) ;
146
148
147
- message = rawMessage . substring ( 0 , fileIndex ) . trim ( ) ;
149
+ messagePrefix = rawMessage . substring ( 0 , fileIndex ) ;
148
150
for ( let i = 3 ; i < parts . length ; i ++ ) {
149
- message += parts [ i ] ;
151
+ messageSuffix += ` ${ parts [ i ] } ${ i === ( parts . length - 1 ) ? "" : ":" } ` ;
150
152
}
151
- message = message . trim ( ) ;
152
153
}
153
154
}
154
155
155
- return { filePath, line, column, message } ;
156
+ return { filePath, line, column, messagePrefix , messageSuffix } ;
156
157
}
157
158
158
159
private getFilesLocation ( platform : string , projectData : IProjectData ) : string {
0 commit comments