From 309248ad0ee6f688cbcfc2c06c3797102155859e Mon Sep 17 00:00:00 2001 From: Ilya Ostrovskiy Date: Wed, 21 Apr 2021 14:53:00 -0400 Subject: [PATCH 1/5] use Node.FS.Sync for text file operations to see if that helps with cache invalidation issues --- src/Chanterelle/Internal/Utils/FS.purs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Chanterelle/Internal/Utils/FS.purs b/src/Chanterelle/Internal/Utils/FS.purs index a502e3b..8b47704 100644 --- a/src/Chanterelle/Internal/Utils/FS.purs +++ b/src/Chanterelle/Internal/Utils/FS.purs @@ -13,11 +13,12 @@ import Effect.Aff.Class (class MonadAff, liftAff) import Effect.Class (liftEffect) import Node.Encoding (Encoding(UTF8)) import Node.FS.Aff as FS +import Node.FS.Sync as FSSync import Node.FS.Stats as Stats import Node.Path (FilePath) import Node.Path as Path -unparsePath +unparsePath :: forall p . { dir :: String , name :: String @@ -79,7 +80,7 @@ readTextFile => MonadThrow String m => FilePath -> m String -readTextFile filename = catchingAff (FS.readTextFile UTF8 filename) +readTextFile filename = catchingAff (liftEffect $ FSSync.readTextFile UTF8 filename) writeTextFile :: forall m From f34deaa442008a2de508f012c4c1b3c5b90c58b7 Mon Sep 17 00:00:00 2001 From: Ilya Ostrovskiy Date: Wed, 21 Apr 2021 17:44:40 -0400 Subject: [PATCH 2/5] also writeFileSync --- src/Chanterelle/Internal/Utils/FS.purs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Chanterelle/Internal/Utils/FS.purs b/src/Chanterelle/Internal/Utils/FS.purs index 8b47704..557a9d9 100644 --- a/src/Chanterelle/Internal/Utils/FS.purs +++ b/src/Chanterelle/Internal/Utils/FS.purs @@ -89,7 +89,7 @@ writeTextFile => FilePath -> String -> m Unit -writeTextFile filename contents = catchingAff (FS.writeTextFile UTF8 filename contents) +writeTextFile filename contents = catchingAff (liftEffect $ FSSync.writeTextFile UTF8 filename contents) withTextFile :: forall m From 804478fec893b4d5d703b89d14d00630ae6b3b77 Mon Sep 17 00:00:00 2001 From: Ilya Ostrovskiy Date: Thu, 22 Apr 2021 13:45:35 -0400 Subject: [PATCH 3/5] fingers crossed --- src/Chanterelle/Internal/Utils/FS.purs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Chanterelle/Internal/Utils/FS.purs b/src/Chanterelle/Internal/Utils/FS.purs index 557a9d9..732577e 100644 --- a/src/Chanterelle/Internal/Utils/FS.purs +++ b/src/Chanterelle/Internal/Utils/FS.purs @@ -7,13 +7,14 @@ import Chanterelle.Internal.Types.Compile (CompileError(..)) import Chanterelle.Internal.Utils.Error (catchingAff, withExceptT') import Control.Monad.Error.Class (class MonadThrow, throwError) import Data.DateTime.Instant (fromDateTime, unInstant) +import Data.Function.Uncurried (runFn2, runFn3) import Effect (Effect) import Effect.Aff (Milliseconds) import Effect.Aff.Class (class MonadAff, liftAff) import Effect.Class (liftEffect) -import Node.Encoding (Encoding(UTF8)) +import Node.Encoding (Encoding(..)) import Node.FS.Aff as FS -import Node.FS.Sync as FSSync +import Node.FS.Internal as FSInternal import Node.FS.Stats as Stats import Node.Path (FilePath) import Node.Path as Path @@ -80,7 +81,9 @@ readTextFile => MonadThrow String m => FilePath -> m String -readTextFile filename = catchingAff (liftEffect $ FSSync.readTextFile UTF8 filename) +readTextFile filename = catchingAff wrapInternalRead + where wrapInternalRead = liftEffect <<< FSInternal.mkEffect $ \_ -> runFn2 + FSInternal.unsafeRequireFS.readFileSync filename { encoding: show UTF8, flag: "rs+" } writeTextFile :: forall m @@ -89,7 +92,9 @@ writeTextFile => FilePath -> String -> m Unit -writeTextFile filename contents = catchingAff (liftEffect $ FSSync.writeTextFile UTF8 filename contents) +writeTextFile filename contents = catchingAff wrapInternalWrite + where wrapInternalWrite = liftEffect <<< FSInternal.mkEffect $ \_ -> runFn3 + FSInternal.unsafeRequireFS.writeFileSync filename contents { encoding: show UTF8, flag: "rs+" } withTextFile :: forall m From 1a5fedbfd5810dedbf24b98318412bf23835ed1e Mon Sep 17 00:00:00 2001 From: Ilya Ostrovskiy Date: Thu, 22 Apr 2021 16:02:59 -0400 Subject: [PATCH 4/5] make our own ws+ flag, since thats otherwise not a thing apparently --- src/Chanterelle/Internal/Utils/FS.purs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Chanterelle/Internal/Utils/FS.purs b/src/Chanterelle/Internal/Utils/FS.purs index 732577e..48d69af 100644 --- a/src/Chanterelle/Internal/Utils/FS.purs +++ b/src/Chanterelle/Internal/Utils/FS.purs @@ -8,6 +8,7 @@ import Chanterelle.Internal.Utils.Error (catchingAff, withExceptT') import Control.Monad.Error.Class (class MonadThrow, throwError) import Data.DateTime.Instant (fromDateTime, unInstant) import Data.Function.Uncurried (runFn2, runFn3) +import Data.Int.Bits ((.|.)) import Effect (Effect) import Effect.Aff (Milliseconds) import Effect.Aff.Class (class MonadAff, liftAff) @@ -94,7 +95,12 @@ writeTextFile -> m Unit writeTextFile filename contents = catchingAff wrapInternalWrite where wrapInternalWrite = liftEffect <<< FSInternal.mkEffect $ \_ -> runFn3 - FSInternal.unsafeRequireFS.writeFileSync filename contents { encoding: show UTF8, flag: "rs+" } + FSInternal.unsafeRequireFS.writeFileSync filename contents { encoding: show UTF8, flag: writeSyncFlag } + + writeSyncFlag = FSInternal.unsafeRequireFS."O_TRUNC" + .|. FSInternal.unsafeRequireFS."O_CREAT" + .|. FSInternal.unsafeRequireFS."O_RDWR" + .|. FSInternal.unsafeRequireFS."O_SYNC" withTextFile :: forall m From aef56062cd4adee8112609ab5f166a2096abd01b Mon Sep 17 00:00:00 2001 From: Ilya Ostrovskiy Date: Thu, 22 Apr 2021 18:08:45 -0400 Subject: [PATCH 5/5] bump version to 5.1.3 in prep for release --- package.json | 2 +- packages.dhall | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ac082b4..b499bec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chanterelle", - "version": "5.1.2", + "version": "5.1.3", "description": "A more functional truffle", "license": "ISC", "scripts": { diff --git a/packages.dhall b/packages.dhall index bb4ada6..63b1897 100644 --- a/packages.dhall +++ b/packages.dhall @@ -89,7 +89,7 @@ let additions = , version = "v1.0.0" } - , solc = + , solc = { dependencies = [ "aff" , "argonaut"