From 50cfcf36723f85a7872c20d70d2a9f2b650bad4c Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Mon, 25 May 2020 18:11:43 -0400 Subject: [PATCH 1/3] move getOutputTranspileOnly back where it used to be --- src/index.ts | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/index.ts b/src/index.ts index 547483fde..0bfbbb874 100644 --- a/src/index.ts +++ b/src/index.ts @@ -487,20 +487,6 @@ export function create (rawOptions: CreateOptions = {}): Register { let getOutput: (code: string, fileName: string) => SourceOutput let getTypeInfo: (_code: string, _fileName: string, _position: number) => TypeInfo - const getOutputTranspileOnly = (code: string, fileName: string, overrideCompilerOptions?: Partial<_ts.CompilerOptions>): SourceOutput => { - const result = ts.transpileModule(code, { - fileName, - compilerOptions: overrideCompilerOptions ? { ...config.options, ...overrideCompilerOptions } : config.options, - reportDiagnostics: true, - transformers: transformers as Exclude - }) - - const diagnosticList = filterDiagnostics(result.diagnostics || [], ignoreDiagnostics) - if (diagnosticList.length) reportTSError(diagnosticList) - - return [result.outputText, result.sourceMapText as string] - } - // Use full language services when the fast option is disabled. if (!transpileOnly) { const fileContents = new Map() @@ -790,7 +776,19 @@ export function create (rawOptions: CreateOptions = {}): Register { throw new TypeError('Transformers function is unavailable in "--transpile-only"') } - getOutput = getOutputTranspileOnly + getOutput = (code: string, fileName: string, overrideCompilerOptions?: Partial<_ts.CompilerOptions>): SourceOutput => { + const result = ts.transpileModule(code, { + fileName, + compilerOptions: overrideCompilerOptions ? { ...config.options, ...overrideCompilerOptions } : config.options, + reportDiagnostics: true, + transformers: transformers as Exclude + }) + + const diagnosticList = filterDiagnostics(result.diagnostics || [], ignoreDiagnostics) + if (diagnosticList.length) reportTSError(diagnosticList) + + return [result.outputText, result.sourceMapText as string] + } getTypeInfo = () => { throw new TypeError('Type information is unavailable in "--transpile-only"') From ddb3c346afbf354297777ff8cc2952f030615e09 Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Mon, 25 May 2020 18:16:36 -0400 Subject: [PATCH 2/3] fix --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 0bfbbb874..0a53c9de4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -781,7 +781,7 @@ export function create (rawOptions: CreateOptions = {}): Register { fileName, compilerOptions: overrideCompilerOptions ? { ...config.options, ...overrideCompilerOptions } : config.options, reportDiagnostics: true, - transformers: transformers as Exclude + transformers: transformers }) const diagnosticList = filterDiagnostics(result.diagnostics || [], ignoreDiagnostics) From 7dd49296c1a9d49ecfcb3f9cd468dbba6a992573 Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Mon, 25 May 2020 18:30:32 -0400 Subject: [PATCH 3/3] remove overrideCompilerOptions argument --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 0a53c9de4..2b7513f2d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -776,10 +776,10 @@ export function create (rawOptions: CreateOptions = {}): Register { throw new TypeError('Transformers function is unavailable in "--transpile-only"') } - getOutput = (code: string, fileName: string, overrideCompilerOptions?: Partial<_ts.CompilerOptions>): SourceOutput => { + getOutput = (code: string, fileName: string): SourceOutput => { const result = ts.transpileModule(code, { fileName, - compilerOptions: overrideCompilerOptions ? { ...config.options, ...overrideCompilerOptions } : config.options, + compilerOptions: config.options, reportDiagnostics: true, transformers: transformers })