make sure ts-builder instance is being re-used

pull/151830/head
Johannes 2022-06-11 13:50:06 +02:00
parent 1ccfebef48
commit 175e81149c
No known key found for this signature in database
GPG Key ID: 6DEF802A22264FCA
2 changed files with 9 additions and 2 deletions

View File

@ -51,8 +51,11 @@ function create(projectPath, existingOptions, config, onError = _defaultOnError)
}
}
// FULL COMPILE stream doing transpile, syntax and semantic diagnostics
let _builder;
function createCompileStream(token) {
const _builder = builder.createTypeScriptBuilder({ logFn }, projectPath, cmdLine);
if (!_builder) {
_builder = builder.createTypeScriptBuilder({ logFn }, projectPath, cmdLine);
}
return through(function (file) {
// give the file to the compiler
if (file.isStream()) {

View File

@ -73,9 +73,13 @@ export function create(
}
// FULL COMPILE stream doing transpile, syntax and semantic diagnostics
let _builder!: builder.ITypeScriptBuilder;
function createCompileStream(token?: builder.CancellationToken): Readable & Writable {
const _builder = builder.createTypeScriptBuilder({ logFn }, projectPath, cmdLine);
if (!_builder) {
_builder = builder.createTypeScriptBuilder({ logFn }, projectPath, cmdLine);
}
return through(function (this: through.ThroughStream, file: Vinyl) {
// give the file to the compiler