@@ -159,9 +159,15 @@ async function transpileProjectAsync(
159
159
const { sourceMap, sourceRoot, experimentalDecorators, inlineSourceMap, useDefineForClassFields } =
160
160
tsConfigOptions ;
161
161
162
- const rootDirsPaths : LookupByPath < number > = new LookupByPath (
163
- ( tsConfigOptions . rootDirs ?? [ ] ) . map ( ( rd ) => [ rd , rd . length ] )
164
- ) ;
162
+ const rootDirs : Set < string > = new Set ( tsConfigOptions . rootDirs ) ;
163
+ if ( tsConfigOptions . rootDir ) {
164
+ rootDirs . add ( tsConfigOptions . rootDir ) ;
165
+ }
166
+
167
+ const rootDirsPaths : LookupByPath < number > = new LookupByPath ( ) ;
168
+ for ( const rootDir of rootDirs ) {
169
+ rootDirsPaths . setItem ( rootDir , rootDir . length ) ;
170
+ }
165
171
166
172
const sourceFilePaths : string [ ] = filesFromTsConfig . filter ( ( filePath ) => ! filePath . endsWith ( '.d.ts' ) ) ;
167
173
@@ -231,7 +237,8 @@ async function transpileProjectAsync(
231
237
swcrc : false ,
232
238
minify : false ,
233
239
234
- inputSourceMap : false ,
240
+ sourceMaps : externalSourceMaps ,
241
+ inputSourceMap : true ,
235
242
sourceRoot,
236
243
isModule : true ,
237
244
@@ -296,6 +303,10 @@ async function transpileProjectAsync(
296
303
for ( const [ outputPrefix , optionsByExtension ] of outputOptions ) {
297
304
const jsFilePath : string = `${ outputPrefix } ${ relativeJsFilePath } ` ;
298
305
const mapFilePath : string | undefined = externalSourceMaps ? `${ jsFilePath } .map` : undefined ;
306
+ const absoluteMapFilePath : string = `${ buildFolderPath } ${ mapFilePath } ` ;
307
+ const relativeMapSrcFilePath : string = Path . convertToSlashes (
308
+ path . relative ( path . dirname ( absoluteMapFilePath ) , srcFilePath )
309
+ ) ;
299
310
300
311
const options : string = tsx ? optionsByExtension . tsx : optionsByExtension . ts ;
301
312
let optionsIndex : number | undefined = indexForOptions . get ( options ) ;
@@ -305,7 +316,7 @@ async function transpileProjectAsync(
305
316
}
306
317
const item : ITransformTask = {
307
318
srcFilePath,
308
- relativeSrcFilePath,
319
+ relativeSrcFilePath : relativeMapSrcFilePath ,
309
320
optionsIndex,
310
321
jsFilePath,
311
322
mapFilePath
@@ -369,17 +380,21 @@ function printTiming(logger: IScopedLogger, times: [string, number][], descripto
369
380
return y [ 1 ] - x [ 1 ] ;
370
381
} ) ;
371
382
372
- logger . terminal . writeVerboseLine ( `${ descriptor } ${ times . length } files at ` , `${ process . uptime ( ) } ` ) ;
373
- logger . terminal . writeVerboseLine ( `Slowest files:` ) ;
374
- for ( let i : number = 0 , len : number = Math . min ( times . length , 10 ) ; i < len ; i ++ ) {
375
- const [ fileName , time ] = times [ i ] ;
383
+ const timesCount : number = times . length ;
384
+ logger . terminal . writeVerboseLine ( `${ descriptor } ${ timesCount } files at ${ process . uptime ( ) } ` ) ;
385
+ if ( timesCount > 0 ) {
386
+ logger . terminal . writeVerboseLine ( `Slowest files:` ) ;
387
+ for ( let i : number = 0 , len : number = Math . min ( timesCount , 10 ) ; i < len ; i ++ ) {
388
+ const [ fileName , time ] = times [ i ] ;
376
389
377
- logger . terminal . writeVerboseLine ( `- ${ fileName } : ${ time . toFixed ( 2 ) } ms` ) ;
378
- }
379
- const medianIndex : number = times . length >> 1 ;
380
- const [ medianFileName , medianTime ] = times [ medianIndex ] ;
390
+ logger . terminal . writeVerboseLine ( `- ${ fileName } : ${ time . toFixed ( 2 ) } ms` ) ;
391
+ }
381
392
382
- logger . terminal . writeVerboseLine ( `Median: (${ medianFileName } ): ${ medianTime . toFixed ( 2 ) } ms` ) ;
393
+ const medianIndex : number = timesCount >> 1 ;
394
+ const [ medianFileName , medianTime ] = times [ medianIndex ] ;
395
+
396
+ logger . terminal . writeVerboseLine ( `Median: (${ medianFileName } ): ${ medianTime . toFixed ( 2 ) } ms` ) ;
397
+ }
383
398
}
384
399
385
400
function endsWithCharacterX ( filePath : string ) : boolean {
0 commit comments