From ae5cb27c23960bab639f5fa3e1e8a2100bddae43 Mon Sep 17 00:00:00 2001 From: Grigory Date: Tue, 11 Jun 2024 00:56:06 +0500 Subject: [PATCH 1/3] fix(dts): terminate worker when work is done --- src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.ts b/src/index.ts index c9af0fd2..d49b31df 100644 --- a/src/index.ts +++ b/src/index.ts @@ -244,8 +244,10 @@ export async function build(_options: Options) { }) worker.on('message', (data) => { if (data === 'error') { + worker.terminate(); reject(new Error('error occured in dts build')) } else if (data === 'success') { + worker.terminate(); resolve() } else { const { type, text } = data From d4cba15936ef558c0424ccf11b5ca2b8ac38d954 Mon Sep 17 00:00:00 2001 From: Grigory Date: Tue, 11 Jun 2024 09:29:07 +0500 Subject: [PATCH 2/3] remove redundant port closing --- src/rollup.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/rollup.ts b/src/rollup.ts index cc8ae952..37fe2358 100644 --- a/src/rollup.ts +++ b/src/rollup.ts @@ -240,7 +240,6 @@ const startRollup = async (options: NormalizedOptions) => { } catch { parentPort?.postMessage('error') } - parentPort?.close() } } @@ -250,7 +249,6 @@ parentPort?.on('message', (data) => { if (!hasTypescript) { logger.error('dts', `You need to install "typescript" in your project`) parentPort?.postMessage('error') - parentPort?.close() return } startRollup(data.options) From dc35149ca6f60869e2cdf3959176d747d54660f6 Mon Sep 17 00:00:00 2001 From: Grigory Date: Thu, 13 Jun 2024 14:16:39 +0500 Subject: [PATCH 3/3] style: remove semicolons --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index d49b31df..a00102d3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -244,10 +244,10 @@ export async function build(_options: Options) { }) worker.on('message', (data) => { if (data === 'error') { - worker.terminate(); + worker.terminate() reject(new Error('error occured in dts build')) } else if (data === 'success') { - worker.terminate(); + worker.terminate() resolve() } else { const { type, text } = data