@@ -151,7 +151,10 @@ object ReportToLinkerOutputAdapter {
151
151
}
152
152
}
153
153
154
- private val sourceMapRe = """ (?m)^//# sourceMappingURL=.*$""" .r
154
+ /* This regex would normally be written with the (?m) flag, but that would
155
+ * require ES2018, so we work around it.
156
+ */
157
+ private val sourceMapRe = """ (?:^|\n)(//# sourceMappingURL=[^\n]*)(?:\n|$)""" .r
155
158
156
159
/** Patches the JS file content to have the provided source map link (or none)
157
160
*
@@ -170,14 +173,14 @@ object ReportToLinkerOutputAdapter {
170
173
} { reMatch =>
171
174
val res = new StringBuilder
172
175
173
- res.append(reMatch.before)
176
+ res.append(reMatch.before( 1 ) )
174
177
175
178
/* If there is no source map link, keep an empty line to not break a
176
179
* potential (unlinked) source map
177
180
*/
178
181
newLine.foreach(res.append(_))
179
182
180
- res.append(reMatch.after)
183
+ res.append(reMatch.after( 1 ) )
181
184
182
185
res.toString()
183
186
}
@@ -193,7 +196,7 @@ object ReportToLinkerOutputAdapter {
193
196
* So as a legacy mechanism, this is OK-ish. It keeps us from having to build
194
197
* the infrastructure to parse JSON cross platform.
195
198
*/
196
- private val fileFieldRe = """ (?m)( [,{])\s*"file"\s*:\s*". *"\s*([,}])""" .r
199
+ private val fileFieldRe = """ ([,{])\s*"file"\s*:\s*"[^"] *"\s*([,}])""" .r
197
200
198
201
/** Patches the source map content to have the provided JS file link (or none).
199
202
*
0 commit comments