1515
1616///<reference path="harness.ts"/>
1717
18- namespace Harness . SourceMapRecoder {
18+ namespace Harness . SourceMapRecorder {
1919
2020 interface SourceMapSpanWithDecodeErrors {
2121 sourceMapSpan : ts . SourceMapSpan ;
@@ -202,7 +202,7 @@ namespace Harness.SourceMapRecoder {
202202 }
203203
204204 namespace SourceMapSpanWriter {
205- let sourceMapRecoder : Compiler . WriterAggregator ;
205+ let sourceMapRecorder : Compiler . WriterAggregator ;
206206 let sourceMapSources : string [ ] ;
207207 let sourceMapNames : string [ ] ;
208208
@@ -216,8 +216,8 @@ namespace Harness.SourceMapRecoder {
216216 let prevWrittenJsLine : number ;
217217 let spanMarkerContinues : boolean ;
218218
219- export function intializeSourceMapSpanWriter ( sourceMapRecordWriter : Compiler . WriterAggregator , sourceMapData : ts . SourceMapData , currentJsFile : Compiler . GeneratedFile ) {
220- sourceMapRecoder = sourceMapRecordWriter ;
219+ export function initializeSourceMapSpanWriter ( sourceMapRecordWriter : Compiler . WriterAggregator , sourceMapData : ts . SourceMapData , currentJsFile : Compiler . GeneratedFile ) {
220+ sourceMapRecorder = sourceMapRecordWriter ;
221221 sourceMapSources = sourceMapData . sourceMapSources ;
222222 sourceMapNames = sourceMapData . sourceMapNames ;
223223
@@ -231,15 +231,15 @@ namespace Harness.SourceMapRecoder {
231231
232232 SourceMapDecoder . initializeSourceMapDecoding ( sourceMapData ) ;
233233
234- sourceMapRecoder . WriteLine ( "===================================================================" ) ;
235- sourceMapRecoder . WriteLine ( "JsFile: " + sourceMapData . sourceMapFile ) ;
236- sourceMapRecoder . WriteLine ( "mapUrl: " + sourceMapData . jsSourceMappingURL ) ;
237- sourceMapRecoder . WriteLine ( "sourceRoot: " + sourceMapData . sourceMapSourceRoot ) ;
238- sourceMapRecoder . WriteLine ( "sources: " + sourceMapData . sourceMapSources ) ;
234+ sourceMapRecorder . WriteLine ( "===================================================================" ) ;
235+ sourceMapRecorder . WriteLine ( "JsFile: " + sourceMapData . sourceMapFile ) ;
236+ sourceMapRecorder . WriteLine ( "mapUrl: " + sourceMapData . jsSourceMappingURL ) ;
237+ sourceMapRecorder . WriteLine ( "sourceRoot: " + sourceMapData . sourceMapSourceRoot ) ;
238+ sourceMapRecorder . WriteLine ( "sources: " + sourceMapData . sourceMapSources ) ;
239239 if ( sourceMapData . sourceMapSourcesContent ) {
240- sourceMapRecoder . WriteLine ( "sourcesContent: " + JSON . stringify ( sourceMapData . sourceMapSourcesContent ) ) ;
240+ sourceMapRecorder . WriteLine ( "sourcesContent: " + JSON . stringify ( sourceMapData . sourceMapSourcesContent ) ) ;
241241 }
242- sourceMapRecoder . WriteLine ( "===================================================================" ) ;
242+ sourceMapRecorder . WriteLine ( "===================================================================" ) ;
243243 }
244244
245245 function getSourceMapSpanString ( mapEntry : ts . SourceMapSpan , getAbsentNameIndex ?: boolean ) {
@@ -291,10 +291,10 @@ namespace Harness.SourceMapRecoder {
291291 recordSourceMapSpan ( sourceMapSpan ) ;
292292
293293 assert . isTrue ( spansOnSingleLine . length === 1 ) ;
294- sourceMapRecoder . WriteLine ( "-------------------------------------------------------------------" ) ;
295- sourceMapRecoder . WriteLine ( "emittedFile:" + jsFile . fileName ) ;
296- sourceMapRecoder . WriteLine ( "sourceFile:" + sourceMapSources [ spansOnSingleLine [ 0 ] . sourceMapSpan . sourceIndex ] ) ;
297- sourceMapRecoder . WriteLine ( "-------------------------------------------------------------------" ) ;
294+ sourceMapRecorder . WriteLine ( "-------------------------------------------------------------------" ) ;
295+ sourceMapRecorder . WriteLine ( "emittedFile:" + jsFile . fileName ) ;
296+ sourceMapRecorder . WriteLine ( "sourceFile:" + sourceMapSources [ spansOnSingleLine [ 0 ] . sourceMapSpan . sourceIndex ] ) ;
297+ sourceMapRecorder . WriteLine ( "-------------------------------------------------------------------" ) ;
298298
299299 tsLineMap = ts . computeLineStarts ( newSourceFileCode ) ;
300300 tsCode = newSourceFileCode ;
@@ -306,8 +306,8 @@ namespace Harness.SourceMapRecoder {
306306 writeRecordedSpans ( ) ;
307307
308308 if ( ! SourceMapDecoder . hasCompletedDecoding ( ) ) {
309- sourceMapRecoder . WriteLine ( "!!!! **** There are more source map entries in the sourceMap's mapping than what was encoded" ) ;
310- sourceMapRecoder . WriteLine ( "!!!! **** Remaining decoded string: " + SourceMapDecoder . getRemainingDecodeString ( ) ) ;
309+ sourceMapRecorder . WriteLine ( "!!!! **** There are more source map entries in the sourceMap's mapping than what was encoded" ) ;
310+ sourceMapRecorder . WriteLine ( "!!!! **** Remaining decoded string: " + SourceMapDecoder . getRemainingDecodeString ( ) ) ;
311311
312312 }
313313
@@ -323,7 +323,7 @@ namespace Harness.SourceMapRecoder {
323323
324324 function writeJsFileLines ( endJsLine : number ) {
325325 for ( ; prevWrittenJsLine < endJsLine ; prevWrittenJsLine ++ ) {
326- sourceMapRecoder . Write ( ">>>" + getTextOfLine ( prevWrittenJsLine , jsLineMap , jsFile . code ) ) ;
326+ sourceMapRecorder . Write ( ">>>" + getTextOfLine ( prevWrittenJsLine , jsLineMap , jsFile . code ) ) ;
327327 }
328328 }
329329
@@ -356,9 +356,9 @@ namespace Harness.SourceMapRecoder {
356356 }
357357
358358 function writeSourceMapIndent ( indentLength : number , indentPrefix : string ) {
359- sourceMapRecoder . Write ( indentPrefix ) ;
359+ sourceMapRecorder . Write ( indentPrefix ) ;
360360 for ( let i = 1 ; i < indentLength ; i ++ ) {
361- sourceMapRecoder . Write ( " " ) ;
361+ sourceMapRecorder . Write ( " " ) ;
362362 }
363363 }
364364
@@ -369,12 +369,12 @@ namespace Harness.SourceMapRecoder {
369369 writeSourceMapIndent ( prevEmittedCol , markerId ) ;
370370
371371 for ( let i = prevEmittedCol ; i < endColumn ; i ++ ) {
372- sourceMapRecoder . Write ( "^" ) ;
372+ sourceMapRecorder . Write ( "^" ) ;
373373 }
374374 if ( endContinues ) {
375- sourceMapRecoder . Write ( "->" ) ;
375+ sourceMapRecorder . Write ( "->" ) ;
376376 }
377- sourceMapRecoder . WriteLine ( "" ) ;
377+ sourceMapRecorder . WriteLine ( "" ) ;
378378 spanMarkerContinues = endContinues ;
379379 }
380380
@@ -390,24 +390,24 @@ namespace Harness.SourceMapRecoder {
390390 // If there are decode errors, write
391391 for ( let i = 0 ; i < currentSpan . decodeErrors . length ; i ++ ) {
392392 writeSourceMapIndent ( prevEmittedCol , markerIds [ index ] ) ;
393- sourceMapRecoder . WriteLine ( currentSpan . decodeErrors [ i ] ) ;
393+ sourceMapRecorder . WriteLine ( currentSpan . decodeErrors [ i ] ) ;
394394 }
395395 }
396396
397397 const tsCodeLineMap = ts . computeLineStarts ( sourceText ) ;
398398 for ( let i = 0 ; i < tsCodeLineMap . length ; i ++ ) {
399399 writeSourceMapIndent ( prevEmittedCol , i === 0 ? markerIds [ index ] : " >" ) ;
400- sourceMapRecoder . Write ( getTextOfLine ( i , tsCodeLineMap , sourceText ) ) ;
400+ sourceMapRecorder . Write ( getTextOfLine ( i , tsCodeLineMap , sourceText ) ) ;
401401 if ( i === tsCodeLineMap . length - 1 ) {
402- sourceMapRecoder . WriteLine ( "" ) ;
402+ sourceMapRecorder . WriteLine ( "" ) ;
403403 }
404404 }
405405
406406 prevWrittenSourcePos = sourcePos ;
407407 }
408408
409409 function writeSpanDetails ( currentSpan : SourceMapSpanWithDecodeErrors , index : number ) {
410- sourceMapRecoder . WriteLine ( markerIds [ index ] + getSourceMapSpanString ( currentSpan . sourceMapSpan ) ) ;
410+ sourceMapRecorder . WriteLine ( markerIds [ index ] + getSourceMapSpanString ( currentSpan . sourceMapSpan ) ) ;
411411 }
412412
413413 if ( spansOnSingleLine . length ) {
@@ -431,19 +431,19 @@ namespace Harness.SourceMapRecoder {
431431 // Emit column number etc
432432 iterateSpans ( writeSpanDetails ) ;
433433
434- sourceMapRecoder . WriteLine ( "---" ) ;
434+ sourceMapRecorder . WriteLine ( "---" ) ;
435435 }
436436 }
437437 }
438438
439439 export function getSourceMapRecord ( sourceMapDataList : ts . SourceMapData [ ] , program : ts . Program , jsFiles : Compiler . GeneratedFile [ ] ) {
440- const sourceMapRecoder = new Compiler . WriterAggregator ( ) ;
440+ const sourceMapRecorder = new Compiler . WriterAggregator ( ) ;
441441
442442 for ( let i = 0 ; i < sourceMapDataList . length ; i ++ ) {
443443 const sourceMapData = sourceMapDataList [ i ] ;
444444 let prevSourceFile : ts . SourceFile ;
445445
446- SourceMapSpanWriter . intializeSourceMapSpanWriter ( sourceMapRecoder , sourceMapData , jsFiles [ i ] ) ;
446+ SourceMapSpanWriter . initializeSourceMapSpanWriter ( sourceMapRecorder , sourceMapData , jsFiles [ i ] ) ;
447447 for ( let j = 0 ; j < sourceMapData . sourceMapDecodedMappings . length ; j ++ ) {
448448 const decodedSourceMapping = sourceMapData . sourceMapDecodedMappings [ j ] ;
449449 const currentSourceFile = program . getSourceFile ( sourceMapData . inputSourceFileNames [ decodedSourceMapping . sourceIndex ] ) ;
@@ -457,7 +457,7 @@ namespace Harness.SourceMapRecoder {
457457 }
458458 SourceMapSpanWriter . close ( ) ; // If the last spans werent emitted, emit them
459459 }
460- sourceMapRecoder . Close ( ) ;
461- return sourceMapRecoder . lines . join ( "\r\n" ) ;
460+ sourceMapRecorder . Close ( ) ;
461+ return sourceMapRecorder . lines . join ( "\r\n" ) ;
462462 }
463463}
0 commit comments