-
Notifications
You must be signed in to change notification settings - Fork 473
Expand file tree
/
Copy pathts-jest-compiler.ts
More file actions
23 lines (19 loc) · 910 Bytes
/
ts-jest-compiler.ts
File metadata and controls
23 lines (19 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { TsCompiler } from './ts-compiler'
import type { ConfigSet } from '../config/config-set'
import type { CompilerInstance, ResolvedModulesMap, StringMap } from '../types'
/**
* @internal
*/
export class TsJestCompiler implements CompilerInstance {
private readonly _compilerInstance: CompilerInstance
constructor(readonly configSet: ConfigSet, readonly jestCacheFS: StringMap) {
// Later we can add swc/esbuild or other typescript compiler instance here
this._compilerInstance = new TsCompiler(configSet, jestCacheFS)
}
getResolvedModulesMap(fileContent: string, fileName: string): ResolvedModulesMap {
return this._compilerInstance.getResolvedModulesMap(fileContent, fileName)
}
getCompiledOutput(fileContent: string, fileName: string, supportsStaticESM = false): string {
return this._compilerInstance.getCompiledOutput(fileContent, fileName, supportsStaticESM)
}
}