@@ -8,6 +8,7 @@ import { getFilesToProcess } from 'resolve-tspaths/dist/steps/getFilesToProcess'
88import type { Alias , Change , ProgramPaths } from 'resolve-tspaths/dist/types'
99import { TSConfigPropertyError } from 'resolve-tspaths/dist/utils/errors'
1010import { TsConfig } from 'tsc-prog'
11+ import { inspect } from 'util'
1112import logger from './logger'
1213
1314/**
@@ -46,6 +47,11 @@ export type TsRemapOptions = {
4647 * @default 'src'
4748 */
4849 src ?: string
50+
51+ /**
52+ * Print verbose logs to the console.
53+ */
54+ verbose ?: boolean
4955}
5056
5157export type TsRemapResult = {
@@ -68,7 +74,8 @@ const tsRemap = (options: TsRemapOptions): TsRemapResult | null => {
6874 dryRun,
6975 cwd = process . cwd ( ) ,
7076 ext = 'js,d.ts' ,
71- src = 'src'
77+ src = 'src' ,
78+ verbose
7279 } = options
7380
7481 // Handle missing properties
@@ -94,6 +101,14 @@ const tsRemap = (options: TsRemapOptions): TsRemapResult | null => {
94101 const $changes = `${ changes . length } file${ changes . length === 1 ? '' : 's' } `
95102 logger ( { } , `found ${ $changes } using compilerOptions.paths` , [ ] , LogLevel . INFO )
96103
104+ // Log changes
105+ if ( verbose ) {
106+ for ( const change of changes ) {
107+ const changes = [ inspect ( change . changes , false , null ) ]
108+ logger ( { } , ` ${ change . file } ` , changes , LogLevel . DEBUG )
109+ }
110+ }
111+
97112 // Apply path transformations
98113 if ( ! dryRun ) {
99114 applyChanges ( changes )
@@ -104,7 +119,7 @@ const tsRemap = (options: TsRemapOptions): TsRemapResult | null => {
104119 to : ''
105120 } )
106121
107- if ( changes . length > 0 ) logger ( { } , 'resolve paths' )
122+ if ( changes . length > 0 ) logger ( { } , 'resolve compilerOptions. paths' )
108123 }
109124
110125 return {
0 commit comments