@@ -189,26 +189,8 @@ export class SourceMapTransformer implements IDebugTransformer {
189189
190190 let sourceMapUrlValue = event . body . sourceMapURL ;
191191
192- if ( ! event . body . sourceMapURL ) {
193-
194- let fileContents = fs . readFileSync ( event . body . scriptUrl , 'utf8' ) ;
195-
196- var baseRegex = "\\s*[@#]\\s*sourceMappingURL\\s*=\\s*([^\\s]*)" ;
197-
198- // Matches /* ... */ comments
199- var blockCommentRegex = new RegExp ( "/\\*" + baseRegex + "\\s*\\*/" ) ;
200-
201- // Matches // .... comments
202- var commentRegex = new RegExp ( "//" + baseRegex + "($|\n|\r\n?)" ) ;
203-
204- let match = fileContents . match ( commentRegex ) ;
205- if ( ! match ) {
206- match = fileContents . match ( blockCommentRegex ) ;
207- }
208-
209- if ( match ) {
210- sourceMapUrlValue = match [ 1 ] ;
211- }
192+ if ( ! sourceMapUrlValue ) {
193+ sourceMapUrlValue = this . _sourceMaps . FindSourceMapUrlInFile ( event . body . scriptUrl ) ;
212194 }
213195
214196 if ( ! sourceMapUrlValue || sourceMapUrlValue === "" ) {
@@ -226,6 +208,36 @@ export class SourceMapTransformer implements IDebugTransformer {
226208 }
227209 }
228210
211+ // private getSourceMappingFile(filePathOrSourceMapValue: string): string {
212+
213+ // let result = filePathOrSourceMapValue;
214+
215+ // if (!fs.existsSync(filePathOrSourceMapValue)) {
216+ // return result;
217+ // }
218+
219+ // let fileContents = fs.readFileSync(filePathOrSourceMapValue, 'utf8');
220+
221+ // var baseRegex = "\\s*[@#]\\s*sourceMappingURL\\s*=\\s*([^\\s]*)";
222+
223+ // // Matches /* ... */ comments
224+ // var blockCommentRegex = new RegExp("/\\*" + baseRegex + "\\s*\\*/");
225+
226+ // // Matches // .... comments
227+ // var commentRegex = new RegExp("//" + baseRegex + "($|\n|\r\n?)");
228+
229+ // let match = fileContents.match(commentRegex);
230+ // if (!match) {
231+ // match = fileContents.match(blockCommentRegex);
232+ // }
233+
234+ // if (match) {
235+ // result = match[1];
236+ // }
237+
238+ // return result;
239+ // }
240+
229241 private resolvePendingBreakpoints ( sourcePath : string ) : void {
230242 // If there's a setBreakpoints request waiting on this script, go through setBreakpoints again
231243 if ( this . _pendingBreakpointsByPath . has ( sourcePath ) ) {
0 commit comments