File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -43,9 +43,17 @@ function getTsProperties(args: Parameters<typeof transformer>) {
43
43
}
44
44
// RunMode: TsNode
45
45
else if ( maybeIsTsNode ) {
46
- runMode = RunMode . TsNode ;
47
46
fileNames = tsNodeProps . fileNames ;
48
- compilerOptions = tsNodeProps . compilerOptions ;
47
+
48
+ runMode =
49
+ ! program || ( fileNames . length > 1 && program . getRootFileNames ( ) . length === 1 )
50
+ ? RunMode . TsNodeTranspileOnly
51
+ : RunMode . TsNode ;
52
+
53
+ compilerOptions = {
54
+ ...( program ?. getCompilerOptions ( ) ?? { } ) ,
55
+ ...tsNodeProps ! . compilerOptions
56
+ } ;
49
57
} else {
50
58
throw new Error (
51
59
`Cannot transform without a Program, ts-node instance, or manual parameters supplied. ` +
@@ -89,7 +97,7 @@ export default function transformer(
89
97
90
98
/* Add supplements for various run modes */
91
99
let emitHost = transformationContext . getEmitHost ( ) ;
92
- if ( ! emitHost ) {
100
+ if ( ! emitHost || runMode === RunMode . TsNodeTranspileOnly ) {
93
101
if ( ! fileNames )
94
102
throw new Error (
95
103
`No EmitHost found and could not determine files to be processed. Please file an issue with a reproduction!`
Original file line number Diff line number Diff line change @@ -64,8 +64,9 @@ export interface VisitorContext extends TsTransformPathsContext {
64
64
65
65
export enum RunMode {
66
66
TsNode = "ts-node" ,
67
+ TsNodeTranspileOnly = "ts-node-transpile-only" ,
67
68
Manual = "manual" ,
68
- Program = "program" ,
69
+ Program = "program"
69
70
}
70
71
71
72
// endregion
You can’t perform that action at this time.
0 commit comments