Skip to content

Commit 866bce6

Browse files
authored
move getOutputTranspileOnly back where it used to be (#1056)
* move getOutputTranspileOnly back where it used to be * fix * remove overrideCompilerOptions argument
1 parent 1f5b1e0 commit 866bce6

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

src/index.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -487,20 +487,6 @@ export function create (rawOptions: CreateOptions = {}): Register {
487487
let getOutput: (code: string, fileName: string) => SourceOutput
488488
let getTypeInfo: (_code: string, _fileName: string, _position: number) => TypeInfo
489489

490-
const getOutputTranspileOnly = (code: string, fileName: string, overrideCompilerOptions?: Partial<_ts.CompilerOptions>): SourceOutput => {
491-
const result = ts.transpileModule(code, {
492-
fileName,
493-
compilerOptions: overrideCompilerOptions ? { ...config.options, ...overrideCompilerOptions } : config.options,
494-
reportDiagnostics: true,
495-
transformers: transformers as Exclude<typeof transformers, Function>
496-
})
497-
498-
const diagnosticList = filterDiagnostics(result.diagnostics || [], ignoreDiagnostics)
499-
if (diagnosticList.length) reportTSError(diagnosticList)
500-
501-
return [result.outputText, result.sourceMapText as string]
502-
}
503-
504490
// Use full language services when the fast option is disabled.
505491
if (!transpileOnly) {
506492
const fileContents = new Map<string, string>()
@@ -790,7 +776,19 @@ export function create (rawOptions: CreateOptions = {}): Register {
790776
throw new TypeError('Transformers function is unavailable in "--transpile-only"')
791777
}
792778

793-
getOutput = getOutputTranspileOnly
779+
getOutput = (code: string, fileName: string): SourceOutput => {
780+
const result = ts.transpileModule(code, {
781+
fileName,
782+
compilerOptions: config.options,
783+
reportDiagnostics: true,
784+
transformers: transformers
785+
})
786+
787+
const diagnosticList = filterDiagnostics(result.diagnostics || [], ignoreDiagnostics)
788+
if (diagnosticList.length) reportTSError(diagnosticList)
789+
790+
return [result.outputText, result.sourceMapText as string]
791+
}
794792

795793
getTypeInfo = () => {
796794
throw new TypeError('Type information is unavailable in "--transpile-only"')

0 commit comments

Comments
 (0)