@@ -8,6 +8,7 @@ import { assert, cast, isNonNull, normalizeSlashes, trimExtension } from "../uti
88import { Chunk , modulesToBundleChunks , modulesToChunks } from "./chunk" ;
99import { createResolutionErrorDiagnostic } from "./diagnostics" ;
1010import { buildModule , Module } from "./module" ;
11+ import { getPlugins , Plugin } from "./plugins" ;
1112import { Transpiler , TranspilerHost } from "./transpiler" ;
1213
1314export class Transpilation {
@@ -21,16 +22,16 @@ export class Transpilation {
2122
2223 private readonly implicitScriptExtensions = [ ".ts" , ".tsx" , ".js" , ".jsx" ] as const ;
2324 protected resolver : Resolver ;
25+ public plugins : Plugin [ ] ;
2426
25- constructor ( public transpiler : Transpiler , public program : ts . Program ) {
27+ constructor ( public transpiler : Transpiler , public program : ts . Program , extraPlugins : Plugin [ ] ) {
2628 this . host = transpiler . host ;
2729
28- const { rootDir } = program . getCompilerOptions ( ) ;
2930 this . rootDir =
3031 // getCommonSourceDirectory ignores provided rootDir when TS6059 is emitted
31- rootDir == null
32+ this . options . rootDir == null
3233 ? program . getCommonSourceDirectory ( )
33- : ts . getNormalizedAbsolutePath ( rootDir , this . host . getCurrentDirectory ( ) ) ;
34+ : ts . getNormalizedAbsolutePath ( this . options . rootDir , this . host . getCurrentDirectory ( ) ) ;
3435
3536 this . outDir = this . options . outDir ?? this . rootDir ;
3637
@@ -40,6 +41,8 @@ export class Transpilation {
4041 fileSystem : this . host . resolutionFileSystem ?? fs ,
4142 useSyncFileSystemCalls : true ,
4243 } ) ;
44+
45+ this . plugins = getPlugins ( this , extraPlugins ) ;
4346 }
4447
4548 public emit ( ) : Chunk [ ] {
0 commit comments