@@ -276,6 +276,7 @@ var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
276276 * @param {boolean } opts.noResolve: true if compiler should not include non-rooted files in compilation
277277 * @param {boolean } opts.stripInternal: true if compiler should remove declarations marked as @internal
278278 * @param {boolean } opts.noMapRoot: true if compiler omit mapRoot option
279+ * @param {boolean } opts.inlineSourceMap: true if compiler should inline sourceMap
279280 * @param callback: a function to execute after the compilation process ends
280281 */
281282function compileFile ( outFile , sources , prereqs , prefixes , useBuiltCompiler , opts , callback ) {
@@ -313,7 +314,14 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
313314 }
314315
315316 if ( useDebugMode ) {
316- options += " --inlineSourceMap --inlineSources" ;
317+ if ( opts . inlineSourceMap ) {
318+ options += " --inlineSourceMap --inlineSources" ;
319+ } else {
320+ options += " -sourcemap" ;
321+ if ( ! opts . noMapRoot ) {
322+ options += " -mapRoot file:///" + path . resolve ( path . dirname ( outFile ) ) ;
323+ }
324+ }
317325 } else {
318326 options += " --newLine LF" ;
319327 }
@@ -483,6 +491,7 @@ var tscFile = path.join(builtLocalDirectory, compilerFilename);
483491compileFile ( tscFile , compilerSources , [ builtLocalDirectory , copyright ] . concat ( compilerSources ) , [ copyright ] , /*useBuiltCompiler:*/ false ) ;
484492
485493var servicesFile = path . join ( builtLocalDirectory , "typescriptServices.js" ) ;
494+ var servicesFileInBrowserTest = path . join ( builtLocalDirectory , "typescriptServicesInBrowserTest.js" ) ;
486495var standaloneDefinitionsFile = path . join ( builtLocalDirectory , "typescriptServices.d.ts" ) ;
487496var nodePackageFile = path . join ( builtLocalDirectory , "typescript.js" ) ;
488497var nodeDefinitionsFile = path . join ( builtLocalDirectory , "typescript.d.ts" ) ;
@@ -491,7 +500,13 @@ var nodeStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescript_s
491500compileFile ( servicesFile , servicesSources , [ builtLocalDirectory , copyright ] . concat ( servicesSources ) ,
492501 /*prefixes*/ [ copyright ] ,
493502 /*useBuiltCompiler*/ true ,
494- { noOutFile : false , generateDeclarations : true , preserveConstEnums : true , keepComments : true , noResolve : false , stripInternal : true } ,
503+ /*opts*/ { noOutFile : false ,
504+ generateDeclarations : true ,
505+ preserveConstEnums : true ,
506+ keepComments : true ,
507+ noResolve : false ,
508+ stripInternal : true
509+ } ,
495510 /*callback*/ function ( ) {
496511 jake . cpR ( servicesFile , nodePackageFile , { silent : true } ) ;
497512
@@ -514,6 +529,21 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
514529 fs . writeFileSync ( nodeStandaloneDefinitionsFile , nodeStandaloneDefinitionsFileContents ) ;
515530 } ) ;
516531
532+ compileFile (
533+ servicesFileInBrowserTest ,
534+ servicesSources ,
535+ [ builtLocalDirectory , copyright ] . concat ( servicesSources ) ,
536+ /*prefixes*/ [ copyright ] ,
537+ /*useBuiltCompiler*/ true ,
538+ { noOutFile : false ,
539+ generateDeclarations : true ,
540+ preserveConstEnums : true ,
541+ keepComments : true ,
542+ noResolve : false ,
543+ stripInternal : true ,
544+ noMapRoot : true ,
545+ inlineSourceMap : true
546+ } ) ;
517547
518548var serverFile = path . join ( builtLocalDirectory , "tsserver.js" ) ;
519549compileFile ( serverFile , serverSources , [ builtLocalDirectory , copyright ] . concat ( serverSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true ) ;
@@ -614,7 +644,13 @@ directory(builtLocalDirectory);
614644
615645// Task to build the tests infrastructure using the built compiler
616646var run = path . join ( builtLocalDirectory , "run.js" ) ;
617- compileFile ( run , harnessSources , [ builtLocalDirectory , tscFile ] . concat ( libraryTargets ) . concat ( harnessSources ) , [ ] , /*useBuiltCompiler:*/ true ) ;
647+ compileFile (
648+ /*outFile*/ run ,
649+ /*source*/ harnessSources ,
650+ /*prereqs*/ [ builtLocalDirectory , tscFile ] . concat ( libraryTargets ) . concat ( harnessSources ) ,
651+ /*prefixes*/ [ ] ,
652+ /*useBuiltCompiler:*/ true ,
653+ /*opts*/ { inlineSourceMap : true } ) ;
618654
619655var internalTests = "internal/" ;
620656
@@ -813,7 +849,7 @@ task("browserify", ["tests", builtLocalDirectory, nodeServerOutFile], function()
813849} , { async : true } ) ;
814850
815851desc ( "Runs the tests using the built run.js file like 'jake runtests'. Syntax is jake runtests-browser. Additional optional parameters tests=[regex], port=, browser=[chrome|IE]" ) ;
816- task ( "runtests-browser" , [ "tests" , "browserify" , builtLocalDirectory , servicesFile ] , function ( ) {
852+ task ( "runtests-browser" , [ "tests" , "browserify" , builtLocalDirectory , servicesFileInBrowserTest ] , function ( ) {
817853 cleanTestDirs ( ) ;
818854 host = "node" ;
819855 port = process . env . port || process . env . p || '8888' ;
0 commit comments