From 046bf8fecdfb7eb866300c393c9e329bd3c77a98 Mon Sep 17 00:00:00 2001 From: Raphael Luba Date: Tue, 16 Mar 2021 12:17:48 +0100 Subject: [PATCH 1/6] =?UTF-8?q?Fix:=20Don=E2=80=99t=20load=20file=20conten?= =?UTF-8?q?t=20twice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler.ts b/src/compiler.ts index 378c837..4ef0c91 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -235,7 +235,7 @@ export const makeCompiler = ( }, compile: function (params: CompileParams) { const fileName = params.compile - const code = fs.readFileSync(fileName, 'utf-8') + const code = params.code || fs.readFileSync(fileName, 'utf-8') const compiledPath = params.compiledPath // Prevent occasional duplicate compilation requests From f6aeb7e3c44e3163113421e5e63489a1b36a5a3a Mon Sep 17 00:00:00 2001 From: Raphael Luba Date: Tue, 16 Mar 2021 12:27:50 +0100 Subject: [PATCH 2/6] =?UTF-8?q?Don=E2=80=99t=20load=20file=20content=20unt?= =?UTF-8?q?il=20after=20all=20the=20cheap=20bail-checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler.ts b/src/compiler.ts index 4ef0c91..5ae155b 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -234,8 +234,6 @@ export const makeCompiler = ( } }, compile: function (params: CompileParams) { - const fileName = params.compile - const code = params.code || fs.readFileSync(fileName, 'utf-8') const compiledPath = params.compiledPath // Prevent occasional duplicate compilation requests @@ -255,7 +253,11 @@ export const makeCompiler = ( if (fs.existsSync(compiledPath)) { return } + const starTime = new Date().getTime() + + const fileName = params.compile + const code = params.code || fs.readFileSync(fileName, 'utf-8') const m: any = { _compile: writeCompiled, } From c0532ee04a2386c7b5ccc40c1c311889af7501a7 Mon Sep 17 00:00:00 2001 From: Raphael Luba Date: Tue, 16 Mar 2021 12:48:32 +0100 Subject: [PATCH 3/6] Document how to build this project --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 5b8fa7e..54d9917 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,10 @@ If you have an issue, please create one. But, before: - try to run it with `--debug` flag and see the output - try to make create repro example +## Building + +Run `tsc --build tsconfig.build.json` to transpile this project. + ## Versioning Currently versioning is not stable and it is still treated as pre-release. You might expect some options API changes. If you want to avoid unexpected problems it is recommended to fixate the installed version and update only in case of issues, you may consult [CHANGELOG](CHANGELOG.md) for updates. From 2ac49be8ed2c38335dae58e277080e6b9cd18753 Mon Sep 17 00:00:00 2001 From: Raphael Luba Date: Tue, 16 Mar 2021 13:20:12 +0100 Subject: [PATCH 4/6] =?UTF-8?q?Fix:=20Don=E2=80=99t=20disconnect=20from=20?= =?UTF-8?q?the=20child=20if=20we=20kill=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … otherwise the kill signal will not be received by the child reliably. --- src/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index ed1be9c..4256cc6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -220,9 +220,10 @@ export const runDev = ( child.stopping = true child.respawn = true if (child.connected === undefined || child.connected === true) { - log.debug('Disconnecting from child') - child.disconnect() - if (!willTerminate) { + if (willTerminate) { + log.debug('Disconnecting from child') + child.disconnect() + } else { killChild() } } From 9567b66459f10e65928ce1c4006d56d793045a5c Mon Sep 17 00:00:00 2001 From: Raphael Luba Date: Tue, 16 Mar 2021 13:22:54 +0100 Subject: [PATCH 5/6] Indentation --- src/compiler.ts | 4 ++-- src/index.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler.ts b/src/compiler.ts index 5ae155b..1eb6765 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -256,8 +256,8 @@ export const makeCompiler = ( const starTime = new Date().getTime() - const fileName = params.compile - const code = params.code || fs.readFileSync(fileName, 'utf-8') + const fileName = params.compile + const code = params.code || fs.readFileSync(fileName, 'utf-8') const m: any = { _compile: writeCompiled, } diff --git a/src/index.ts b/src/index.ts index 4256cc6..e928a11 100644 --- a/src/index.ts +++ b/src/index.ts @@ -222,7 +222,7 @@ export const runDev = ( if (child.connected === undefined || child.connected === true) { if (willTerminate) { log.debug('Disconnecting from child') - child.disconnect() + child.disconnect() } else { killChild() } From 3683c61d497e63085bcb2c5fa7d3ad899ecf57ce Mon Sep 17 00:00:00 2001 From: mafo5 Date: Wed, 20 Oct 2021 09:10:53 +0200 Subject: [PATCH 6/6] removed unused variable --- src/compiler.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/compiler.ts b/src/compiler.ts index 1eb6765..b7a73fa 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -257,7 +257,6 @@ export const makeCompiler = ( const starTime = new Date().getTime() const fileName = params.compile - const code = params.code || fs.readFileSync(fileName, 'utf-8') const m: any = { _compile: writeCompiled, }